diff --git a/src/toolbox_scs/detectors/viking.py b/src/toolbox_scs/detectors/viking.py index 36324014d33532bfb8f848b777b4693168384211..6c6c50aa4834e85622d9e614a4fda497232e0b46 100644 --- a/src/toolbox_scs/detectors/viking.py +++ b/src/toolbox_scs/detectors/viking.py @@ -195,12 +195,12 @@ class Viking: std_err_ref = std_ref / np.sqrt(data_ref.sizes['trainId']) ds = xr.Dataset() - ds['sample'] = spectrum - ds['sample_std'] = std - ds['sample_std_err'] = std_err - ds['ref'] = spectrum_ref - ds['ref_std'] = std - ds['ref_std_err'] = std_err + ds['It'] = spectrum + ds['It_std'] = std + ds['It_std_err'] = std_err + ds['I0'] = spectrum_ref + ds['I0_std'] = std + ds['I0_std_err'] = std_err ds['absorption'] = spectrum_ref / spectrum ds['absorption_std'] = np.abs(ds['absorption']) * np.sqrt( std_ref**2 / spectrum_ref**2 + std**2 / spectrum**2) @@ -215,25 +215,28 @@ class Viking: return ds def plot_viking_xas(xas, plot_errors=True, xas_ylim=(-1, 3)): - fig, ax = plt.subplots(3, 1, figsize=(8,8), sharex=True) - ax[0].plot(xas.newt_x, xas['ref']) + fig, ax = plt.subplots(3, 1, figsize=(7,7), sharex=True) + ax[0].plot(xas.newt_x, xas['I0']) ax[0].grid() + ax[0].set_title('I0 spectra') - ax[1].plot(xas.newt_x, xas['sample']) + ax[1].plot(xas.newt_x, xas['It']) ax[1].grid() + ax[1].set_title('It spectra') ax[2].plot(xas.newt_x, xas['absorptionCoef']) ax[2].set_ylim(*xas_ylim) ax[2].grid() - + ax[2].set_title('XAS') + if plot_errors: ax[0].fill_between(xas.newt_x, - xas['ref'] - 1.96*xas['ref_std_err'], - xas['ref'] + 1.96*xas['ref_std_err'], + xas['I0'] - 1.96*xas['I0_std_err'], + xas['I0'] + 1.96*xas['I0_std_err'], alpha=0.2) ax[1].fill_between(xas.newt_x, - xas['sample'] - 1.96*xas['sample_std_err'], - xas['sample'] + 1.96*xas['sample_std_err'], + xas['It'] - 1.96*xas['It_std_err'], + xas['It'] + 1.96*xas['It_std_err'], alpha=0.2) ax[2].fill_between(xas.newt_x, xas['absorptionCoef'] - 1.96*xas['absorptionCoef_stderr'],