Adding panels instead of '16'

This commit is contained in:
2023-09-28 11:49:09 +02:00
parent ee52220e85
commit 065ead4884

View File

@@ -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 )