additions and bug fixes in script

This commit is contained in:
Beale John Henry
2023-09-26 17:06:30 +02:00
parent 70f855bd20
commit 399b5ad03d

View File

@@ -13,7 +13,8 @@ python crystfel_split.py -l <path-to-list-file>
-g <path-to-geom-file>
-c <path-to-cell-file>
-n <name-of-job>
# note -p True/False will make a progress bar
# crystfel parameter may need some editing in the function - write_crystfel_run
# output
a series of stream files from crystfel in the current working directory
@@ -48,6 +49,11 @@ def h5_split( lst, chunk_size ):
def write_crystfel_run( proc_dir, name, chunk, chunk_lst_file, geom_file, cell_file ):
"""
crystfel run file - spot-finding and indexing parameters may need some editing
only change from inside the quote ("")
"""
# stream file name
stream_file = "{0}_{1}.stream".format( name, chunk )
@@ -60,11 +66,23 @@ def write_crystfel_run( proc_dir, name, chunk, chunk_lst_file, geom_file, cell_f
run_sh.write( "module load crystfel/0.10.2\n" )
run_sh.write( "indexamajig -i {0} \\\n".format( chunk_lst_file ) )
run_sh.write( " --output={0} \\\n".format( stream_file ) )
run_sh.write( " --geometry={0}\\\n".format( geom_file ) )
run_sh.write( " --geometry={0} \\\n".format( geom_file ) )
run_sh.write( " --pdb={0} \\\n".format( cell_file ) )
run_sh.write( " --indexing=xgandalf-latt-cell --peaks=peakfinder8 \\\n" )
run_sh.write( " --threshold=15 --min-snr=10 --int-radius=3,5,9 \\\n" )
run_sh.write( " -j 32 --no-multi --no-retry --max-res=3000 --min-pix-count=2 --min-res=85\\\n" )
run_sh.write( " --indexing=xgandalf-latt-cell \\\n" )
run_sh.write( " --peaks=peakfinder8 \\\n" )
run_sh.write( " --integration=rings-grad \\\n" )
run_sh.write( " --tolerance=10.0,10.0,10.0,2,3,2 \\\n" )
run_sh.write( " --threshold=10 \\\n" )
run_sh.write( " --min-snr=5 \\\n" )
run_sh.write( " --int-radius=3,5,9 \\\n" )
run_sh.write( " -j 32 \\\n" )
run_sh.write( " --no-multi \\\n" )
run_sh.write( " --check-peaks \\\n" )
run_sh.write( " --no-retry \\\n" )
run_sh.write( " --max-res=3000 \\\n" )
run_sh.write( " --min-pix-count=2 \\\n" )
run_sh.write( " --local-bg-radius=4 \\\n" )
run_sh.write( " --min-res=85" )
run_sh.close()
# make file executable
@@ -107,7 +125,7 @@ def wait_for_jobs( job_ids, total_jobs ):
job_ids.difference_update(completed_jobs)
time.sleep(30)
def run_splits( cwd, name, lst, chunk_size, geom_file, cell_file, progress ):
def run_splits( cwd, name, lst, chunk_size, geom_file, cell_file ):
print( "reading SwissFEL lst file" )
print( "creating {0} image chunks of lst".format( chunk_size ) )
@@ -158,9 +176,8 @@ def run_splits( cwd, name, lst, chunk_size, geom_file, cell_file, progress ):
print( "DONE" )
# include progress bar if required
if progress==True:
wait_for_jobs(submitted_job_ids, chunk)
print("slurm processing done")
wait_for_jobs(submitted_job_ids, chunk)
print("slurm processing done")
# make composite .stream file
output_file = "{0}.stream".format( name )
@@ -195,7 +212,7 @@ if __name__ == "__main__":
"--chunk_size",
help="how big should each chunk be? - the bigger the chunk, the fewer jobs, the slower it will be",
type=int,
default=1000
default=2500
)
parser.add_argument(
"-g",
@@ -216,14 +233,7 @@ if __name__ == "__main__":
type=str,
default="split"
)
parser.add_argument(
"-p",
"--progress",
help="gives you the option of also having a progress bar",
type=bool,
default=True
)
args = parser.parse_args()
# run geom converter
cwd = os.getcwd()
run_splits( cwd, args.job_name, args.lst_file, args.chunk_size, args.geom_file, args.cell_file, args.progress )
run_splits( cwd, args.job_name, args.lst_file, args.chunk_size, args.geom_file, args.cell_file )