Ticket #9096 (assigned)
SANS Reduction of loaded workspaces
Reported by: | Gesner Passos | Owned by: | Peter Parker |
---|---|---|---|
Priority: | major | Milestone: | Backlog |
Component: | SANS | Keywords: | |
Cc: | taylorrj@… | Blocked By: | |
Blocking: | #7500 | Tester: |
Description
This script does not work any more:
import ISISCommandInterface as ici MASKFILE = FileFinder.getFullPath('MaskSANS2DReductionGUI.txt') ici.SANS2D() ici.MaskFile(MASKFILE) sample_ws = Load('22048') ici.AssignSample(sample_ws, reload=False) reduced = ici.WavRangeReduction()
Although, this one works:
import ISISCommandInterface as ici MASKFILE = FileFinder.getFullPath('MaskSANS2DReductionGUI.txt') ici.SANS2D() ici.MaskFile(MASKFILE) sample_ws = LoadNexus('22048') ici.AssignSample(sample_ws, reload=False) reduced = ici.WavRangeReduction()
The reason is that there is a vulnerability in this commit introduced in #8906.
https://github.com/mantidproject/mantid/commit/96f039dace80e93a601d32cfe4ff6fe862a01045
The get_monitor function assumes that if there is no workspace_monitor, than it is a histogram workspace where the monitors precede the detector data.
In this specific case, we have an EventWorkspace but no workspace_monitor. Hence, when SliceEvent gets the monitor, it will get the event workspace. And the slice2histogram will fail.
Before correcting this error, update the SystemTests/AnalysisTests/SANSLoadersTest.py to show this vulnerability, by checking that what is returned from get_monitor has the first detector as monitor.
ws = xxx.get_monitor() assertTrue(ws.getDetector(0).isMonitor())
This should be true always, whatever be the Sample given to the reducer.
Although it is a vulnerability, it is highly unlikely to be 'exploited' in the current status of our interface, as the users have no way to give workspaces directly to be reduced.
Hence, this ticket must be implemented before #7500.
I'll put Russel in cc as he might be interested as he is about to introduce #8906 to a patch release.