diff --git a/nafuma/xanes/calib.py b/nafuma/xanes/calib.py index e16f5a3..a5e4455 100644 --- a/nafuma/xanes/calib.py +++ b/nafuma/xanes/calib.py @@ -375,7 +375,7 @@ def post_edge_fit(data: dict, options={}): aux.write_log(message='Post edge fitting done!', options=options) if options['post_edge_store_data']: - data['post_edge_fit_data'] = post_edge_fit_data + data['post_edge_fit_data'] = post_edge_fit_data.dropna(axis=0) return post_edge_fit_data @@ -875,7 +875,6 @@ 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 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] #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] diff --git a/nafuma/xanes/io.py b/nafuma/xanes/io.py index 7a554db..217a529 100644 --- a/nafuma/xanes/io.py +++ b/nafuma/xanes/io.py @@ -225,9 +225,6 @@ def determine_active_roi(scan_data): # 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 'xmap_roi00' in scan_data.columns: active_roi = 'xmap_roi00' @@ -235,7 +232,7 @@ def determine_active_roi(scan_data): 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()): - 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'].iloc[:int(scan_data.shape[0]/2)].max() - scan_data['xmap_roi00'].iloc[0])/scan_data['xmap_roi00'].max() > (scan_data['xmap_roi01'].iloc[:int(scan_data.shape[0]/2)].max() - scan_data['xmap_roi01'].iloc[0])/scan_data['xmap_roi01'].max(): active_roi = 'xmap_roi00' else: active_roi = 'xmap_roi01'