Skip to content

Commit

Permalink
Merge pull request #427 from mantidproject/11403_flatplateppcorr_work…
Browse files Browse the repository at this point in the history
…space_validation

Add proper workspace validation to FlatPlatePaalmanPingsCorrection
  • Loading branch information
martyngigg committed Mar 20, 2015
2 parents f0b8d9f + 60b4c49 commit 38f3b34
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pylint: disable=no-init,invalid-name
from mantid.simpleapi import *
from mantid.api import PythonAlgorithm, AlgorithmFactory, PropertyMode, MatrixWorkspaceProperty, \
WorkspaceGroupProperty
WorkspaceGroupProperty, InstrumentValidator, WorkspaceUnitValidator
from mantid.kernel import StringListValidator, StringMandatoryValidator, IntBoundedValidator, \
FloatBoundedValidator, Direction, logger
FloatBoundedValidator, Direction, logger, CompositeValidator
import math, numpy as np


Expand Down Expand Up @@ -38,8 +38,11 @@ def summary(self):


def PyInit(self):
ws_validator = CompositeValidator([WorkspaceUnitValidator('Wavelength'), InstrumentValidator()])

self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '',
direction=Direction.Input),
direction=Direction.Input,
validator=ws_validator),
doc='Name for the input sample workspace')

self.declareProperty(name='SampleChemicalFormula', defaultValue='',
Expand All @@ -56,7 +59,8 @@ def PyInit(self):

self.declareProperty(MatrixWorkspaceProperty('CanWorkspace', '',
direction=Direction.Input,
optional=PropertyMode.Optional),
optional=PropertyMode.Optional,
validator=ws_validator),
doc="Name for the input container workspace")

self.declareProperty(name='CanChemicalFormula', defaultValue='',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ available in `RAL Technical Report 74-103
Restrictions on the input workspace
###################################

The input workspace must have units of wavelength.
The input workspace must have a fully defined instrument that has X axis units
of wavelength.

Usage
-----
Expand Down

0 comments on commit 38f3b34

Please sign in to comment.