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

Merge branch 'stack' into 'master'

XAS without dimension stacking

Closes #32

See merge request !151
parents 5f4b2dd8 0b9961e6
No related branches found
No related tags found
1 merge request!151XAS without dimension stacking
...@@ -153,15 +153,18 @@ def xas(nrun, bins=None, Iokey='SCS_SA3', Itkey='MCP3peaks', nrjkey='nrj', ...@@ -153,15 +153,18 @@ def xas(nrun, bins=None, Iokey='SCS_SA3', Itkey='MCP3peaks', nrjkey='nrj',
muIo: the mean of the Io muIo: the mean of the Io
counts: the number of events in each bin counts: the number of events in each bin
""" """
if 'pulseId' in nrun: if 'pulseId' in nrun:
stacked = nrun.stack(dummy_=['trainId', 'pulseId']) pId = 'pulseId'
else: else:
stacked = nrun.stack(dummy_=['trainId', 'sa3_pId']) pId = 'sa3_pId'
Io = nrun[Iokey].values.flatten() + Iooffset
It = nrun[Itkey].values.flatten()
Io = stacked[Iokey].values + Iooffset if pId in nrun[nrjkey].dims:
It = stacked[Itkey].values nrj = nrun[nrjkey].values.flatten()
nrj = stacked[nrjkey].values else:
nrj = np.repeat(nrun[nrjkey].values.flatten(), nrun.dims[pId])
names_list = ['nrj', 'Io', 'It'] names_list = ['nrj', 'Io', 'It']
rundata = np.vstack((nrj, Io, It)) rundata = np.vstack((nrj, Io, It))
......
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