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 instrument view #204

Closed nvaytet closed 4 months ago

nvaytet commented 12 months ago

The DREAM users would like to have an instrument view that has the ability to use a slider to navigate the tof or wavelength dimension.

This would more or less be like implementing this example from the Plopp docs.

However, because the dream files will most probably be loaded as a data group, it should also accept a data group as an input.

nvaytet commented 12 months ago

After having played around with this for a bit, if the data has dimensions e.g. Dimensions: module: 14, segment: 6, counter: 2, wire: 32, strip: 256, tof: 100, we need to flatten all but the tof dimension before sending to the scatter3d plot.

The call signature would be something like dream.instrument_view(data, dim='tof') to say we want to slice the tof dimension.

However, there is a danger that if a user has histogrammed in tof, but forgets to specify dim='tof' in the call (because we still want to be able to use the instrument view for data that has no tof dimension), then the instrument view will flatten all the data, and we are now plotting 100x the number of pixels, and they are all on top of each other.

nvaytet commented 12 months ago

Another point is that I then thought that we could also ask to have a slider along the e.g. strip dimension. Which means that you could just navigate through the strips with the slider. Might be a nice debugging tool.

However, this requires some changes in Plopp because currently the scatter3d will not update the positions of the points, only the colors. So we need some sort of a check if vertices positions have changed, then remove the point cloud and make a new one.

An experiment of this can be found in this branch. However, the check to see if positions are the same is expensive and makes everything slower.

nvaytet commented 12 months ago

@celinedurniak will you require an instrument view that can change the viewed strip with a slider, or having a slider along tof or wavelength only be sufficient?

SimonHeybrock commented 12 months ago

After having played around with this for a bit, if the data has dimensions e.g. Dimensions: module: 14, segment: 6, counter: 2, wire: 32, strip: 256, tof: 100, we need to flatten all but the tof dimension before sending to the scatter3d plot.

The call signature would be something like dream.instrument_view(data, dim='tof') to say we want to slice the tof dimension.

However, there is a danger that if a user has histogrammed in tof, but forgets to specify dim='tof' in the call (because we still want to be able to use the instrument view for data that has no tof dimension), then the instrument view will flatten all the data, and we are now plotting 100x the number of pixels, and they are all on top of each other.

Not sure I see the problem. Since it is DREAM, we know which dims to flatten?

nvaytet commented 4 months ago

Done in #184