Skip to content
Snippets Groups Projects
Commit 0ab7193e authored by Loïc Le Guyader's avatar Loïc Le Guyader
Browse files

Fix the calculation of XAS spectra with bins number or bins width

parent 5ef09113
No related branches found
No related tags found
No related merge requests found
......@@ -102,7 +102,8 @@ def xas(nrun, bins=None, Iokey='SCS_XGM', Itkey='MCP3apd', nrjkey='nrj', Iooffse
Inputs:
nrun: xarray of SCS data
bins: array of bin-edges or number of desired bins
bins: an array of bin-edges or an integer number of
desired bins or a float for the desired bin width.
Iokey: string for the Io fields, typically 'SCS_XGM'
Itkey: string for the It fields, typically 'MCP3apd'
NRJkey: string for the nrj fields, typically 'nrj'
......@@ -140,6 +141,12 @@ def xas(nrun, bins=None, Iokey='SCS_XGM', Itkey='MCP3apd', nrjkey='nrj', Iooffse
num_bins = 80
energy_limits = [np.min(nrj), np.max(nrj)]
bins = np.linspace(energy_limits[0], energy_limits[1], num_bins+1)
elif type(bins) == int:
energy_limits = [np.min(nrj), np.max(nrj)]
bins = np.linspace(energy_limits[0], energy_limits[1], bins+1)
elif type(bins) == float:
energy_limits = [np.min(nrj), np.max(nrj)]
bins = np.arange(energy_limits[0], energy_limits[1], bins)
dummy, nosample = binning(rundata['nrj'], rundata, whichIo, bins)
muA = nosample['muA']
......
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