Poor attempts at fixing bug in roi choice
This commit is contained in:
parent
7336af061f
commit
1a06e7b4fc
2 changed files with 6 additions and 1 deletions
|
|
@ -536,6 +536,7 @@ def restore_from_backup(data):
|
||||||
|
|
||||||
def find_nearest(array, value):
|
def find_nearest(array, value):
|
||||||
''' Finds the value closest to value in array'''
|
''' Finds the value closest to value in array'''
|
||||||
|
|
||||||
array = np.asarray(array)
|
array = np.asarray(array)
|
||||||
idx = (np.abs(array - value)).argmin()
|
idx = (np.abs(array - value)).argmin()
|
||||||
return array[idx]
|
return array[idx]
|
||||||
|
|
@ -874,6 +875,7 @@ def normalise(data: dict, options={}):
|
||||||
|
|
||||||
#Finding the normalisation constant µ_0(E_0), by subtracting the value of the pre-edge-line from the value of the post-edge line at e0
|
#Finding the normalisation constant µ_0(E_0), by subtracting the value of the pre-edge-line from the value of the post-edge line at e0
|
||||||
for filename in data['path']:
|
for filename in data['path']:
|
||||||
|
print(filename)
|
||||||
e0_ind = data['post_edge_fit_data'].loc[data['post_edge_fit_data']['ZapEnergy'] == find_nearest(data['post_edge_fit_data']['ZapEnergy'], data['e0_diff'][filename])].index.values[0]
|
e0_ind = data['post_edge_fit_data'].loc[data['post_edge_fit_data']['ZapEnergy'] == find_nearest(data['post_edge_fit_data']['ZapEnergy'], data['e0_diff'][filename])].index.values[0]
|
||||||
#norm = data['post_edge_fit_data'][filename].iloc[find_nearest(data['post_edge_fit_data'][filename], data['e0'][filename])]
|
#norm = data['post_edge_fit_data'][filename].iloc[find_nearest(data['post_edge_fit_data'][filename], data['e0'][filename])]
|
||||||
normalisation_constant = data['post_edge_fit_data'][filename].iloc[e0_ind] - data['pre_edge_fit_data'][filename].iloc[e0_ind]
|
normalisation_constant = data['post_edge_fit_data'][filename].iloc[e0_ind] - data['pre_edge_fit_data'][filename].iloc[e0_ind]
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,9 @@ def determine_active_roi(scan_data):
|
||||||
# active_roi = 'xmap_roi01'
|
# active_roi = 'xmap_roi01'
|
||||||
|
|
||||||
|
|
||||||
|
# FIXME This is broken now -
|
||||||
|
|
||||||
|
|
||||||
if not ('xmap_roi00' in scan_data.columns) or not ('xmap_roi01' in scan_data.columns):
|
if not ('xmap_roi00' in scan_data.columns) or not ('xmap_roi01' in scan_data.columns):
|
||||||
if 'xmap_roi00' in scan_data.columns:
|
if 'xmap_roi00' in scan_data.columns:
|
||||||
active_roi = 'xmap_roi00'
|
active_roi = 'xmap_roi00'
|
||||||
|
|
@ -232,7 +235,7 @@ def determine_active_roi(scan_data):
|
||||||
active_roi = 'xmap_roi01'
|
active_roi = 'xmap_roi01'
|
||||||
|
|
||||||
elif (scan_data['xmap_roi00'].iloc[0:100].mean() < scan_data['xmap_roi00'].iloc[-100:].mean()) and (scan_data['xmap_roi01'].iloc[0:100].mean() < scan_data['xmap_roi01'].iloc[-100:].mean()):
|
elif (scan_data['xmap_roi00'].iloc[0:100].mean() < scan_data['xmap_roi00'].iloc[-100:].mean()) and (scan_data['xmap_roi01'].iloc[0:100].mean() < scan_data['xmap_roi01'].iloc[-100:].mean()):
|
||||||
if (scan_data['xmap_roi00'].max()-scan_data['xmap_roi00'].min()) > (scan_data['xmap_roi01'].max() - scan_data['xmap_roi01'].min()):
|
if ((scan_data['xmap_roi00'].max()-scan_data['xmap_roi00'].min())) > ((scan_data['xmap_roi01'].max() - scan_data['xmap_roi01'].min())):
|
||||||
active_roi = 'xmap_roi00'
|
active_roi = 'xmap_roi00'
|
||||||
else:
|
else:
|
||||||
active_roi = 'xmap_roi01'
|
active_roi = 'xmap_roi01'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue