mantid
mantid copied to clipboard
Improve transmission run validation in ReflectometryReductionOneAuto
Describe the bug
When using a period transmission run with a flood correction we get error: "Enter a name for the Input/InOut workspace" from algorithm ReflectometryReductionOneAuto
. This is because in method ReflectometryReductionOneAuto3::applyFloodCorrection
we get the transmission run property and cast it's value to a MatrixWorkspace_sptr
, however this returns null
when the transmission run is a WorkspaceGroup
. Passing this empty value into the InputWorkspace
parameter of ApplyFloodWorkspace
results in this error. We use the same approach in ReflectometryReductionOneAuto3::sumBanksForWorkspace
, so this also produces the same error when the transmission run is a WorkspaceGroup
.
To Reproduce
- First load an OFFSPEC flood file from the archive so that you have a flood workspace available.
- Go to Interfaces -> Reflectometry -> ISIS Reflectometry
- On the Runs tab, change the Instrument to
OFFSPEC
- On the Experiment Settings tab, enter
27291
into the 1st Trans Runs column of the Settings Lookup table. Note that this is period data. - Under Flood Correction, select the loaded workspace.
- Back on the Runs tab, in the batch table on the right hand side enter an OFFSPEC run number into the first row of the table.
- Click to process. This will result in error:
Error in execution of algorithm ReflectometryReductionOneAuto:Enter a name for the Input/InOut workspaceError in execution of algorithm ReflectometryISISLoadAndProcess:Enter a name for the Input/InOut workspace at line 109 in '/opt/mantidworkbenchnightly/plugins/python/algorithms/WorkflowAlgorithms/ReflectometryISISLoadAndProcess.py' caused by line 642 in '/opt/mantidworkbenchnightly/plugins/python/algorithms/WorkflowAlgorithms/ReflectometryISISLoadAndProcess.py'Error starting batch algorithmGot error from algorithm "ReflectometryISISLoadAndProcess"
Expected behavior
On the issue with transmission runs that are groups, from looking through the code it appears as though it's assuming users will only pass in workspace groups for the transmission runs if they have passed in a workspace group for the input workspace. There is no validation to prevent a workspace group transmission run being passed in when the input workspace is a MatrixWorkspace. When the algorithm is running for groups, only the first workspace in the transmission run workspace group is applied anyway. Max and Becky have confirmed that trying to use a workspace group transmission run with a non workspace group input workspace is likely to be unintentional and we should add validation for this.
Platform/Version (please complete the following information):
- Mantid Version - since at least 6.6