scipp / ess

European Spallation Source facility bespoke, neutron scattering tools based on scipp.
https://scipp.github.io/ess/
BSD 3-Clause "New" or "Revised" License
3 stars 3 forks source link

DREAM detector diagnostics tool #178

Closed SimonHeybrock closed 3 months ago

SimonHeybrock commented 1 year ago

https://confluence.esss.lu.se/display/DAM/DREAM+-+Detectors+diagnostic+tools

nvaytet commented 1 year ago

After discussion with @celinedurniak, we concluded that probably the most useful and flexible way of approaching this is to make helper function to manipulate and shape the loaded data into a form which makes it easy to then just plot it using default plopp instead of having some custom plotting functions in ess.dream.

First off, it seems it would be useful to have the loader return the data in the file in the form of a DataGroup with the entries for the instrument mantle, endcap, frontcap. This is apprently already in the DREAM nexus geometry and should therfore be straightforward.

Secondly, it will be essential to view the data long its logical (wire, strip, segment, module) dimensions. So what we need to implement in ess is something like ess.dream.to_logical_dims(da).

Below are some examples of pseudo-code we came up with for usability:

from ess import dream
from ess.dream import tools as tls

dg = dream.load('filename.nxs')
dg.keys() # 'mantle', 'end-cap', ...

mantle = tls.to_logical_dims(dg['mantle'])
# or ?
dg = tls.to_logical_dims(dg) # -> new DataGroup

# Additional helpers? calls to_logical_dims internally and sums over module and segment?
tls.wire_vs_strip(dg['mantle']).plot()

# Could then do
pp.slicer(mantle.sum('module'), keep=['strip', 'wire'])

# To show both mantle and endcap at once ?
both = sc.concat([dg['mantle'], dg['endcap']], dim='pixel')
SimonHeybrock commented 1 year ago

Secondly, it will be essential to view the data long its logical (wire, strip, segment, module) dimensions.

Yes, this is definitely the plan. Note that we have previously requested from ECDC to store NXdetector with the logical dims, we should follow-up on the status of that.

nvaytet commented 1 year ago

This for now cannot easily be done for the Nexus files for DREAM because we lack the information about logical dimensions. The list of pixels for each bank has only one dimension. ECDC have promised to store in future nexus files the logical shapes of the pixel arrangement.

SimonHeybrock commented 1 year ago

This for now cannot easily be done for the Nexus files for DREAM because we lack the information about logical dimensions. The list of pixels for each bank has only one dimension. ECDC have promised to store in future nexus files the logical shapes of the pixel arrangement.

I think we will end up with a DREAM file loader (wrapper for scippnexus) anyway. For now, we can manually inject the shape info there, i.e., reshape/fold after loading.

SimonHeybrock commented 1 year ago

ECDC have decided to not provide information about logical dimensions. We will therefore have to hard-code this in our loader.