Skip to content
Snippets Groups Projects
Commit 706a8e2a authored by Dan Nixon's avatar Dan Nixon
Browse files

Add proper workspace validation

Refs #11403
parent f946f7f9
No related branches found
No related tags found
No related merge requests found
#pylint: disable=no-init,invalid-name #pylint: disable=no-init,invalid-name
from mantid.simpleapi import * from mantid.simpleapi import *
from mantid.api import PythonAlgorithm, AlgorithmFactory, PropertyMode, MatrixWorkspaceProperty, \ from mantid.api import PythonAlgorithm, AlgorithmFactory, PropertyMode, MatrixWorkspaceProperty, \
WorkspaceGroupProperty WorkspaceGroupProperty, InstrumentValidator, WorkspaceUnitValidator
from mantid.kernel import StringListValidator, StringMandatoryValidator, IntBoundedValidator, \ from mantid.kernel import StringListValidator, StringMandatoryValidator, IntBoundedValidator, \
FloatBoundedValidator, Direction, logger FloatBoundedValidator, Direction, logger, CompositeValidator
import math, numpy as np import math, numpy as np
...@@ -39,8 +39,11 @@ class FlatPlatePaalmanPingsCorrection(PythonAlgorithm): ...@@ -39,8 +39,11 @@ class FlatPlatePaalmanPingsCorrection(PythonAlgorithm):
def PyInit(self): def PyInit(self):
ws_validator = CompositeValidator([WorkspaceUnitValidator('Wavelength'), InstrumentValidator()])
self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '', self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '',
direction=Direction.Input), direction=Direction.Input,
validator=ws_validator),
doc='Name for the input sample workspace') doc='Name for the input sample workspace')
self.declareProperty(name='SampleChemicalFormula', defaultValue='', self.declareProperty(name='SampleChemicalFormula', defaultValue='',
...@@ -57,7 +60,8 @@ class FlatPlatePaalmanPingsCorrection(PythonAlgorithm): ...@@ -57,7 +60,8 @@ class FlatPlatePaalmanPingsCorrection(PythonAlgorithm):
self.declareProperty(MatrixWorkspaceProperty('CanWorkspace', '', self.declareProperty(MatrixWorkspaceProperty('CanWorkspace', '',
direction=Direction.Input, direction=Direction.Input,
optional=PropertyMode.Optional), optional=PropertyMode.Optional,
validator=ws_validator),
doc="Name for the input container workspace") doc="Name for the input container workspace")
self.declareProperty(name='CanChemicalFormula', defaultValue='', self.declareProperty(name='CanChemicalFormula', defaultValue='',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment