Skip to content
Snippets Groups Projects
Commit c515fd4c authored by Laurent Mercadier's avatar Laurent Mercadier
Browse files

Add transmission in XAS plot and base calibration on 2048 pixels

parent bb8a468c
No related branches found
No related tags found
No related merge requests found
Pipeline #97841 passed
...@@ -8,8 +8,8 @@ from .hrixs import gauss1d ...@@ -8,8 +8,8 @@ from .hrixs import gauss1d
__all__ = ['Viking'] __all__ = ['Viking']
def plot_viking_xas(xas, plot_errors=True, xas_ylim=(-1, 3)): def plot_viking_xas(xas, plot_errors=True, xas_ylim=(-1, 4)):
fig, ax = plt.subplots(3, 1, figsize=(7, 7), sharex=True) fig, ax = plt.subplots(4, 1, figsize=(7, 9), sharex=True)
ax[0].plot(xas.newt_x, xas['I0']) ax[0].plot(xas.newt_x, xas['I0'])
ax[0].grid() ax[0].grid()
ax[0].set_title('I0 spectra') ax[0].set_title('I0 spectra')
...@@ -18,10 +18,14 @@ def plot_viking_xas(xas, plot_errors=True, xas_ylim=(-1, 3)): ...@@ -18,10 +18,14 @@ def plot_viking_xas(xas, plot_errors=True, xas_ylim=(-1, 3)):
ax[1].grid() ax[1].grid()
ax[1].set_title('It spectra') ax[1].set_title('It spectra')
ax[2].plot(xas.newt_x, xas['absorptionCoef']) ax[2].plot(xas.newt_x, xas['It'] / xas['I0'])
ax[2].set_ylim(*xas_ylim)
ax[2].grid() ax[2].grid()
ax[2].set_title('XAS') ax[2].set_title('Transmission It / I0')
ax[3].plot(xas.newt_x, xas['absorptionCoef'])
ax[3].set_ylim(*xas_ylim)
ax[3].grid()
ax[3].set_title('XAS -log(It/I0)/thickness')
if plot_errors: if plot_errors:
ax[0].fill_between(xas.newt_x, ax[0].fill_between(xas.newt_x,
...@@ -32,7 +36,7 @@ def plot_viking_xas(xas, plot_errors=True, xas_ylim=(-1, 3)): ...@@ -32,7 +36,7 @@ def plot_viking_xas(xas, plot_errors=True, xas_ylim=(-1, 3)):
xas['It'] - 1.96*xas['It_stderr'], xas['It'] - 1.96*xas['It_stderr'],
xas['It'] + 1.96*xas['It_stderr'], xas['It'] + 1.96*xas['It_stderr'],
alpha=0.2) alpha=0.2)
ax[2].fill_between(xas.newt_x, ax[3].fill_between(xas.newt_x,
xas['absorptionCoef'] - 1.96*xas['absorptionCoef_stderr'], xas['absorptionCoef'] - 1.96*xas['absorptionCoef_stderr'],
xas['absorptionCoef'] + 1.96*xas['absorptionCoef_stderr'], xas['absorptionCoef'] + 1.96*xas['absorptionCoef_stderr'],
alpha=0.2) alpha=0.2)
...@@ -169,6 +173,7 @@ class Viking: ...@@ -169,6 +173,7 @@ class Viking:
roi = {'newton': {'newton': {'roi': (self.Y_RANGE, self.X_RANGE), roi = {'newton': {'newton': {'roi': (self.Y_RANGE, self.X_RANGE),
'dim': ['newt_y', 'newt_x']}}} 'dim': ['newt_y', 'newt_x']}}}
run, newton = tb.load(self.PROPOSAL, runNB, 'newton', rois=roi) run, newton = tb.load(self.PROPOSAL, runNB, 'newton', rois=roi)
newton = newton.shift(trainId=-1).astype(float) newton = newton.shift(trainId=-1).astype(float)
#load the rest #load the rest
fields = [f for f in self.FIELDS if f != 'newton'] fields = [f for f in self.FIELDS if f != 'newton']
...@@ -178,8 +183,8 @@ class Viking: ...@@ -178,8 +183,8 @@ class Viking:
run, data = tb.load(self.PROPOSAL, runNB, run, data = tb.load(self.PROPOSAL, runNB,
fields=fields) fields=fields)
data = data.merge(newton, join='inner') data = data.merge(newton, join='inner')
data = data.assign_coords(newt_x=np.polyval(self.ENERGY_CALIB, calib = np.polyval(self.ENERGY_CALIB, np.arange(0, 2048))
data['newt_x'])) data = data.assign_coords(newt_x=calib[self.X_RANGE])
if add_attrs: if add_attrs:
params = self.get_camera_params(run) params = self.get_camera_params(run)
for k, v in params.items(): for k, v in params.items():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment