From e08ba22e2c48053cd2b180b78d976a7d907723a8 Mon Sep 17 00:00:00 2001 From: Beale John Henry Date: Wed, 22 Jan 2025 15:42:57 +0100 Subject: [PATCH] added % indexed + and sort index column --- reduction_tools/auto_process.py | 39 +++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/reduction_tools/auto_process.py b/reduction_tools/auto_process.py index 7a9435e..14b3dc0 100644 --- a/reduction_tools/auto_process.py +++ b/reduction_tools/auto_process.py @@ -212,7 +212,8 @@ def scrub_index( index_dir_name ): gamma, gamma_err = get_index_cell( index_log, "gamma" ) # put results into df - data = [ { "images" : int( images ), "indexed" : int( indexed ), + per_index = round( int( indexed )/int( images )*100, 2 ) + data = [ { "images" : int( images ), "indexed" : int( indexed ), "indexed%" : per_index, "index_res" : float( ind_res ), "index_res_err" : float( ind_res_err ), "obs" : float( obs ), "obs_err" : float( obs_err ), "a" : float( a ), "a_err" : float( a_err ), @@ -350,12 +351,27 @@ def main( script_dir, cwd, runs, # re-run check hkl print( "running cc check/compare" ) + # move to partialator directory os.chdir( part_run_name ) check_run_file = part.run_compare_check( "{0}/{1}".format( proc_dir, part_run_name ), part_run_name, cell_file, bins, cc ) submit_cmd = [ "{0}".format( check_run_file ) ] subprocess.call( submit_cmd ) print( "done" ) + # get partialator metrics + try: + overcc = part.get_overall_cc() + except: + overcc = np.nan + try: + overrsplit = part.get_overall_rsplit() + except: + overrsplit = np.nan + try: + b_factor = part.get_b() + except AttributeError as e: + b_factor = np.nan + # make mtz print( "making final mtz" ) cell = read_cell( cell_file ) @@ -371,21 +387,15 @@ def main( script_dir, cwd, runs, shutil.move( F_file, proc_dir ) except shutil.Error as e: pass + + # move back to top directory + os.chdir( proc_dir ) else: print( "partialator not run. {0} > indexed".format( partialator_limit ) ) - os.chdir( part_run_name ) - try: - cc = scrub_cc( part_run_name ) - except AttributeError as e: - cc = np.nan - - # get partialator metrics - overcc = part.get_overall_cc() - overrsplit = part.get_overall_rsplit() - try: - b_factor = part.get_b() - except AttributeError as e: + cc = np.nan + overcc = np.nan + overrsplit = np.nan b_factor = np.nan # collate meta data @@ -409,9 +419,10 @@ def main( script_dir, cwd, runs, # output stats table print( df ) + df = df.reset_index( drop=True ) df.to_csv( "auto_process_summary.csv", sep="," ) - print( "finished all!" ) + print( "finished all" )