Adding panels instead of '16'
This commit is contained in:
@@ -40,6 +40,9 @@ def calculate_new_corner_positions( beam_x, beam_y, jungfrau ):
|
|||||||
origin_y = detectors[ jungfrau ].origin_y
|
origin_y = detectors[ jungfrau ].origin_y
|
||||||
origin_x = detectors[ jungfrau ].origin_x
|
origin_x = detectors[ jungfrau ].origin_x
|
||||||
|
|
||||||
|
# get number of panels
|
||||||
|
panels = len( origin_y )
|
||||||
|
|
||||||
# make df of current corner positions
|
# make df of current corner positions
|
||||||
x_df = pd.DataFrame( origin_x, columns=[ "current_x" ] )
|
x_df = pd.DataFrame( origin_x, columns=[ "current_x" ] )
|
||||||
y_df = pd.DataFrame( origin_y, columns=[ "current_y" ] )
|
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
|
# drop old positions
|
||||||
corner_df = corner_df[[ "new_x", "new_y" ]]
|
corner_df = corner_df[[ "new_x", "new_y" ]]
|
||||||
|
|
||||||
return corner_df
|
return corner_df, panels
|
||||||
|
|
||||||
def scrub_poni( path_to_poni_file ):
|
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()
|
current_geom_file = open( path_to_geom, "r" ).read()
|
||||||
|
|
||||||
# calculate new corner positions
|
# 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
|
# replace current corner positions with new ones
|
||||||
for i in range(0, 16):
|
for i in range(0, panels):
|
||||||
|
|
||||||
# x and y positions
|
# x and y positions
|
||||||
new_x, new_y = round( corner_df.new_x[i], 3 ), round( corner_df.new_y[i], 3 )
|
new_x, new_y = round( corner_df.new_x[i], 3 ), round( corner_df.new_y[i], 3 )
|
||||||
|
|||||||
Reference in New Issue
Block a user