mantid icon indicating copy to clipboard operation
mantid copied to clipboard

Improve transmission run validation in ReflectometryReductionOneAuto

Open rbauststfc opened this issue 1 year ago • 0 comments

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

  1. First load an OFFSPEC flood file from the archive so that you have a flood workspace available.
  2. Go to Interfaces -> Reflectometry -> ISIS Reflectometry
  3. On the Runs tab, change the Instrument to OFFSPEC
  4. On the Experiment Settings tab, enter 27291 into the 1st Trans Runs column of the Settings Lookup table. Note that this is period data.
  5. Under Flood Correction, select the loaded workspace.
  6. 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.
  7. 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

rbauststfc avatar Jan 11 '24 16:01 rbauststfc