I had a question and a suggestion for slice viewer. When using slice viewer to look at data it is quite common for a few instruments that I know of that raw detector images are displayed as time of flight against spectrum number (detector pixels). Currently it is not possible for slice viewer to make a slice of the resulting image (“Error integrating workspace - see log”, with the problem being that one of the axis is a spectrum axis). I was wondering if there is a particular reason that this should be the case, if it is a known problem, or if there is some other reason for the behaviour that I don’t know about for it?
My suggestion was that, if possible, the default width in plane for a slice could be made to ~5% or so of either the range of the axis, or the range of the field of view? Currently I use it for either looking at time of flight data (range 0-100,000) or momentum transfer data (range ±10e-4). It would be useful for me, and probably the other reflectometers, might be good for others too?
I think the problem is that SliceViewer
uses Rebin2D
to the cuts, and Rebin2D
(as the name suggests) wants to rebin both axes and so needs both axes to be a continuous variable, rather than a discrete variable like spectrum id. As the documentation page suggests, you could run ConvertSpectrumAxis
on the workspace first before viewing it using SliceViewer
.
I think the reason Rebin2D
is used, rather than Integration
is because Integration
only integrates over the x-axis. So to get a cut along x you need to transpose the workspace first. Since the SliceViewer
cuts do not require rebinning perpendicular to the cut direction, I guess it could be modified to check if you’re trying to cut a workspace with a spectrum ID axis and to use a different algorithm.
Regarding the suggestion for default cut width - making it 5% of the axis-range would be easy to implement. Making it 5% of the field of view would be a bit more involved but also possible. The issue is what would be a reasonable default… (at least for me, I always rescale it anyway, because I don’t have a “usual” cut - sometimes I need to integrate over the full axis range and some times less but never by the same value). I guess it could be set as another preference (maybe in “2D Plots” - there’s no section for the SliceViewer at the moment).