From 065ead4884abf4e41ea9931560d7a8c957f84e1a Mon Sep 17 00:00:00 2001 From: beale_e Date: Thu, 28 Sep 2023 11:49:09 +0200 Subject: [PATCH] Adding panels instead of '16' --- pyfai-tools/update-geom-from-lab6.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pyfai-tools/update-geom-from-lab6.py b/pyfai-tools/update-geom-from-lab6.py index f840dba..95b1f15 100644 --- a/pyfai-tools/update-geom-from-lab6.py +++ b/pyfai-tools/update-geom-from-lab6.py @@ -40,6 +40,9 @@ def calculate_new_corner_positions( beam_x, beam_y, jungfrau ): origin_y = detectors[ jungfrau ].origin_y origin_x = detectors[ jungfrau ].origin_x + # get number of panels + panels = len( origin_y ) + # make df of current corner positions x_df = pd.DataFrame( origin_x, columns=[ "current_x" ] ) y_df = pd.DataFrame( origin_y, columns=[ "current_y" ] ) @@ -52,7 +55,7 @@ def calculate_new_corner_positions( beam_x, beam_y, jungfrau ): # drop old positions corner_df = corner_df[[ "new_x", "new_y" ]] - return corner_df + return corner_df, panels def scrub_poni( path_to_poni_file ): @@ -91,10 +94,10 @@ def write_new_positions( path_to_geom, beam_x, beam_y, clen, energy, jungfrau, p current_geom_file = open( path_to_geom, "r" ).read() # calculate new corner positions - corner_df = calculate_new_corner_positions( beam_x, beam_y, jungfrau ) + corner_df, panels = calculate_new_corner_positions( beam_x, beam_y, jungfrau ) # replace current corner positions with new ones - for i in range(0, 16): + for i in range(0, panels): # x and y positions new_x, new_y = round( corner_df.new_x[i], 3 ), round( corner_df.new_y[i], 3 )