Пример #1
0
 def PyInit(self):
     self.declareProperty(MultipleFileProperty(name="Filename", action=FileAction.OptionalLoad,
                                               extensions=[".dat"]), "Data files to load")
     condition = EnabledWhenProperty("Filename", PropertyCriterion.IsDefault)
     self.declareProperty('IPTS', Property.EMPTY_INT, "IPTS number to load from")
     self.setPropertySettings("IPTS", condition)
     self.declareProperty('Exp', Property.EMPTY_INT, "Experiment number to load from")
     self.setPropertySettings("Exp", condition)
     self.declareProperty(IntArrayProperty("ScanNumbers", []), 'Scan numbers to load')
     self.setPropertySettings("ScanNumbers", condition)
     self.declareProperty(FileProperty(name="Vanadium", defaultValue="", action=FileAction.OptionalLoad, extensions=[".dat", ".txt"]),
                          doc="Vanadium file, can be either the vanadium scan file or the reduced vcorr file. "
                          "If not provided the vcorr file adjacent to the data file will be used")
     self.declareProperty('Normalise', True, "If False vanadium normalisation will not be performed")
     self.declareProperty(IntArrayProperty("ExcludeDetectors", []),
                          doc="Detectors to exclude. If not provided the HB2A_exp???__exclude_detectors.txt adjacent "
                          "to the data file will be used if it exist")
     self.declareProperty('DefX', '',
                          "By default the def_x (x-axis) from the file will be used, it can be overridden by setting it here")
     self.declareProperty('IndividualDetectors', False,
                          "If True the workspace will include each anode as a separate spectrum, useful for debugging issues")
     condition = EnabledWhenProperty("IndividualDetectors", PropertyCriterion.IsDefault)
     self.declareProperty('BinData', True, "Data will be binned using BinWidth. If False then all data will be unbinned")
     self.setPropertySettings("BinData", condition)
     positiveFloat = FloatBoundedValidator(lower=0., exclusive=True)
     self.declareProperty('BinWidth', 0.05, positiveFloat, "Bin size of the output workspace")
     self.setPropertySettings("BinWidth", condition)
     self.declareProperty('Scale', 1.0, positiveFloat, "The output will be scaled by this value")
     self.declareProperty(WorkspaceProperty("OutputWorkspace", "",
                                            optional=PropertyMode.Mandatory,
                                            direction=Direction.Output),
                          "Output Workspace")
 def test_construction_with_multiple_OR_conditions_succeeds(self):
     # We cannot manipulate properties easily from the Python side compared to the C++
     # side. So we will check we can construct the object from Python correctly and rely
     # on the C++ unit tests to check all operators
     a = EnabledWhenProperty("PropA", PropertyCriterion.IsDefault)
     b = EnabledWhenProperty("PropB", PropertyCriterion.IsDefault)
     result = EnabledWhenProperty(a, b, LogicOperator.Or)
     self.assertIsNotNone(result)
Пример #3
0
    def PyInit(self):
        arrvalidator = StringArrayMandatoryValidator()
        lrg='Input'
        self.declareProperty(StringArrayProperty('Workspaces', values=[], validator=arrvalidator,\
            direction=Direction.Input), doc='list of input workspaces')
        self.declareProperty('LoadErrors', True, direction=Direction.Input,\
            doc='Do we load error data contained in the workspaces?')
        self.declareProperty(FloatArrayProperty('ParameterValues', values=[],\
            validator=FloatArrayMandatoryValidator(),direction=Direction.Input), doc='list of input parameter values')
        self.setPropertyGroup('Workspaces', lrg)
        self.setPropertyGroup('LoadErrors', lrg)
        self.setPropertyGroup('ParameterValues', lrg)

        self.declareProperty('LocalRegression', True, direction=Direction.Input, doc='Perform running local-regression?')
        condition = EnabledWhenProperty("LocalRegression", PropertyCriterion.IsDefault)
        self.declareProperty('RegressionWindow', 6, direction=Direction.Input, doc='window size for the running local-regression')
        self.setPropertySettings("RegressionWindow", condition)
        regtypes = [ 'linear', 'quadratic']
        self.declareProperty('RegressionType', 'quadratic', StringListValidator(regtypes),\
            direction=Direction.Input, doc='type of local-regression; linear and quadratic are available')
        self.setPropertySettings("RegressionType", condition)
        lrg = 'Running Local Regression Options'
        self.setPropertyGroup('LocalRegression', lrg)
        self.setPropertyGroup('RegressionWindow', lrg)
        self.setPropertyGroup('RegressionType', lrg)

        lrg='Output'
        self.declareProperty(FloatArrayProperty('TargetParameters', values=[], ), doc="Parameters to interpolate the structure factor")
        self.declareProperty(StringArrayProperty('OutputWorkspaces', values=[], validator=arrvalidator),\
            doc='list of output workspaces to save the interpolated structure factors')
        self.setPropertyGroup('TargetParameters', lrg)
        self.setPropertyGroup('OutputWorkspaces', lrg)
        self.channelgroup = None
Пример #4
0
    def PyInit(self):
        instruments = ['BSS', 'SNAP', 'REF_M', 'CNCS', 'EQSANS', 'VULCAN',
                       'VENUS', 'MANDI', 'TOPAZ', 'ARCS']
        self.declareProperty('Instrument', '',
                             StringListValidator(instruments),
                             'Empty uses default instrument')

        runValidator = IntBoundedValidator()
        runValidator.setLower(1)
        self.declareProperty('RunNumber', Property.EMPTY_INT, runValidator,
                             doc='Live run number to use (Optional, Default=most recent)')

        self.declareProperty(WorkspaceProperty('OutputWorkspace', '',
                                               direction=Direction.Output))

        self.declareProperty('NormalizeByCurrent', True, 'Normalize by current')

        self.declareProperty('LoadLogs', True,
                             'Attempt to load logs from an existing file')

        self.declareProperty(FileProperty('LogFilename', '',
                                          direction=Direction.Input,
                                          action=FileAction.OptionalLoad,
                                          extensions=['_event.nxs']),
                             doc='File containing logs to use (Optional)')
        self.setPropertySettings('LogFilename',
                                 EnabledWhenProperty('LoadLogs',
                                                     PropertyCriterion.IsDefault))
Пример #5
0
    def _declareSlicingProperties(self):
        """Copy properties from the child slicing algorithm and add our own custom ones"""
        self.declareProperty(Prop.SLICE,
                             False,
                             doc='If true, slice the input workspace')
        self.setPropertyGroup(Prop.SLICE, 'Slicing')
        # Convenience variables for conditional properties
        whenSliceEnabled = EnabledWhenProperty(Prop.SLICE,
                                               PropertyCriterion.IsEqualTo,
                                               "1")

        self._slice_properties = [
            'TimeInterval', 'LogName', 'LogValueInterval',
            'UseNewFilterAlgorithm'
        ]
        self.copyProperties('ReflectometrySliceEventWorkspace',
                            self._slice_properties)
        for property in self._slice_properties:
            self.setPropertySettings(property, whenSliceEnabled)
            self.setPropertyGroup(property, 'Slicing')

        self.declareProperty(
            name=Prop.NUMBER_OF_SLICES,
            defaultValue=Property.EMPTY_INT,
            validator=IntBoundedValidator(lower=1),
            direction=Direction.Input,
            doc=
            'The number of uniform-length slices to slice the input workspace into'
        )
        self.setPropertySettings(Prop.NUMBER_OF_SLICES, whenSliceEnabled)
        self.setPropertyGroup(Prop.NUMBER_OF_SLICES, 'Slicing')
Пример #6
0
 def PyInit(self):
     self.declareProperty("BasicProp1", 1)
     self.declareProperty("BasicProp2", 1)
     self.setPropertySettings(
         "BasicProp2",
         EnabledWhenProperty("BasicProp1",
                             PropertyCriterion.IsDefault))
 def PyInit(self):
     self.declareProperty(WorkspaceProperty('Workspace', '', direction=Direction.Input), doc='Workspace that should be used.')
     self.declareProperty('AddMinimum',
                          True,
                          direction=Direction.Input,
                          doc='If set to True, adds the most negative intensity to all intensities.')
     self.declareProperty('ResetValue', 0, direction=Direction.Input, doc='Set negative intensities to the specified value (default=0).')
     self.setPropertySettings('ResetValue', EnabledWhenProperty('AddMinimum', PropertyCriterion.IsNotDefault))
Пример #8
0
 def test_default_construction_raises_error(self):
     try:
         EnabledWhenProperty()
         self.fail("Expected default constructor to raise an error")
     except Exception as e:
         # boost.python.ArgumentError are not catchable
         if "Python argument types in" not in str(e):
             raise RuntimeError("Unexpected exception type raised")
Пример #9
0
    def PyInit(self):
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))
        positiveFloat = FloatBoundedValidator(lower=0)

        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            optional=PropertyMode.Mandatory,
            direction=Direction.Input),
                             doc='Input workspace.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='The output of the algorithm.')
        self.declareProperty(name=common.PROP_CLEANUP_MODE,
                             defaultValue=common.CLEANUP_ON,
                             validator=StringListValidator(
                                 [common.CLEANUP_ON, common.CLEANUP_OFF]),
                             direction=Direction.Input,
                             doc='What to do with intermediate workspaces.')
        self.declareProperty(
            name=common.PROP_SUBALG_LOGGING,
            defaultValue=common.SUBALG_LOGGING_OFF,
            validator=StringListValidator(
                [common.SUBALG_LOGGING_OFF, common.SUBALG_LOGGING_ON]),
            direction=Direction.Input,
            doc='Enable or disable subalgorithms to ' + 'print in the logs.')
        self.declareProperty(
            ITableWorkspaceProperty(name=common.PROP_EPP_WS,
                                    defaultValue='',
                                    direction=Direction.Input,
                                    optional=PropertyMode.Mandatory),
            doc='Table workspace containing results from the FindEPP algorithm.'
        )
        self.declareProperty(
            name=common.PROP_DWF_CORRECTION,
            defaultValue=common.DWF_ON,
            validator=StringListValidator([common.DWF_ON, common.DWF_OFF]),
            direction=Direction.Input,
            doc=
            'Enable or disable the correction for the Debye-Waller factor for '
            + common.PROP_OUTPUT_WS + '.')
        self.declareProperty(
            name=common.PROP_TEMPERATURE,
            defaultValue=Property.EMPTY_DBL,
            validator=positiveFloat,
            direction=Direction.Input,
            doc='Experimental temperature (Vanadium ' +
            'reduction type only) for the Debye-Waller correction, in Kelvins.'
        )
        self.setPropertySettings(
            common.PROP_TEMPERATURE,
            EnabledWhenProperty(common.PROP_DWF_CORRECTION,
                                PropertyCriterion.IsDefault))
Пример #10
0
    def PyInit(self):
        self.declareProperty(StringArrayProperty('InputWorkspace', direction=Direction.Input, validator=ADSValidator()),
                             doc="Input MD workspace (in Q-space) to use for peak finding")
        cell_type = StringListValidator()
        cell_type.addAllowedValue("Cubic")
        cell_type.addAllowedValue("Hexagonal")
        cell_type.addAllowedValue("Rhombohedral")
        cell_type.addAllowedValue("Tetragonal")
        cell_type.addAllowedValue("Orthorhombic")
        cell_type.addAllowedValue("Monoclinic")
        cell_type.addAllowedValue("Triclinic")
        self.declareProperty("CellType", "", cell_type, doc="Cell type to use for UB refining")

        centering_type = StringListValidator()
        centering_type.addAllowedValue("F")
        centering_type.addAllowedValue("I")
        centering_type.addAllowedValue("C")
        centering_type.addAllowedValue("P")
        centering_type.addAllowedValue("R")
        self.declareProperty("Centering", "P", centering_type, doc="Centering to use for selecting cells")

        # Some of the options to pass through to FindPeaksMD (options like CalculateGoniometerForCW, FlipX, etc are
        # assumed to be True)
        self.declareProperty("MaxPeaks", 1000, doc="Maximum number of peaks to find.")
        self.declareProperty("PeakDistanceThreshold", 0.25, doc="Threshold distance for rejecting peaks that are found "
                                                                "to be too close from each other")
        # Having this number too low will likely cause FindUBUsingFFT to fail since not enough peaks will be found
        self.declareProperty("DensityThresholdFactor", 2000.0,
                             doc="Scaling factor which the overall signal density will be multiplied by to determine "
                                 "a threshold for determining peaks.")

        self.declareProperty("Wavelength", FloatPropertyWithValue.EMPTY_DBL,
                             doc="Wavelength value to use only if one was not found in the sample log")

        # Lattice parameter validators from same as FindUBUsingLatticeParameters
        self.declareProperty("UseLattice", False, direction=Direction.Input,
                             doc="Whether to refine UB matrix based on given lattice parameters")

        self.declareProperty("LatticeA", FloatPropertyWithValue.EMPTY_DBL, doc="The a value of the lattice")
        self.declareProperty("LatticeB", FloatPropertyWithValue.EMPTY_DBL, doc="The b value of the lattice")
        self.declareProperty("LatticeC", FloatPropertyWithValue.EMPTY_DBL, doc="The c value of the lattice")
        self.declareProperty("LatticeAlpha", FloatPropertyWithValue.EMPTY_DBL, doc="The alpha value of the lattice")
        self.declareProperty("LatticeBeta", FloatPropertyWithValue.EMPTY_DBL, doc="The beta value of the lattice")
        self.declareProperty("LatticeGamma", FloatPropertyWithValue.EMPTY_DBL, doc="The gamma value of the lattice")

        self.declareProperty(WorkspaceProperty("OutputWorkspace", defaultValue="", direction=Direction.Output,
                                               optional=PropertyMode.Mandatory), doc="Output peaks workspace")

        lattice_params = ["LatticeA", "LatticeB", "LatticeC", "LatticeAlpha", "LatticeBeta", "LatticeGamma"]
        for param in lattice_params:
            self.setPropertyGroup(param, "Lattice Settings")
            self.setPropertySettings(param, EnabledWhenProperty("UseLattice", PropertyCriterion.IsNotDefault))
Пример #11
0
 def loadResetNegatives2D():
     # input for ResetNegatives2D
     self.declareProperty('AddMinimum',
                          True,
                          direction=Direction.Input,
                          doc='If set to True, adds the most negative intensity to all intensities.')
     self.declareProperty('ResetValue',
                          0,
                          direction=Direction.Input,
                          doc='Set negative intensities to the specified value (default=0).')
     self.setPropertySettings('ResetValue', EnabledWhenProperty('AddMinimum', PropertyCriterion.IsNotDefault))
     grp13 = 'ResetNegatives2D'
     self.setPropertyGroup('AddMinimum', grp13)
     self.setPropertyGroup('ResetValue', grp13)
Пример #12
0
    def PyInit(self):
        self.declareProperty(IMDWorkspaceProperty("InputWorkspace", defaultValue="", optional=PropertyMode.Mandatory,
                                                  direction=Direction.Input),
                             doc="Input MD workspace (in Q-space) to use for peak prediction")

        self.declareProperty(IPeaksWorkspaceProperty("UBWorkspace", defaultValue="", optional=PropertyMode.Optional,
                                                     direction=Direction.Input),
                             doc="PeaksWorkspace with UB matrix to use, if non is provided the UB from the InputWorkspace is used")

        self.declareProperty(name="ReflectionCondition",
                             defaultValue="Primitive",
                             direction=Direction.Input,
                             validator=StringListValidator(
                                 ["Primitive",
                                  "C-face centred",
                                  "A-face centred",
                                  "B-face centred",
                                  "Body centred",
                                  "All-face centred",
                                  "Rhombohedrally centred, obverse",
                                  "Rhombohedrally centred, reverse",
                                  "Hexagonally centred, reverse"]),
                             doc="Reflection condition for Predicted Peaks.")

        self.declareProperty("Wavelength", FloatPropertyWithValue.EMPTY_DBL,
                             doc="Wavelength value to use only if one was not found in the sample log")

        self.declareProperty("SatellitePeaks", False, "If to Predict Satellite Peaks")
        condition = EnabledWhenProperty("SatellitePeaks", PropertyCriterion.IsNotDefault)
        self.declareProperty("ModVector1", "0.0,0.0,0.0", "Offsets for h, k, l directions")
        self.declareProperty("ModVector2", "0.0,0.0,0.0", "Offsets for h, k, l directions")
        self.declareProperty("ModVector3", "0.0,0.0,0.0", "Offsets for h, k, l directions")
        self.declareProperty("MaxOrder", 0, "Maximum order to apply ModVectors. Default = 0")
        self.declareProperty("GetModVectorsFromUB", False, "If false Modulation Vectors will be read from input")
        self.declareProperty("CrossTerms", False, "Include cross terms (false)")
        self.declareProperty("IncludeIntegerHKL", True, "If false order 0 peaks are not included in workspace (integer HKL)")
        self.declareProperty("MinDSpacing", 1.0, "Minimum d-spacing of peaks to consider. Default = 1")
        self.declareProperty("MaxDSpacing", 100.0, "Maximum d-spacing of peaks to consider. Default = 100")
        self.setPropertySettings("ModVector1", condition)
        self.setPropertySettings("ModVector2", condition)
        self.setPropertySettings("ModVector3", condition)
        self.setPropertySettings("MaxOrder", condition)
        self.setPropertySettings("GetModVectorsFromUB", condition)
        self.setPropertySettings("CrossTerms", condition)
        self.setPropertySettings("IncludeIntegerHKL", condition)

        self.declareProperty(IPeaksWorkspaceProperty("OutputWorkspace", defaultValue="", direction=Direction.Output,
                                                     optional=PropertyMode.Mandatory), doc="Output peaks workspace")
Пример #13
0
 def PyInit(self):
     self.declareProperty(MultipleFileProperty('Filename'),
                          doc='List of input files')
     self.getProperty('Filename').setAutoTrim(setting=False)
     self.declareProperty(
         'LoaderName',
         defaultValue='Load',
         validator=StringContainsValidator(['Load']),
         direction=Direction.InOut,
         doc='The name of the specific loader. Generic Load by default.')
     self.declareProperty('LoaderVersion',
                          defaultValue=-1,
                          direction=Direction.InOut,
                          doc='The version of the specific loader')
     self.declareProperty(PropertyManagerProperty('LoaderOptions', dict()),
                          doc='Options for the specific loader')
     self.declareProperty(PropertyManagerProperty('MergeRunsOptions',
                                                  dict()),
                          doc='Options for merging the metadata')
     self.declareProperty(WorkspaceProperty('OutputWorkspace',
                                            '',
                                            direction=Direction.Output),
                          doc='Output workspace or workspace group.')
     self.declareProperty(
         'OutputBehaviour',
         'Group',
         StringListValidator(['Group', 'Concatenate']),
         doc=
         'Whether to group the workspaces to a workspace group or to concatenate them to a single workspace.'
     )
     self.declareProperty(
         'SampleLogAsXAxis',
         '',
         doc=
         'Sample log to be put as x-axis when concatenating; will use linear indices if left blank.'
     )
     self.setPropertySettings(
         'SampleLogAsXAxis',
         EnabledWhenProperty('OutputBehaviour', PropertyCriterion.IsEqualTo,
                             'Concatenate'))
Пример #14
0
    def PyInit(self):
        self.declareProperty(
            MatrixWorkspaceProperty('HABCountsSample', '', optional=PropertyMode.Mandatory, direction=Direction.Input),
            doc='High angle bank sample workspace in Q')

        self.declareProperty(
            MatrixWorkspaceProperty('HABNormSample', '', optional=PropertyMode.Mandatory, direction=Direction.Input),
            doc='High angle bank normalization workspace in Q')

        self.declareProperty(
            MatrixWorkspaceProperty('LABCountsSample', '', optional=PropertyMode.Mandatory, direction=Direction.Input),
            doc='Low angle bank sample workspace in Q')

        self.declareProperty(
            MatrixWorkspaceProperty('LABNormSample', '', optional=PropertyMode.Mandatory, direction=Direction.Input),
            doc='Low angle bank normalization workspace in Q')

        self.declareProperty('ProcessCan', defaultValue=False, direction=Direction.Input, doc='Process the can')

        self.declareProperty(
            MatrixWorkspaceProperty('HABCountsCan', '', optional=PropertyMode.Optional, direction=Direction.Input),
            doc='High angle bank sample workspace in Q')

        self.declareProperty(
            MatrixWorkspaceProperty('HABNormCan', '', optional=PropertyMode.Optional, direction=Direction.Input),
            doc='High angle bank normalization workspace in Q')

        self.declareProperty(
            MatrixWorkspaceProperty('LABCountsCan', '', optional=PropertyMode.Optional, direction=Direction.Input),
            doc='Low angle bank sample workspace in Q')

        self.declareProperty(
            MatrixWorkspaceProperty('LABNormCan', '', optional=PropertyMode.Optional, direction=Direction.Input),
            doc='Low angle bank normalization workspace in Q')

        allowedModes = StringListValidator(list(self._make_mode_map().keys()))

        self.declareProperty('Mode', 'None', validator=allowedModes, direction=Direction.Input,
                             doc='What to fit. Free parameter(s).')

        self.declareProperty('ScaleFactor', defaultValue=Property.EMPTY_DBL, direction=Direction.Input,
                             doc='Optional scaling factor')

        self.declareProperty('ShiftFactor', defaultValue=Property.EMPTY_DBL, direction=Direction.Input,
                             doc='Optional shift factor')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace', '', direction=Direction.Output),
                             doc='Stitched high and low Q 1-D data')

        self.declareProperty('OutScaleFactor', defaultValue=Property.EMPTY_DBL, direction=Direction.Output,
                             doc='Applied scale factor')
        self.declareProperty('OutShiftFactor', defaultValue=Property.EMPTY_DBL, direction=Direction.Output,
                             doc='Applied shift factor')

        self.setPropertyGroup("Mode", 'Fitting')
        self.setPropertyGroup("ScaleFactor", 'Fitting')
        self.setPropertyGroup("ShiftFactor", 'Fitting')

        self.setPropertyGroup("HABCountsSample", 'Sample')
        self.setPropertyGroup("HABNormSample", 'Sample')
        self.setPropertyGroup("LABCountsSample", 'Sample')
        self.setPropertyGroup("LABNormSample", 'Sample')

        self.setPropertyGroup("OutputWorkspace", 'Output')
        self.setPropertyGroup("OutScaleFactor", 'Output')
        self.setPropertyGroup("OutShiftFactor", 'Output')

        can_settings = EnabledWhenProperty('ProcessCan', PropertyCriterion.IsNotDefault)

        self.setPropertyGroup("HABCountsCan", 'Can')
        self.setPropertyGroup("HABNormCan", 'Can')
        self.setPropertyGroup("LABCountsCan", 'Can')
        self.setPropertyGroup("LABNormCan", 'Can')
        self.setPropertySettings("HABCountsCan", can_settings)
        self.setPropertySettings("HABNormCan", can_settings)
        self.setPropertySettings("LABCountsCan", can_settings)
        self.setPropertySettings("LABNormCan", can_settings)
Пример #15
0
 def test_construction_with_name_criterion_only_succeeds(self):
     p = EnabledWhenProperty("OtherProperty", PropertyCriterion.IsDefault)
Пример #16
0
    def PyInit(self):
        self._short_inst = "BSS"
        self._long_inst = "BASIS"
        self._extension = "_event.nxs"

        self.declareProperty("RunNumbers", "", "Sample run numbers")
        self.declareProperty("DoIndividual", False, "Do each run individually")
        self.declareProperty("NoMonitorNorm", False,
                             "Stop monitor normalization")
        grouping_type = ["None", "Low-Resolution", "By-Tube"]
        self.declareProperty("GroupDetectors", "None",
                             StringListValidator(grouping_type),
                             "Switch for grouping detectors")
        self.declareProperty(
            "NormalizeToFirst", False,
            "Normalize spectra to intensity of spectrum with lowest Q?")

        # Properties affected by the reflection selected
        titleReflection = "Reflection Selector"
        available_reflections = sorted(REFLECTIONS_DICT.keys())
        default_reflection = REFLECTIONS_DICT["silicon111"]
        self.declareProperty(
            "ReflectionType", default_reflection["name"],
            StringListValidator(available_reflections),
            "Analyzer. Documentation lists typical associated property values."
        )
        self.setPropertyGroup("ReflectionType", titleReflection)
        self.declareProperty(
            FloatArrayProperty("EnergyBins",
                               default_reflection["energy_bins"],
                               direction=Direction.Input),
            "Energy transfer binning scheme (in ueV)")
        self.setPropertyGroup("EnergyBins", titleReflection)
        self.declareProperty(
            FloatArrayProperty("MomentumTransferBins",
                               default_reflection["q_bins"],
                               direction=Direction.Input),
            "Momentum transfer binning scheme")
        self.setPropertyGroup("MomentumTransferBins", titleReflection)
        self.declareProperty(
            FileProperty(name="MaskFile",
                         defaultValue=pjoin(DEFAULT_MASK_GROUP_DIR,
                                            default_reflection["mask_file"]),
                         action=FileAction.OptionalLoad,
                         extensions=['.xml']),
            "See documentation for latest mask files.")
        self.setPropertyGroup("MaskFile", titleReflection)

        # Properties setting the division by vanadium
        titleDivideByVanadium = "Normalization by Vanadium"
        self.declareProperty("DivideByVanadium",
                             False,
                             direction=Direction.Input,
                             doc="Do we normalize by the vanadium intensity?")
        self.setPropertyGroup("DivideByVanadium", titleDivideByVanadium)
        ifDivideByVanadium = EnabledWhenProperty(
            "DivideByVanadium", PropertyCriterion.IsNotDefault)

        normalization_types = ["by Q slice", "by detector ID"]
        self.declareProperty("NormalizationType", "by Q slice",
                             StringListValidator(normalization_types),
                             "Select a Vanadium normalization")
        self.setPropertySettings("NormalizationType", ifDivideByVanadium)
        self.setPropertyGroup("NormalizationType", titleDivideByVanadium)

        self.declareProperty("NormRunNumbers", "", "Normalization run numbers")
        self.setPropertySettings("NormRunNumbers", ifDivideByVanadium)
        self.setPropertyGroup("NormRunNumbers", titleDivideByVanadium)
        arrVal = FloatArrayLengthValidator(2)
        self.declareProperty(
            FloatArrayProperty("NormWavelengthRange",
                               DEFAULT_RANGE,
                               arrVal,
                               direction=Direction.Input),
            "Wavelength range for normalization")
        self.setPropertySettings("NormWavelengthRange", ifDivideByVanadium)
        self.setPropertyGroup("NormWavelengthRange", titleDivideByVanadium)
Пример #17
0
 def test_construction_with_name_criterion_value_succeeds(self):
     p = EnabledWhenProperty("OtherProperty", PropertyCriterion.IsEqualTo,
                             "value")
Пример #18
0
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        PROPGROUP_SIMULATION_INSTRUMENT = 'Simulation Instrument Settings'
        greaterThanOneInt = IntBoundedValidator(lower=2)
        greaterThanTwoInt = IntBoundedValidator(lower=3)
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))

        # Properties.
        self.declareProperty(
            MatrixWorkspaceProperty(name=common.PROP_INPUT_WS,
                                    defaultValue='',
                                    validator=inputWorkspaceValidator,
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Input),
            doc='A workspace for which to simulate the self shielding.')
        self.declareProperty(
            MatrixWorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                    defaultValue='',
                                    direction=Direction.Output),
            doc='A workspace containing the self shielding correction factors.'
        )
        self.declareProperty(name=common.PROP_CLEANUP_MODE,
                             defaultValue=common.CLEANUP_ON,
                             validator=StringListValidator(
                                 [common.CLEANUP_ON, common.CLEANUP_OFF]),
                             direction=Direction.Input,
                             doc='What to do with intermediate workspaces.')
        self.declareProperty(
            name=common.PROP_SUBALG_LOGGING,
            defaultValue=common.SUBALG_LOGGING_OFF,
            validator=StringListValidator(
                [common.SUBALG_LOGGING_OFF, common.SUBALG_LOGGING_ON]),
            direction=Direction.Input,
            doc='Enable or disable subalgorithms to ' + 'print in the logs.')
        self.declareProperty(
            name=common.PROP_SIMULATION_INSTRUMENT,
            defaultValue=common.SIMULATION_INSTRUMEN_SPARSE,
            validator=StringListValidator([
                common.SIMULATION_INSTRUMEN_SPARSE,
                common.SIMULATION_INSTRUMENT_FULL
            ]),
            direction=Direction.Input,
            doc=
            'Select if the simulation should be performed on full or approximated instrument.'
        )
        self.setPropertyGroup(common.PROP_SIMULATION_INSTRUMENT,
                              PROPGROUP_SIMULATION_INSTRUMENT)
        self.declareProperty(
            name=common.PROP_SPARSE_INSTRUMENT_ROWS,
            defaultValue=5,
            validator=greaterThanTwoInt,
            direction=Direction.Input,
            doc='Number of detector rows in sparse simulation instrument.')
        self.setPropertyGroup(common.PROP_SPARSE_INSTRUMENT_ROWS,
                              PROPGROUP_SIMULATION_INSTRUMENT)
        self.setPropertySettings(
            common.PROP_SPARSE_INSTRUMENT_ROWS,
            EnabledWhenProperty(common.PROP_SIMULATION_INSTRUMENT,
                                PropertyCriterion.IsEqualTo,
                                common.SIMULATION_INSTRUMEN_SPARSE))
        self.declareProperty(
            name=common.PROP_SPARSE_INSTRUMENT_COLUMNS,
            defaultValue=20,
            validator=greaterThanOneInt,
            direction=Direction.Input,
            doc='Number of detector columns in sparse simulation instrument.')
        self.setPropertyGroup(common.PROP_SPARSE_INSTRUMENT_COLUMNS,
                              PROPGROUP_SIMULATION_INSTRUMENT)
        self.setPropertySettings(
            common.PROP_SPARSE_INSTRUMENT_COLUMNS,
            EnabledWhenProperty(common.PROP_SIMULATION_INSTRUMENT,
                                PropertyCriterion.IsEqualTo,
                                common.SIMULATION_INSTRUMEN_SPARSE))
        self.declareProperty(
            name=common.PROP_NUMBER_OF_SIMULATION_WAVELENGTHS,
            defaultValue=Property.EMPTY_INT,
            validator=greaterThanTwoInt,
            direction=Direction.Input,
            doc=
            'Number of wavelength points where the simulation is performed (default: all).'
        )
Пример #19
0
    def PyInit(self):

        self.declareProperty(MultipleFileProperty('Run', action=FileAction.OptionalLoad,
                                                  extensions=['nxs'], allow_empty=True),
                             doc='File path of run(s).')

        options = ['Absorber', 'Beam', 'Transmission', 'Container', 'Sample']

        self.declareProperty(name='ProcessAs',
                             defaultValue='Sample',
                             validator=StringListValidator(options),
                             doc='Choose the process type.')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace', '',
                                                     direction=Direction.Output),
                             doc='The output workspace based on the value of ProcessAs.')

        not_absorber = EnabledWhenProperty('ProcessAs', PropertyCriterion.IsNotEqualTo, 'Absorber')

        sample = EnabledWhenProperty('ProcessAs', PropertyCriterion.IsEqualTo, 'Sample')

        beam = EnabledWhenProperty('ProcessAs', PropertyCriterion.IsEqualTo, 'Beam')

        transmission = EnabledWhenProperty('ProcessAs', PropertyCriterion.IsEqualTo, 'Transmission')

        not_beam = EnabledWhenProperty('ProcessAs', PropertyCriterion.IsNotEqualTo, 'Beam')

        container = EnabledWhenProperty('ProcessAs', PropertyCriterion.IsEqualTo, 'Container')

        self.declareProperty(name='NormaliseBy',
                             defaultValue='Timer',
                             validator=StringListValidator(['None', 'Timer', 'Monitor']),
                             doc='Choose the normalisation type.')

        self.declareProperty('BeamRadius', 0.05, validator=FloatBoundedValidator(lower=0.),
                             doc='Beam radius [m]; used for beam center finding, transmission and flux calculations.')

        self.setPropertySettings('BeamRadius',
                                 EnabledWhenProperty(beam, transmission, LogicOperator.Or))

        self.declareProperty('BeamFinderMethod', 'DirectBeam', StringListValidator(['DirectBeam', 'ScatteredBeam']),
                             doc='Choose between direct beam or scattered beam method for beam center finding.')

        self.setPropertySettings('BeamFinderMethod', beam)

        self.declareProperty('SampleThickness', 0.1, validator=FloatBoundedValidator(lower=0.), doc='Sample thickness [cm]')

        self.setPropertySettings('SampleThickness', sample)

        self.declareProperty(MatrixWorkspaceProperty('AbsorberInputWorkspace', '',
                                                     direction=Direction.Input,
                                                     optional=PropertyMode.Optional),
                             doc='The name of the absorber workspace.')

        self.setPropertySettings('AbsorberInputWorkspace', not_absorber)

        self.declareProperty(MatrixWorkspaceProperty('BeamInputWorkspace', '',
                                                     direction=Direction.Input,
                                                     optional=PropertyMode.Optional),
                             doc='The name of the empty beam input workspace.')

        self.setPropertySettings('BeamInputWorkspace',
                                 EnabledWhenProperty(not_absorber, not_beam, LogicOperator.And))

        self.declareProperty(MatrixWorkspaceProperty('TransmissionInputWorkspace', '',
                                                     direction=Direction.Input,
                                                     optional=PropertyMode.Optional),
                             doc='The name of the transmission input workspace.')

        self.setPropertySettings('TransmissionInputWorkspace',
                                 EnabledWhenProperty(container, sample, LogicOperator.Or))

        self.declareProperty(MatrixWorkspaceProperty('ContainerInputWorkspace', '',
                                                     direction=Direction.Input,
                                                     optional=PropertyMode.Optional),
                             doc='The name of the container workspace.')

        self.setPropertySettings('ContainerInputWorkspace', sample)

        self.declareProperty(MatrixWorkspaceProperty('ReferenceInputWorkspace', '',
                                                     direction=Direction.Input,
                                                     optional=PropertyMode.Optional),
                             doc='The name of the reference workspace.')

        self.setPropertySettings('ReferenceInputWorkspace', sample)

        self.declareProperty(MatrixWorkspaceProperty('SensitivityInputWorkspace', '',
                                                     direction=Direction.Input,
                                                     optional=PropertyMode.Optional),
                             doc='The name of the input sensitivity workspace.')

        self.setPropertySettings('SensitivityInputWorkspace',
                                 EnabledWhenProperty(sample,
                                                     EnabledWhenProperty('ReferenceInputWorkspace',
                                                                         PropertyCriterion.IsEqualTo, ''),
                                                     LogicOperator.And))

        self.declareProperty(MatrixWorkspaceProperty('SensitivityOutputWorkspace', '',
                                                     direction=Direction.Output,
                                                     optional=PropertyMode.Optional),
                             doc='The name of the output sensitivity workspace.')

        self.setPropertySettings('SensitivityOutputWorkspace', sample)

        self.declareProperty(MatrixWorkspaceProperty('MaskedInputWorkspace', '',
                                                     direction=Direction.Input,
                                                     optional=PropertyMode.Optional),
                             doc='Workspace to copy the mask from; for example, the beam stop')

        self.setPropertySettings('MaskedInputWorkspace', sample)

        self.declareProperty(MatrixWorkspaceProperty('FluxInputWorkspace', '',
                                                     direction=Direction.Output,
                                                     optional=PropertyMode.Optional),
                             doc='The name of the input direct beam flux workspace.')

        self.setPropertySettings('FluxInputWorkspace', sample)

        self.declareProperty(MatrixWorkspaceProperty('FluxOutputWorkspace', '',
                                                     direction=Direction.Output,
                                                     optional=PropertyMode.Optional),
                             doc='The name of the output direct beam flux workspace.')

        self.setPropertySettings('FluxOutputWorkspace', beam)

        self.declareProperty('CacheSolidAngle', False, doc='Whether or not to cache the solid angle workspace.')

        self.declareProperty('WaterCrossSection', 1., doc='Provide water cross-section; '
                                                          'used only if the absolute scale is done by dividing to water.')

        self.declareProperty(MatrixWorkspaceProperty('DefaultMaskedInputWorkspace', '',
                                                     direction=Direction.Input,
                                                     optional=PropertyMode.Optional),
                             doc='Workspace to copy the mask from; for example, the bad detector edges.')

        self.setPropertySettings('DefaultMaskedInputWorkspace', sample)

        self.declareProperty('ThetaDependent', True,
                             doc='Whether or not to use 2theta dependent transmission correction')

        self.declareProperty(MatrixWorkspaceProperty('InputWorkspace', '', direction=Direction.Input,
                                                     optional=PropertyMode.Optional),
                             doc='Input workspace containing already loaded raw data, used for parameter scans.')
    def PyInit(self):
        self.declareProperty(
            WorkspaceProperty('InputWorkspace',
                              '',
                              direction=Direction.Input,
                              validator=WorkspaceUnitValidator('TOF')),
            doc=
            'Powder event data, ideally from a highly symmetric space group',
        )
        self.declareProperty(name='OutputWorkspacesPrefix',
                             defaultValue='pdcal_',
                             direction=Direction.Input,
                             doc="Prefix to be added to output workspaces")

        # PDCalibration properties exposed, grouped
        property_names = ['TofBinning', 'PeakFunction', 'PeakPositions']
        self.copyProperties('PDCalibration', property_names)
        [
            self.setPropertyGroup(name, 'PDCalibration')
            for name in property_names
        ]

        # "Source Position" properties
        self.declareProperty(name='FixSource',
                             defaultValue=True,
                             doc="Fix source's distance from the sample")
        self.declareProperty(
            name='SourceToSampleDistance',
            defaultValue=20.004,
            doc=
            'Set this value for a fixed distance from source to sample, in meters'
        )
        self.setPropertySettings(
            'SourceToSampleDistance',
            EnabledWhenProperty("FixSource", PropertyCriterion.IsDefault))
        self.declareProperty(name='AdjustSource',
                             defaultValue=False,
                             doc='Adjust Z-coordinate of the source')
        self.declareProperty(
            name='SourceMaxTranslation',
            defaultValue=0.1,
            doc=
            'Maximum adjustment of source position along the beam (Z) axis (m)'
        )
        self.setPropertySettings(
            "SourceMaxTranslation",
            EnabledWhenProperty("AdjustSource",
                                PropertyCriterion.IsNotDefault))
        property_names = [
            'FixSource', 'SourceToSampleDistance', 'AdjustSource',
            'SourceMaxTranslation'
        ]
        [
            self.setPropertyGroup(name, 'Source Calibration')
            for name in property_names
        ]

        # AlignComponents properties
        self.declareProperty(name='FixY',
                             defaultValue=True,
                             doc="Vertical bank position is left unchanged")
        self.declareProperty(StringArrayProperty('ComponentList',
                                                 values=self._banks,
                                                 direction=Direction.Input),
                             doc='Comma separated list on banks to refine')
        self.declareProperty(
            name='ComponentMaxTranslation',
            defaultValue=0.02,
            doc=
            'Maximum translation of each component along either of the X, Y, Z axes (m)'
        )
        self.declareProperty(
            name='FixYaw',
            defaultValue=True,
            doc="Prevent rotations around the axis normal to the bank")
        self.declareProperty(
            name='ComponentMaxRotation',
            defaultValue=3.0,
            doc=
            'Maximum rotation of each component along either of the X, Y, Z axes (deg)'
        )
        property_names = [
            'FixY', 'ComponentList', 'ComponentMaxTranslation', 'FixYaw',
            'ComponentMaxRotation'
        ]
        [
            self.setPropertyGroup(name, 'Banks Calibration')
            for name in property_names
        ]

        #
        # Minimization Properties
        self.declareProperty(
            name='Minimizer',
            defaultValue='L-BFGS-B',
            direction=Direction.Input,
            validator=StringListValidator(
                ['L-BFGS-B', 'differential_evolution']),
            doc=
            'Minimizer to use, differential_evolution is more accurate and slower.'
        )
        self.declareProperty(
            name='MaxIterations',
            defaultValue=20,
            direction=Direction.Input,
            doc=
            'Maximum number of iterations for minimizer differential_evolution'
        )

        properties = ['Minimizer', 'MaxIterations']
        [self.setPropertyGroup(name, "Minimization") for name in properties]
Пример #21
0
    def PyInit(self):
        self.declareProperty(MatrixWorkspaceProperty(
            'InputWorkspace', '', direction=Direction.Input),
                             doc='The input workspace.')

        self.declareProperty(MatrixWorkspaceProperty(
            'OutputWorkspace', '', direction=Direction.Output),
                             doc='The output workspace.')

        self.declareProperty(name='OutputType',
                             defaultValue='I(Q)',
                             validator=StringListValidator(
                                 ['I(Q)', 'I(Qx,Qy)', 'I(Phi,Q)']),
                             doc='Choose the output type.')

        self.declareProperty(name='CalculateResolution',
                             defaultValue='None',
                             validator=StringListValidator(
                                 ['MildnerCarpenter', 'DirectBeam', 'None']),
                             doc='Choose to calculate the Q resolution.')

        output_iq = EnabledWhenProperty('OutputType',
                                        PropertyCriterion.IsEqualTo, 'I(Q)')
        output_iphiq = EnabledWhenProperty('OutputType',
                                           PropertyCriterion.IsEqualTo,
                                           'I(Phi,Q)')
        output_iqxy = EnabledWhenProperty('OutputType',
                                          PropertyCriterion.IsEqualTo,
                                          'I(Qx,Qy)')

        self.declareProperty(
            name='DefaultQBinning',
            defaultValue='PixelSizeBased',
            validator=StringListValidator(
                ['PixelSizeBased', 'ResolutionBased']),
            doc='Choose how to calculate the default Q binning.')
        self.setPropertySettings(
            'DefaultQBinning',
            EnabledWhenProperty(output_iq, output_iphiq, LogicOperator.Or))

        self.declareProperty(
            name='BinningFactor',
            defaultValue=1.,
            validator=FloatBoundedValidator(lower=0.),
            doc=
            'Specify a multiplicative factor for default Q binning (pixel or resolution based).'
        )
        self.setPropertySettings(
            'BinningFactor',
            EnabledWhenProperty(output_iq, output_iphiq, LogicOperator.Or))

        self.declareProperty(FloatArrayProperty('OutputBinning'),
                             doc='The manual Q binning of the output')
        self.setPropertySettings(
            'OutputBinning',
            EnabledWhenProperty(output_iq, output_iphiq, LogicOperator.Or))

        self.declareProperty('NPixelDivision', 1, IntBoundedValidator(lower=1),
                             'Number of subpixels to split the pixel (NxN)')
        self.setPropertySettings(
            'NPixelDivision',
            EnabledWhenProperty(output_iq, output_iphiq, LogicOperator.Or))

        iq_without_shapes = EnabledWhenProperty(
            EnabledWhenProperty("ShapeTable", PropertyCriterion.IsDefault),
            EnabledWhenProperty(output_iq, output_iphiq, LogicOperator.Or),
            LogicOperator.And)

        self.declareProperty(name='NumberOfWedges',
                             defaultValue=0,
                             validator=IntBoundedValidator(lower=0),
                             doc='Number of wedges to integrate separately.')
        self.setPropertySettings('NumberOfWedges', iq_without_shapes)

        iq_with_wedges = EnabledWhenProperty(
            output_iq,
            EnabledWhenProperty('NumberOfWedges',
                                PropertyCriterion.IsNotDefault),
            LogicOperator.And)
        iq_with_wedges_or_shapes = EnabledWhenProperty(
            iq_with_wedges,
            EnabledWhenProperty("ShapeTable", PropertyCriterion.IsNotDefault),
            LogicOperator.Or)
        iq_with_wedges_but_no_shapes = EnabledWhenProperty(
            iq_with_wedges,
            EnabledWhenProperty("ShapeTable", PropertyCriterion.IsDefault),
            LogicOperator.And)

        self.declareProperty(
            WorkspaceGroupProperty('WedgeWorkspace',
                                   '',
                                   direction=Direction.Output,
                                   optional=PropertyMode.Optional),
            doc='WorkspaceGroup containing I(Q) for each azimuthal wedge.')
        self.setPropertySettings('WedgeWorkspace', iq_with_wedges_or_shapes)

        self.declareProperty(name='WedgeAngle',
                             defaultValue=30.,
                             validator=FloatBoundedValidator(lower=0.),
                             doc='Wedge opening angle [degrees].')
        self.setPropertySettings('WedgeAngle', iq_with_wedges_but_no_shapes)

        self.declareProperty(name='WedgeOffset',
                             defaultValue=0.,
                             validator=FloatBoundedValidator(lower=0.),
                             doc='Wedge offset angle from x+ axis.')
        self.setPropertySettings('WedgeOffset', iq_with_wedges_but_no_shapes)

        self.declareProperty(name='AsymmetricWedges',
                             defaultValue=False,
                             doc='Whether to have asymmetric wedges.')
        self.setPropertySettings('AsymmetricWedges', iq_with_wedges_or_shapes)

        self.setPropertyGroup('DefaultQBinning', 'I(Q) Options')
        self.setPropertyGroup('BinningFactor', 'I(Q) Options')
        self.setPropertyGroup('OutputBinning', 'I(Q) Options')
        self.setPropertyGroup('NPixelDivision', 'I(Q) Options')
        self.setPropertyGroup('NumberOfWedges', 'I(Q) Options')
        self.setPropertyGroup('WedgeWorkspace', 'I(Q) Options')
        self.setPropertyGroup('WedgeAngle', 'I(Q) Options')
        self.setPropertyGroup('WedgeOffset', 'I(Q) Options')
        self.setPropertyGroup('AsymmetricWedges', 'I(Q) Options')

        self.declareProperty(name='MaxQxy',
                             defaultValue=-1.0,
                             validator=FloatBoundedValidator(lower=-1.0),
                             doc='Maximum of absolute Qx and Qy.')
        self.setPropertySettings('MaxQxy', output_iqxy)

        self.declareProperty(name='DeltaQ',
                             defaultValue=-1.0,
                             validator=FloatBoundedValidator(lower=-1.0),
                             doc='The dimension of a Qx-Qy cell.')
        self.setPropertySettings('DeltaQ', output_iqxy)

        self.declareProperty(
            name='IQxQyLogBinning',
            defaultValue=False,
            doc='I(Qx, Qy) log binning when binning is not specified.')
        self.setPropertySettings('IQxQyLogBinning', output_iqxy)

        self.setPropertyGroup('MaxQxy', 'I(Qx,Qy) Options')
        self.setPropertyGroup('DeltaQ', 'I(Qx,Qy) Options')
        self.setPropertyGroup('IQxQyLogBinning', 'I(Qx,Qy) Options')
        self.declareProperty(
            WorkspaceGroupProperty('PanelOutputWorkspaces',
                                   '',
                                   direction=Direction.Output,
                                   optional=PropertyMode.Optional),
            doc='The name of the output workspace group for detector panels.')
        self.declareProperty(
            ITableWorkspaceProperty('ShapeTable',
                                    '',
                                    direction=Direction.Input,
                                    optional=PropertyMode.Optional),
            doc=
            'The name of the table workspace containing drawn shapes on which to integrate. '
            'If provided, NumberOfWedges, WedgeOffset and WedgeAngle arguments are ignored. '
        )

        self.setPropertyGroup('PanelOutputWorkspaces', 'I(Q) Options')
        self.setPropertyGroup('ShapeTable', 'I(Q) Options')

        lambda_range_validator = CompositeValidator()
        lambda_range_validator.add(FloatArrayOrderedPairsValidator())
        lambda_range_validator.add(FloatArrayLengthValidator(2))
        self.declareProperty(
            FloatArrayProperty('WavelengthRange', [1., 10.],
                               validator=lambda_range_validator),
            doc=
            'Wavelength range [Angstrom] to be used in integration (TOF only).'
        )
    def PyInit(self):
        # basic sample options

        self.declareProperty(MatrixWorkspaceProperty(
            'InputWorkspace', '', direction=Direction.Input),
                             doc='Input workspace')

        self.declareProperty(
            name='MaterialAlreadyDefined',
            defaultValue=False,
            doc='Select this option if the material has already been defined')

        material_defined_prop = EnabledWhenProperty(
            'MaterialAlreadyDefined', PropertyCriterion.IsDefault)

        self.declareProperty(name='ChemicalFormula',
                             defaultValue='',
                             doc='Chemical formula of sample')
        self.setPropertySettings('ChemicalFormula', material_defined_prop)

        self.declareProperty(name='DensityType',
                             defaultValue='Mass Density',
                             validator=StringListValidator(
                                 ['Mass Density', 'Number Density']),
                             doc='Use of Mass density or Number density')
        self.setPropertySettings('DensityType', material_defined_prop)

        self.declareProperty(
            name='Density',
            defaultValue=0.1,
            doc='Mass density (g/cm^3) or Number density (atoms/Angstrom^3)')
        self.setPropertySettings('Density', material_defined_prop)

        # -------------------------------------------------------------------------------------------

        # Monte Carlo options
        self.declareProperty(name='NumberOfWavelengthPoints',
                             defaultValue=10,
                             validator=IntBoundedValidator(1),
                             doc='Number of wavelengths for calculation')

        self.declareProperty(name='EventsPerPoint',
                             defaultValue=1000,
                             validator=IntBoundedValidator(0),
                             doc='Number of neutron events')

        self.declareProperty(name='Interpolation',
                             defaultValue='Linear',
                             validator=StringListValidator(
                                 ['Linear', 'CSpline']),
                             doc='Type of interpolation')

        # -------------------------------------------------------------------------------------------

        # Beam size
        self.declareProperty(name='BeamHeight',
                             defaultValue=1.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Height of the beam (cm)')

        self.declareProperty(name='BeamWidth',
                             defaultValue=1.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Width of the beam (cm)')

        # -------------------------------------------------------------------------------------------

        # set up shape options

        self.declareProperty(
            name='Shape',
            defaultValue='FlatPlate',
            validator=StringListValidator(['FlatPlate', 'Cylinder',
                                           'Annulus']),
            doc=
            'Geometry of sample environment. Options are: FlatPlate, Cylinder, Annulus'
        )

        flat_plate_condition = VisibleWhenProperty('Shape',
                                                   PropertyCriterion.IsEqualTo,
                                                   'FlatPlate')
        cylinder_condition = VisibleWhenProperty('Shape',
                                                 PropertyCriterion.IsEqualTo,
                                                 'Cylinder')
        annulus_condition = VisibleWhenProperty('Shape',
                                                PropertyCriterion.IsEqualTo,
                                                'Annulus')

        # height is common to all options

        self.declareProperty(name='Height',
                             defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Height of the sample environment (cm)')

        # flat plate options

        self.declareProperty(
            name='Width',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc='Width of the FlatPlate sample environment (cm)')
        self.setPropertySettings('Width', flat_plate_condition)

        self.declareProperty(
            name='Thickness',
            defaultValue=0.0,
            validator=FloatBoundedValidator(),
            doc='Thickness of the FlatPlate sample environment (cm)')
        self.setPropertySettings('Thickness', flat_plate_condition)

        self.declareProperty(name='Center',
                             defaultValue=0.0,
                             doc='Center of the FlatPlate sample environment')
        self.setPropertySettings('Center', flat_plate_condition)

        self.declareProperty(
            name='Angle',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc=
            'Angle of the FlatPlate sample environment with respect to the beam (degrees)'
        )
        self.setPropertySettings('Angle', flat_plate_condition)

        # cylinder options

        self.declareProperty(
            name='Radius',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc='Radius of the Cylinder sample environment (cm)')
        self.setPropertySettings('Radius', cylinder_condition)

        # annulus options

        self.declareProperty(
            name='OuterRadius',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc='Outer radius of the Annulus sample environment (cm)')
        self.setPropertySettings('OuterRadius', annulus_condition)

        self.declareProperty(
            name='InnerRadius',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc='Inner radius of the Annulus sample environment (cm)')
        self.setPropertySettings('InnerRadius', annulus_condition)

        # -------------------------------------------------------------------------------------------

        # Output options
        self.declareProperty(MatrixWorkspaceProperty(
            'OutputWorkspace', '', direction=Direction.Output),
                             doc='The output corrected workspace.')
Пример #23
0
    def PyInit(self):
        self.declareProperty(MatrixWorkspaceProperty('InputWorkspace', '', direction=Direction.Input,
                             validator=WorkspaceUnitValidator('Wavelength')),
                             doc='The input workspace.')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace', '', direction=Direction.Output),
                             doc='The output workspace.')

        self.declareProperty(name='OutputType', defaultValue='I(Q)',
                             validator=StringListValidator(['I(Q)', 'I(Qx,Qy)', 'I(Phi,Q)']),
                             doc='Choose the output type.')

        self.declareProperty(name='CalculateResolution',
                             defaultValue='MildnerCarpenter',
                             validator=StringListValidator(['MildnerCarpenter', 'None']),
                             doc='Choose to calculate the Q resolution.')

        output_iq = EnabledWhenProperty('OutputType', PropertyCriterion.IsEqualTo, 'I(Q)')
        output_iphiq = EnabledWhenProperty('OutputType', PropertyCriterion.IsEqualTo, 'I(Phi,Q)')
        output_iqxy = EnabledWhenProperty('OutputType', PropertyCriterion.IsEqualTo, 'I(Qx,Qy)')

        self.declareProperty(name='DefaultQBinning', defaultValue='PixelSizeBased',
                             validator=StringListValidator(['PixelSizeBased', 'ResolutionBased']),
                             doc='Choose how to calculate the default Q binning.')
        self.setPropertySettings('DefaultQBinning', EnabledWhenProperty(output_iq, output_iphiq, LogicOperator.Or))

        self.declareProperty(name='BinningFactor', defaultValue=1.,
                             validator=FloatBoundedValidator(lower=0.),
                             doc='Specify a multiplicative factor for default Q binning (pixel or resolution based).')
        self.setPropertySettings('BinningFactor', EnabledWhenProperty(output_iq, output_iphiq, LogicOperator.Or))

        self.declareProperty(FloatArrayProperty('OutputBinning'), doc='The manual Q binning of the output')
        self.setPropertySettings('OutputBinning', EnabledWhenProperty(output_iq, output_iphiq, LogicOperator.Or))

        self.declareProperty('NPixelDivision', 1, IntBoundedValidator(lower=1), 'Number of subpixels to split the pixel (NxN)')
        self.setPropertySettings('NPixelDivision', EnabledWhenProperty(output_iq, output_iphiq, LogicOperator.Or))

        self.declareProperty(name='NumberOfWedges', defaultValue=0, validator=IntBoundedValidator(lower=0),
                             doc='Number of wedges to integrate separately.')
        self.setPropertySettings('NumberOfWedges', EnabledWhenProperty(output_iq, output_iphiq, LogicOperator.Or))

        iq_with_wedges = EnabledWhenProperty(output_iq,
                                             EnabledWhenProperty('NumberOfWedges',
                                                                 PropertyCriterion.IsNotDefault), LogicOperator.And)

        self.declareProperty(WorkspaceGroupProperty('WedgeWorkspace', '', direction=Direction.Output, optional=PropertyMode.Optional),
                             doc='WorkspaceGroup containing I(Q) for each azimuthal wedge.')
        self.setPropertySettings('WedgeWorkspace', iq_with_wedges)

        self.declareProperty(name='WedgeAngle', defaultValue=30., validator=FloatBoundedValidator(lower=0.),
                             doc='Wedge opening angle [degrees].')
        self.setPropertySettings('WedgeAngle', iq_with_wedges)

        self.declareProperty(name='WedgeOffset', defaultValue=0., validator=FloatBoundedValidator(lower=0.),
                             doc='Wedge offset angle from x+ axis.')
        self.setPropertySettings('WedgeOffset', iq_with_wedges)

        self.declareProperty(name='AsymmetricWedges', defaultValue=False, doc='Whether to have asymmetric wedges.')
        self.setPropertySettings('AsymmetricWedges', iq_with_wedges)

        self.setPropertyGroup('DefaultQBinning', 'I(Q) Options')
        self.setPropertyGroup('BinningFactor', 'I(Q) Options')
        self.setPropertyGroup('OutputBinning', 'I(Q) Options')
        self.setPropertyGroup('NPixelDivision', 'I(Q) Options')
        self.setPropertyGroup('NumberOfWedges', 'I(Q) Options')
        self.setPropertyGroup('WedgeWorkspace', 'I(Q) Options')
        self.setPropertyGroup('WedgeAngle', 'I(Q) Options')
        self.setPropertyGroup('WedgeOffset', 'I(Q) Options')
        self.setPropertyGroup('AsymmetricWedges', 'I(Q) Options')

        self.declareProperty(name='MaxQxy', defaultValue=0., validator=FloatBoundedValidator(lower=0.),
                             doc='Maximum of absolute Qx and Qy.')
        self.setPropertySettings('MaxQxy', output_iqxy)

        self.declareProperty(name='DeltaQ', defaultValue=0., validator=FloatBoundedValidator(lower=0),
                             doc='The dimension of a Qx-Qy cell.')
        self.setPropertySettings('DeltaQ', output_iqxy)

        self.declareProperty(name='IQxQyLogBinning', defaultValue=False,
                             doc='I(Qx, Qy) log binning when binning is not specified.')
        self.setPropertySettings('IQxQyLogBinning', output_iqxy)

        self.setPropertyGroup('MaxQxy', 'I(Qx,Qy) Options')
        self.setPropertyGroup('DeltaQ', 'I(Qx,Qy) Options')
        self.setPropertyGroup('IQxQyLogBinning', 'I(Qx,Qy) Options')

        self.declareProperty(name='BinMaskingCriteria', defaultValue='',
                             doc='Criteria to mask bins, used for TOF mode,'
                                 ' for example to discard high and low lambda ranges;'
                                 'see MaskBinsIf algorithm for details.')
Пример #24
0
    def PyInit(self):
        self.declareProperty(ITableWorkspaceProperty(
            "CalibrationTable",
            "",
            optional=PropertyMode.Mandatory,
            direction=Direction.Input),
                             doc="Calibration table, currently only uses difc")

        self.declareProperty(MatrixWorkspaceProperty(
            "MaskWorkspace",
            "",
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc="Mask workspace")

        self.declareProperty(FileProperty(name="InstrumentFilename",
                                          defaultValue="",
                                          action=FileAction.OptionalLoad,
                                          extensions=[".xml"]),
                             doc="Instrument filename")

        self.declareProperty(
            WorkspaceProperty("Workspace",
                              "",
                              validator=InstrumentValidator(),
                              optional=PropertyMode.Optional,
                              direction=Direction.Input),
            doc="Workspace containing the instrument to be calibrated.")

        # Source
        self.declareProperty(
            name="FitSourcePosition",
            defaultValue=False,
            doc=
            "Fit the source position, changes L1 (source to sample) distance."
            "Uses entire instrument. Occurs before Components are Aligned.")

        # Sample
        self.declareProperty(
            name="FitSamplePosition",
            defaultValue=False,
            doc=
            "Fit the sample position, changes L1 (source to sample) and L2 (sample to detector) distance."
            "Uses entire instrument. Occurs before Components are Aligned.")

        # List of components
        self.declareProperty(
            StringArrayProperty("ComponentList", direction=Direction.Input),
            doc="Comma separated list on instrument components to refine.")

        # X position
        self.declareProperty(name="Xposition",
                             defaultValue=False,
                             doc="Refine Xposition")
        condition = EnabledWhenProperty("Xposition",
                                        PropertyCriterion.IsNotDefault)
        self.declareProperty(name="MinXposition",
                             defaultValue=-0.1,
                             validator=FloatBoundedValidator(-10.0, 10.0),
                             doc="Minimum relative X bound (m)")
        self.setPropertySettings("MinXposition", condition)
        self.declareProperty(name="MaxXposition",
                             defaultValue=0.1,
                             validator=FloatBoundedValidator(-10.0, 10.0),
                             doc="Maximum relative X bound (m)")
        self.setPropertySettings("MaxXposition", condition)

        # Y position
        self.declareProperty(name="Yposition",
                             defaultValue=False,
                             doc="Refine Yposition")
        condition = EnabledWhenProperty("Yposition",
                                        PropertyCriterion.IsNotDefault)
        self.declareProperty(name="MinYposition",
                             defaultValue=-0.1,
                             validator=FloatBoundedValidator(-10.0, 10.0),
                             doc="Minimum relative Y bound (m)")
        self.setPropertySettings("MinYposition", condition)
        self.declareProperty(name="MaxYposition",
                             defaultValue=0.1,
                             validator=FloatBoundedValidator(-10.0, 10.0),
                             doc="Maximum relative Y bound (m)")
        self.setPropertySettings("MaxYposition", condition)

        # Z position
        self.declareProperty(name="Zposition",
                             defaultValue=False,
                             doc="Refine Zposition")
        condition = EnabledWhenProperty("Zposition",
                                        PropertyCriterion.IsNotDefault)
        self.declareProperty(name="MinZposition",
                             defaultValue=-0.1,
                             validator=FloatBoundedValidator(-10.0, 10.0),
                             doc="Minimum relative Z bound (m)")
        self.setPropertySettings("MinZposition", condition)
        self.declareProperty(name="MaxZposition",
                             defaultValue=0.1,
                             validator=FloatBoundedValidator(-10.0, 10.0),
                             doc="Maximum relative Z bound (m)")
        self.setPropertySettings("MaxZposition", condition)

        # euler angles convention
        eulerConventions = [
            "ZXZ", "XYX", "YZY", "ZYZ", "XZX", "YXY", "XYZ", "YZX", "ZXY",
            "XZY", "ZYX", "YXZ"
        ]
        self.declareProperty(
            name="EulerConvention",
            defaultValue="YZX",
            validator=StringListValidator(eulerConventions),
            doc=
            "Euler angles convention used when calculating and displaying angles,"
            "eg XYZ corresponding to alpha beta gamma.")

        # alpha rotation
        self.declareProperty(name="AlphaRotation",
                             defaultValue=False,
                             doc="Refine rotation around first axis, alpha")
        condition = EnabledWhenProperty("AlphaRotation",
                                        PropertyCriterion.IsNotDefault)
        self.declareProperty(name="MinAlphaRotation",
                             defaultValue=-10.0,
                             validator=FloatBoundedValidator(-90, 90),
                             doc="Minimum relative alpha rotation (deg)")
        self.setPropertySettings("MinAlphaRotation", condition)
        self.declareProperty(name="MaxAlphaRotation",
                             defaultValue=10.0,
                             validator=FloatBoundedValidator(-90, 90),
                             doc="Maximum relative alpha rotation (deg)")
        self.setPropertySettings("MaxAlphaRotation", condition)

        # beta rotation
        self.declareProperty(name="BetaRotation",
                             defaultValue=False,
                             doc="Refine rotation around seconds axis, beta")
        condition = EnabledWhenProperty("BetaRotation",
                                        PropertyCriterion.IsNotDefault)
        self.declareProperty(name="MinBetaRotation",
                             defaultValue=-10.0,
                             validator=FloatBoundedValidator(-90, 90),
                             doc="Minimum relative beta rotation (deg)")
        self.setPropertySettings("MinBetaRotation", condition)
        self.declareProperty(name="MaxBetaRotation",
                             defaultValue=10.0,
                             validator=FloatBoundedValidator(-90, 90),
                             doc="Maximum relative beta rotation (deg)")
        self.setPropertySettings("MaxBetaRotation", condition)

        # gamma rotation
        self.declareProperty(name="GammaRotation",
                             defaultValue=False,
                             doc="Refine rotation around third axis, gamma")
        condition = EnabledWhenProperty("GammaRotation",
                                        PropertyCriterion.IsNotDefault)
        self.declareProperty(name="MinGammaRotation",
                             defaultValue=-10.0,
                             validator=FloatBoundedValidator(-90, 90),
                             doc="Minimum relative gamma rotation (deg)")
        self.setPropertySettings("MinGammaRotation", condition)
        self.declareProperty(name="MaxGammaRotation",
                             defaultValue=10.0,
                             validator=FloatBoundedValidator(-90, 90),
                             doc="Maximum relative gamma rotation (deg)")
        self.setPropertySettings("MaxGammaRotation", condition)

        # Translation
        self.setPropertyGroup("Xposition", "Translation")
        self.setPropertyGroup("MinXposition", "Translation")
        self.setPropertyGroup("MaxXposition", "Translation")
        self.setPropertyGroup("Yposition", "Translation")
        self.setPropertyGroup("MinYposition", "Translation")
        self.setPropertyGroup("MaxYposition", "Translation")
        self.setPropertyGroup("Zposition", "Translation")
        self.setPropertyGroup("MinZposition", "Translation")
        self.setPropertyGroup("MaxZposition", "Translation")

        # Rotation
        self.setPropertyGroup("EulerConvention", "Rotation")
        self.setPropertyGroup("AlphaRotation", "Rotation")
        self.setPropertyGroup("MinAlphaRotation", "Rotation")
        self.setPropertyGroup("MaxAlphaRotation", "Rotation")
        self.setPropertyGroup("BetaRotation", "Rotation")
        self.setPropertyGroup("MinBetaRotation", "Rotation")
        self.setPropertyGroup("MaxBetaRotation", "Rotation")
        self.setPropertyGroup("GammaRotation", "Rotation")
        self.setPropertyGroup("MinGammaRotation", "Rotation")
        self.setPropertyGroup("MaxGammaRotation", "Rotation")
Пример #25
0
    def PyInit(self):
        self.declareProperty(
            IMDHistoWorkspaceProperty("InputWorkspace",
                                      "",
                                      optional=PropertyMode.Mandatory,
                                      direction=Direction.Input),
            "Input Workspace with HKL dimensions centered on zero.")
        self.declareProperty(
            WorkspaceProperty("IntermediateWorkspace",
                              "",
                              optional=PropertyMode.Optional,
                              direction=Direction.Output),
            "The resulting workspace after reflection removal and filters applied. What is the input of the FFT."
        )
        self.declareProperty(
            WorkspaceProperty("OutputWorkspace",
                              "",
                              optional=PropertyMode.Mandatory,
                              direction=Direction.Output), "Output Workspace")

        self.declareProperty("RemoveReflections", True,
                             "Remove HKL reflections")
        condition = EnabledWhenProperty("RemoveReflections",
                                        PropertyCriterion.IsDefault)
        self.declareProperty("Shape",
                             "sphere",
                             doc="Shape to cut out reflections",
                             validator=StringListValidator(['sphere', 'cube']))
        self.setPropertySettings("Shape", condition)
        val_min_zero = FloatArrayBoundedValidator()
        val_min_zero.setLower(0.)
        self.declareProperty(
            FloatArrayProperty("Size", [0.2], validator=val_min_zero),
            "Width of cube/diameter of sphere used to remove reflections, in (HKL) (one or three values)"
        )
        self.setPropertySettings("Size", condition)
        self.declareProperty(
            "SpaceGroup",
            "",
            doc=
            "Space group for reflection removal, either full name or number. If empty all HKL's will be removed."
        )
        self.setPropertySettings("SpaceGroup", condition)

        self.declareProperty(
            "CropSphere", False,
            "Limit min/max q values. Can help with edge effects.")
        condition = EnabledWhenProperty("CropSphere",
                                        PropertyCriterion.IsNotDefault)
        self.declareProperty(
            FloatArrayProperty("SphereMin", [Property.EMPTY_DBL],
                               validator=val_min_zero),
            "HKL values below which will be removed (one or three values)")
        self.setPropertySettings("SphereMin", condition)
        self.declareProperty(
            FloatArrayProperty("SphereMax", [Property.EMPTY_DBL],
                               validator=val_min_zero),
            "HKL values above which will be removed (one or three values)")
        self.setPropertySettings("SphereMax", condition)
        self.declareProperty("FillValue", Property.EMPTY_DBL,
                             "Value to replace with outside sphere")
        self.setPropertySettings("FillValue", condition)

        self.declareProperty(
            "Convolution", True,
            "Apply convolution to fill in removed reflections")
        condition = EnabledWhenProperty("Convolution",
                                        PropertyCriterion.IsDefault)
        self.declareProperty("ConvolutionWidth",
                             2.0,
                             validator=FloatBoundedValidator(0.),
                             doc="Width of gaussian convolution in pixels")
        self.setPropertySettings("ConvolutionWidth", condition)
        self.declareProperty("Deconvolution", False,
                             "Apply deconvolution after fourier transform")
        self.setPropertySettings("Deconvolution", condition)

        # Reflections
        self.setPropertyGroup("RemoveReflections", "Reflection Removal")
        self.setPropertyGroup("Shape", "Reflection Removal")
        self.setPropertyGroup("Size", "Reflection Removal")
        self.setPropertyGroup("SpaceGroup", "Reflection Removal")

        # Sphere
        self.setPropertyGroup("CropSphere", "Cropping to a sphere")
        self.setPropertyGroup("SphereMin", "Cropping to a sphere")
        self.setPropertyGroup("SphereMax", "Cropping to a sphere")
        self.setPropertyGroup("FillValue", "Cropping to a sphere")

        # Convolution
        self.setPropertyGroup("Convolution", "Convolution")
        self.setPropertyGroup("ConvolutionWidth", "Convolution")
        self.setPropertyGroup("Deconvolution", "Convolution")
Пример #26
0
    def PyInit(self):
        self.declareProperty(
            IMDHistoWorkspaceProperty("InputWorkspace",
                                      "",
                                      optional=PropertyMode.Mandatory,
                                      direction=Direction.Input),
            "Input Workspace with HKL dimensions centered on zero.")
        self.declareProperty(
            WorkspaceProperty("IntermediateWorkspace",
                              "",
                              optional=PropertyMode.Optional,
                              direction=Direction.Output),
            "The resulting workspace after reflection removal and filters applied. What is the input of the FFT."
        )
        self.declareProperty(
            WorkspaceProperty("OutputWorkspace",
                              "",
                              optional=PropertyMode.Mandatory,
                              direction=Direction.Output), "Output Workspace")

        self.declareProperty(
            "Method", 'KAREN',
            StringListValidator(['None', 'Punch and fill', 'KAREN']),
            "Bragg peak removal method")
        self.declareProperty(
            "WindowFunction", 'Blackman',
            StringListValidator(
                ['None', 'Gaussian', 'Blackman', 'Tukey', 'Kaiser']),
            "Apply a window function to the data")
        self.declareProperty(
            "WindowParameter",
            defaultValue=0.5,
            validator=FloatBoundedValidator(0.),
            doc=
            "Parameter for window function, depends on window type, see algorithm docs"
        )

        # Punch and fill
        condition = EnabledWhenProperty("Method", PropertyCriterion.IsEqualTo,
                                        'Punch and fill')
        self.declareProperty("Shape",
                             "sphere",
                             doc="Shape to punch out reflections",
                             validator=StringListValidator(['sphere', 'cube']))
        self.setPropertySettings("Shape", condition)
        val_min_zero = FloatArrayBoundedValidator(lower=0.)
        self.declareProperty(
            FloatArrayProperty("Size", [0.2], validator=val_min_zero),
            "Width of cube/diameter of sphere used to remove reflections, in (HKL) (one or three values)"
        )
        self.setPropertySettings("Size", condition)
        self.declareProperty(
            "SpaceGroup",
            "",
            doc=
            "Space group for reflection removal, either full name or number. If empty all HKL's will be removed."
        )
        self.setPropertySettings("SpaceGroup", condition)
        self.declareProperty(
            "Convolution", True,
            "Apply convolution to fill in removed reflections")
        self.setPropertySettings("Convolution", condition)
        self.declareProperty("ConvolutionWidth",
                             2.0,
                             validator=FloatBoundedValidator(0.),
                             doc="Width of gaussian convolution in pixels")
        self.setPropertySettings("ConvolutionWidth", condition)

        self.declareProperty(
            "CropSphere", False,
            "Limit min/max q values. Can help with edge effects.")
        condition = EnabledWhenProperty("CropSphere",
                                        PropertyCriterion.IsNotDefault)
        self.declareProperty(
            FloatArrayProperty("SphereMin", [Property.EMPTY_DBL],
                               validator=val_min_zero),
            "HKL values below which will be removed (one or three values)")
        self.setPropertySettings("SphereMin", condition)
        self.declareProperty(
            FloatArrayProperty("SphereMax", [Property.EMPTY_DBL],
                               validator=val_min_zero),
            "HKL values above which will be removed (one or three values)")
        self.setPropertySettings("SphereMax", condition)
        self.declareProperty("FillValue", Property.EMPTY_DBL,
                             "Value to replace with outside sphere")
        self.setPropertySettings("FillValue", condition)

        # KAREN
        self.declareProperty("KARENWidth", 7, "Size of filter window")

        # Reflections
        self.setPropertyGroup("Shape", "Punch and fill")
        self.setPropertyGroup("Size", "Punch and fill")
        self.setPropertyGroup("SpaceGroup", "Punch and fill")

        # Sphere
        self.setPropertyGroup("CropSphere", "Cropping to a sphere")
        self.setPropertyGroup("SphereMin", "Cropping to a sphere")
        self.setPropertyGroup("SphereMax", "Cropping to a sphere")
        self.setPropertyGroup("FillValue", "Cropping to a sphere")

        # Convolution
        self.setPropertyGroup("Convolution", "Convolution")
        self.setPropertyGroup("ConvolutionWidth", "Convolution")
Пример #27
0
    def PyInit(self):
        # Input validators
        array_length_three = FloatArrayLengthValidator(3)
        # Properties
        self.declareProperty('RunNumbers', '', 'Sample run numbers')

        self.declareProperty(FileProperty(name='MaskFile',
                                          defaultValue=self._mask_file,
                                          action=FileAction.OptionalLoad,
                                          extensions=['.xml']),
                             doc='See documentation for latest mask files.')

        self.declareProperty(FloatArrayProperty('LambdaRange',
                                                self._lambda_range,
                                                direction=Direction.Input),
                             doc='Incoming neutron wavelength range')

        self.declareProperty(WorkspaceProperty('OutputWorkspace', '',
                                               optional=PropertyMode.Mandatory,
                                               direction=Direction.Output),
                             doc='Output Workspace. If background is '+
                                 'subtracted, _data and _background '+
                                 'workspaces will also be generated')

        #
        # Background for the sample runs
        #
        background_title = 'Background runs'
        self.declareProperty('BackgroundRuns', '', 'Background run numbers')
        self.setPropertyGroup('BackgroundRuns', background_title)
        self.declareProperty("BackgroundScale", 1.0,
                             doc='The background will be scaled by this '+
                                 'number before being subtracted.')
        self.setPropertyGroup('BackgroundScale', background_title)
        #
        # Vanadium
        #
        vanadium_title = 'Vanadium runs'
        self.declareProperty('VanadiumRuns', '', 'Vanadium run numbers')
        self.setPropertyGroup('VanadiumRuns', vanadium_title)

        #
        # Single Crystal Diffraction
        #
        crystal_diffraction_title = 'Single Crystal Diffraction'
        self.declareProperty('SingleCrystalDiffraction',
                             False, direction=Direction.Input,
                             doc='Calculate diffraction pattern?')
        crystal_diffraction_enabled =\
            EnabledWhenProperty('SingleCrystalDiffraction',
                                PropertyCriterion.IsNotDefault)
        self.declareProperty('PsiAngleLog', 'SE50Rot',
                             direction=Direction.Input,
                             doc='log entry storing rotation of the sample'
                                 'around the vertical axis')
        self.declareProperty('PsiOffset', 0.0,
                             direction=Direction.Input,
                             doc='Add this quantity to PsiAngleLog')
        self.declareProperty(FloatArrayProperty('LatticeSizes', [0,0,0],
                                                array_length_three,
                                                direction=Direction.Input),
                             doc='three item comma-separated list "a, b, c"')
        self.declareProperty(FloatArrayProperty('LatticeAngles',
                                                [90.0, 90.0, 90.0],
                                                array_length_three,
                                                direction=Direction.Input),
                             doc='three item comma-separated ' +
                                 'list "alpha, beta, gamma"')
        #    Reciprocal vector to be aligned with incoming beam
        self.declareProperty(FloatArrayProperty('VectorU', [1, 0, 0],
                                                array_length_three,
                                                direction=Direction.Input),
                             doc='three item, comma-separated, HKL indexes'
                                 'of the diffracting plane')
        #    Reciprocal vector orthogonal to VectorU and in-plane with
        #    incoming beam
        self.declareProperty(FloatArrayProperty('VectorV', [0, 1, 0],
                                                array_length_three,
                                                direction=Direction.Input),
                             doc='three item, comma-separated, HKL indexes'
                                 'of the direction perpendicular to VectorV'
                                 'and the vertical axis')
        #    Abscissa view
        self.declareProperty(FloatArrayProperty('Uproj', [1, 0, 0],
                                                array_length_three,
                                                direction=Direction.Input),
                             doc='three item comma-separated Abscissa view'
                                 'of the diffraction pattern')
        #    Ordinate view
        self.declareProperty(FloatArrayProperty('Vproj', [0, 1, 0],
                                                array_length_three,
                                                direction=Direction.Input),
                             doc='three item comma-separated Ordinate view'
                                 'of the diffraction pattern')
        #    Hidden axis
        self.declareProperty(FloatArrayProperty('Wproj', [0, 0, 1],
                                                array_length_three,
                                                direction=Direction.Input),
                             doc='Hidden axis view')
        #    Binnin in reciprocal slice
        self.declareProperty('NBins', 400, direction=Direction.Input,
                             doc='number of bins in the HKL slice')

        self.setPropertyGroup('SingleCrystalDiffraction',
                              crystal_diffraction_title)
        for a_property in ('PsiAngleLog', 'PsiOffset',
                           'LatticeSizes', 'LatticeAngles', 'VectorU',
                           'VectorV', 'Uproj', 'Vproj', 'Wproj', 'NBins'):
            self.setPropertyGroup(a_property, crystal_diffraction_title)
            self.setPropertySettings(a_property, crystal_diffraction_enabled)
Пример #28
0
    def PyInit(self):
        self._short_inst = 'BSS'
        self._long_inst = 'BASIS'
        self._extension = '_event.nxs'

        self.declareProperty('RunNumbers', '', 'Sample run numbers')
        self.declareProperty('DoIndividual', False, 'Do each run individually')
        self.declareProperty(
            'ExcludeTimeSegment', '', 'Exclude a contigous time segment; ' +
            'Examples: "71546:0-60" filter run 71546 from ' +
            'start to 60 seconds, "71546:300-600", ' +
            '"71546:120-end" from 120s to the end of the run')
        help_doc = """Only retain events occurring within a time segment.
Examples: 71546:0-3600 only retains events from the first hour of run 71546.
71546:3600-7200 retain only the second hour. 71546:7200-end retain events after
the first two hours"""
        self.declareProperty('RetainTimeSegment', '', help_doc)
        grouping_type = ['None', 'Low-Resolution', 'By-Tube']
        self.declareProperty('GroupDetectors', 'None',
                             StringListValidator(grouping_type),
                             'Switch for grouping detectors')
        #
        #  Normalization selector
        #
        title_flux_normalization = 'Flux Normalization'
        self.declareProperty('DoFluxNormalization',
                             True,
                             direction=Direction.Input,
                             doc='Do we normalize data by incoming flux?')
        self.setPropertyGroup('DoFluxNormalization', title_flux_normalization)
        if_flux_normalization = EnabledWhenProperty(
            'DoFluxNormalization', PropertyCriterion.IsDefault)
        default_flux_normalization = self._flux_normalization_types[0]
        self.declareProperty(
            'FluxNormalizationType', default_flux_normalization,
            StringListValidator(self._flux_normalization_types),
            'Flux Normalization Type')
        self.setPropertySettings('FluxNormalizationType',
                                 if_flux_normalization)
        self.setPropertyGroup('FluxNormalizationType',
                              title_flux_normalization)

        self.declareProperty(
            'NormalizeToFirst', False,
            'Normalize spectra ' + 'to intensity of spectrum with lowest Q?')
        #
        # Properties affected by the reflection selected
        #
        titleReflection = 'Reflection Selector'
        available_reflections = sorted(REFLECTIONS_DICT.keys())
        default_reflection = REFLECTIONS_DICT['silicon_111']
        self.declareProperty(
            'ReflectionType', default_reflection['name'],
            StringListValidator(available_reflections),
            'Analyzer. Documentation lists typical \
                             associated property values.')
        self.setPropertyGroup('ReflectionType', titleReflection)
        self.declareProperty(
            FloatArrayProperty('EnergyBins',
                               default_reflection['energy_bins'],
                               direction=Direction.Input),
            'Energy transfer binning scheme (in ueV)')
        self.setPropertyGroup('EnergyBins', titleReflection)
        self.declareProperty(
            FloatArrayProperty('MomentumTransferBins',
                               default_reflection['q_bins'],
                               direction=Direction.Input),
            'Momentum transfer binning scheme')
        self.setPropertyGroup('MomentumTransferBins', titleReflection)
        self.declareProperty(
            FileProperty(name='MaskFile',
                         defaultValue='',
                         action=FileAction.OptionalLoad,
                         extensions=['.xml']),
            'See documentation for latest mask files.')
        self.setPropertyGroup('MaskFile', titleReflection)

        # Properties setting the division by vanadium
        titleDivideByVanadium = 'Normalization by Vanadium'
        self.declareProperty('DivideByVanadium',
                             False,
                             direction=Direction.Input,
                             doc='Do we normalize by the vanadium intensity?')
        self.setPropertyGroup('DivideByVanadium', titleDivideByVanadium)
        ifDivideByVanadium = EnabledWhenProperty(
            'DivideByVanadium', PropertyCriterion.IsNotDefault)

        normalization_types = ['by Q slice', 'by detector ID']
        self.declareProperty('NormalizationType', 'by Q slice',
                             StringListValidator(normalization_types),
                             'Select a Vanadium normalization')
        self.setPropertySettings('NormalizationType', ifDivideByVanadium)
        self.setPropertyGroup('NormalizationType', titleDivideByVanadium)

        self.declareProperty('NormRunNumbers', '', 'Normalization run numbers')
        self.setPropertySettings('NormRunNumbers', ifDivideByVanadium)
        self.setPropertyGroup('NormRunNumbers', titleDivideByVanadium)

        # Properties setting the saving of NSXPE file
        title_nxspe = 'Save to NXSPE'
        self.declareProperty('SaveNXSPE',
                             False,
                             direction=Direction.Input,
                             doc='Do we save to NXSPE format?')
        nxspe_enabled = EnabledWhenProperty('SaveNXSPE',
                                            PropertyCriterion.IsNotDefault)
        self.setPropertyGroup('SaveNXSPE', title_nxspe)
        self.declareProperty('PsiAngleLog',
                             'SE50Rot',
                             direction=Direction.Input,
                             doc='name of entry in the logs storing the psi \
                             angle')
        self.setPropertySettings('PsiAngleLog', nxspe_enabled)
        self.setPropertyGroup('PsiAngleLog', title_nxspe)
        self.declareProperty('PsiOffset',
                             0.0,
                             direction=Direction.Input,
                             doc='add this quantity to the psi angle stored \
                             in the log')
        self.setPropertySettings('PsiOffset', nxspe_enabled)
        self.setPropertyGroup('PsiOffset', title_nxspe)

        # Aditional output properties
        titleAddionalOutput = 'Additional Output'
        self.declareProperty('OutputSusceptibility',
                             False,
                             direction=Direction.Input,
                             doc='Output dynamic susceptibility (Xqw)')
        self.setPropertyGroup('OutputSusceptibility', titleAddionalOutput)
        self.declareProperty('OutputPowderSpectrum',
                             False,
                             direction=Direction.Input,
                             doc='Output S(Q) and S(theta) powder diffraction')
        self.setPropertyGroup('OutputPowderSpectrum', titleAddionalOutput)
        self.declareProperty('RemoveTemporaryWorkspaces',
                             True,
                             direction=Direction.Input,
                             doc='Remove temporary workspaces and files')
        self.setPropertyGroup('RemoveTemporaryWorkspaces', titleAddionalOutput)
Пример #29
0
    def PyInit(self):

        self.declareProperty(WorkspaceGroupProperty('InputWorkspace', '',
                                                    direction=Direction.Input),
                             doc='The input workspace with spin-flip and non-spin-flip data.')

        self.declareProperty(WorkspaceGroupProperty('RotatedXYZWorkspace', '',
                                                    direction=Direction.Input,
                                                    optional=PropertyMode.Optional),
                             doc='The workspace used in 10p method when data is taken as two XYZ'
                                 +' measurements rotated by 45 degress.')

        self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '',
                                                    direction=Direction.Output,
                                                    optional=PropertyMode.Optional),
                             doc='The output workspace.')

        self.declareProperty(name="CrossSectionSeparationMethod",
                             defaultValue="None",
                             validator=StringListValidator(["None", "Uniaxial", "XYZ", "10p"]),
                             direction=Direction.Input,
                             doc="What type of cross-section separation to perform.")

        self.declareProperty(name="OutputUnits",
                             defaultValue="TwoTheta",
                             validator=StringListValidator(["TwoTheta", "Q", "Qxy"]),
                             direction=Direction.Input,
                             doc="The choice to display the output either as a function of detector twoTheta,"
                                 +" or the momentum exchange.")

        self.declareProperty(name="NormalisationMethod",
                             defaultValue="None",
                             validator=StringListValidator(["None", "Vanadium", "Incoherent",  "Paramagnetic"]),
                             direction=Direction.Input,
                             doc="Method to correct detector efficiency and normalise data.")

        self.declareProperty(name="OutputTreatment",
                             defaultValue="Individual",
                             validator=StringListValidator(["Individual", "Merge"]),
                             direction=Direction.Input,
                             doc="Which treatment of the provided scan should be used to create output.")

        self.declareProperty(name="MeasurementTechnique",
                             defaultValue="Powder",
                             validator=StringListValidator(["Powder", "SingleCrystal"]),
                             direction=Direction.Input,
                             doc="What type of measurement technique has been used to collect the data.")

        self.declareProperty(PropertyManagerProperty('SampleAndEnvironmentProperties', dict()),
                             doc="Dictionary for the information about sample and its environment.")

        self.declareProperty(name="ScatteringAngleBinSize",
                             defaultValue=0.5,
                             validator=FloatBoundedValidator(lower=0),
                             direction=Direction.Input,
                             doc="Scattering angle bin size in degrees used for expressing scan data on a single TwoTheta axis.")

        self.setPropertySettings("ScatteringAngleBinSize", EnabledWhenProperty('OutputTreatment', PropertyCriterion.IsEqualTo, 'Merge'))

        self.declareProperty(WorkspaceGroupProperty('VanadiumInputWorkspace', '',
                                                    direction=Direction.Input,
                                                    optional=PropertyMode.Optional),
                             doc='The name of the vanadium workspace.')

        self.setPropertySettings('VanadiumInputWorkspace', EnabledWhenProperty('NormalisationMethod',
                                                                               PropertyCriterion.IsEqualTo, 'Vanadium'))

        self.declareProperty('AbsoluteUnitsNormalisation', True,
                             doc='Whether or not express the output in absolute units.')

        self.declareProperty("IsotropicMagnetism", True,
                             doc="Whether the paramagnetism is isotropic (Steward, Ehlers) or anisotropic (Schweika).")

        self.declareProperty('ClearCache', True,
                             doc='Whether or not to delete intermediate workspaces.')
    def PyInit(self):
        # Sample Input
        self.declareProperty(
            WorkspaceProperty('SampleWorkspace', '',
                              direction=Direction.Input),
            doc='Workspace with the measurement of the sample [in a container].'
        )

        # Monte Carlo Options
        self.declareProperty(name='EventsPerPoint',
                             defaultValue=1000,
                             validator=IntBoundedValidator(0),
                             doc='Number of neutron events')
        self.declareProperty(name='Interpolation',
                             defaultValue='Linear',
                             validator=StringListValidator(
                                 ['Linear', 'CSpline']),
                             doc='Type of interpolation')
        self.declareProperty(
            name='MaxScatterPtAttempts',
            defaultValue=5000,
            validator=IntBoundedValidator(0),
            doc='Maximum number of tries made to generate a scattering point')
        self.declareProperty(
            name='SparseInstrument',
            defaultValue=False,
            doc=
            'Whether to spatially approximate the instrument for faster calculation.'
        )
        self.declareProperty(
            name='NumberOfDetectorRows',
            defaultValue=3,
            validator=IntBoundedValidator(lower=3),
            doc=
            'Number of detector rows in the detector grid of the sparse instrument.'
        )
        self.declareProperty(
            name='NumberOfDetectorColumns',
            defaultValue=2,
            validator=IntBoundedValidator(lower=2),
            doc=
            'Number of detector columns in the detector grid of the sparse instrument.'
        )

        sparse_condition = EnabledWhenProperty('SparseInstrument',
                                               PropertyCriterion.IsNotDefault)
        self.setPropertySettings('NumberOfDetectorRows', sparse_condition)
        self.setPropertySettings('NumberOfDetectorColumns', sparse_condition)

        self.setPropertyGroup('SparseInstrument', 'Monte Carlo Options')
        self.setPropertyGroup('NumberOfDetectorRows', 'Monte Carlo Options')
        self.setPropertyGroup('NumberOfDetectorColumns', 'Monte Carlo Options')
        self.setPropertyGroup('EventsPerPoint', 'Monte Carlo Options')
        self.setPropertyGroup('Interpolation', 'Monte Carlo Options')
        self.setPropertyGroup('MaxScatterPtAttempts', 'Monte Carlo Options')

        # Beam Options
        self.declareProperty(name='BeamHeight',
                             defaultValue=1.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Height of the beam (cm)')
        self.declareProperty(name='BeamWidth',
                             defaultValue=1.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Width of the beam (cm)')

        self.setPropertyGroup('BeamHeight', 'Beam Options')
        self.setPropertyGroup('BeamWidth', 'Beam Options')

        # Shape Options
        self.declareProperty(name='Shape',
                             defaultValue='FlatPlate',
                             validator=StringListValidator(
                                 ['FlatPlate', 'Cylinder', 'Annulus']),
                             doc='Geometric shape of the sample environment')

        flat_plate_condition = VisibleWhenProperty('Shape',
                                                   PropertyCriterion.IsEqualTo,
                                                   'FlatPlate')
        cylinder_condition = VisibleWhenProperty('Shape',
                                                 PropertyCriterion.IsEqualTo,
                                                 'Cylinder')
        annulus_condition = VisibleWhenProperty('Shape',
                                                PropertyCriterion.IsEqualTo,
                                                'Annulus')

        # height is common to all shapes, and should be the same for sample and container
        self.declareProperty('Height',
                             defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Height of the sample environment (cm)')

        self.setPropertyGroup('Shape', 'Shape Options')
        self.setPropertyGroup('Height', 'Shape Options')

        # Sample Shape
        # Flat Plate
        self.declareProperty(name='SampleWidth',
                             defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Width of the sample environment (cm)')
        self.declareProperty(name='SampleThickness',
                             defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Thickness of the sample environment (cm)')
        self.declareProperty(name='SampleCenter',
                             defaultValue=0.0,
                             doc='Center of the sample environment')
        self.declareProperty(
            name='SampleAngle',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc=
            'Angle of the sample environment with respect to the beam (degrees)'
        )

        self.setPropertySettings('SampleWidth', flat_plate_condition)
        self.setPropertySettings('SampleThickness', flat_plate_condition)
        self.setPropertySettings('SampleCenter', flat_plate_condition)
        self.setPropertySettings('SampleAngle', flat_plate_condition)

        self.setPropertyGroup('SampleWidth', 'Sample Shape')
        self.setPropertyGroup('SampleThickness', 'Sample Shape')
        self.setPropertyGroup('SampleCenter', 'Sample Shape')
        self.setPropertyGroup('SampleAngle', 'Sample Shape')

        # Cylinder
        self.declareProperty(name='SampleRadius',
                             defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Radius of the sample environment (cm)')

        self.setPropertySettings('SampleRadius', cylinder_condition)
        self.setPropertyGroup('SampleRadius', 'Sample Shape')

        # Annulus
        self.declareProperty(name='SampleInnerRadius',
                             defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Inner radius of the sample environment (cm)')
        self.declareProperty(name='SampleOuterRadius',
                             defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Outer radius of the sample environment (cm)')

        self.setPropertySettings('SampleInnerRadius', annulus_condition)
        self.setPropertySettings('SampleOuterRadius', annulus_condition)

        self.setPropertyGroup('SampleInnerRadius', 'Sample Shape')
        self.setPropertyGroup('SampleOuterRadius', 'Sample Shape')

        # Sample Material
        self.declareProperty(name='SampleChemicalFormula',
                             defaultValue='',
                             doc='Chemical formula for the sample material')
        self.declareProperty(
            name='SampleCoherentXSection',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc=
            'The coherent cross-section for the sample material in barns. To be used instead of '
            'Chemical Formula.')
        self.declareProperty(
            name='SampleIncoherentXSection',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc=
            'The incoherent cross-section for the sample material in barns. To be used instead of '
            'Chemical Formula.')
        self.declareProperty(
            name='SampleAttenuationXSection',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc=
            'The absorption cross-section for the sample material in barns. To be used instead of '
            'Chemical Formula.')
        self.declareProperty(
            name='SampleDensityType',
            defaultValue='Mass Density',
            validator=StringListValidator(['Mass Density', 'Number Density']),
            doc='Use of Mass density or Number density for the sample.')
        self.declareProperty(
            name='SampleNumberDensityUnit',
            defaultValue='Atoms',
            validator=StringListValidator(['Atoms', 'Formula Units']),
            doc=
            'Choose which units SampleDensity refers to. Allowed values: [Atoms, Formula Units]'
        )
        self.declareProperty(
            name='SampleDensity',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc=
            'The value for the sample Mass density (g/cm^3) or Number density (1/Angstrom^3).'
        )

        self.setPropertyGroup('SampleChemicalFormula', 'Sample Material')
        self.setPropertyGroup('SampleCoherentXSection', 'Sample Material')
        self.setPropertyGroup('SampleIncoherentXSection', 'Sample Material')
        self.setPropertyGroup('SampleAttenuationXSection', 'Sample Material')
        self.setPropertyGroup('SampleDensityType', 'Sample Material')
        self.setPropertyGroup('SampleNumberDensityUnit', 'Sample Material')
        self.setPropertyGroup('SampleDensity', 'Sample Material')

        # Container Input
        self.declareProperty(
            WorkspaceProperty('ContainerWorkspace',
                              '',
                              direction=Direction.Input,
                              optional=PropertyMode.Optional),
            doc='Workspace with the container-only measurement.')

        container_condition = VisibleWhenProperty(
            'ContainerWorkspace', PropertyCriterion.IsNotDefault)

        # Container Shape
        container_flat_plate_condition = VisibleWhenProperty(
            container_condition, flat_plate_condition, LogicOperator.And)
        container_cylinder_condition = VisibleWhenProperty(
            container_condition, cylinder_condition, LogicOperator.And)
        container_annulus_condition = VisibleWhenProperty(
            container_condition, annulus_condition, LogicOperator.And)

        # Flat Plate
        self.declareProperty(
            name='ContainerFrontThickness',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc='Front thickness of the container environment (cm)')
        self.declareProperty(
            name='ContainerBackThickness',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc='Back thickness of the container environment (cm)')

        self.setPropertySettings('ContainerFrontThickness',
                                 container_flat_plate_condition)
        self.setPropertySettings('ContainerBackThickness',
                                 container_flat_plate_condition)
        self.setPropertyGroup('ContainerFrontThickness', 'Container Shape')
        self.setPropertyGroup('ContainerBackThickness', 'Container Shape')

        # Cylinder
        self.declareProperty(name='ContainerRadius',
                             defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Outer radius of the sample environment (cm)')

        self.setPropertySettings('ContainerRadius',
                                 container_cylinder_condition)
        self.setPropertyGroup('ContainerRadius', 'Container Shape')

        # Annulus
        self.declareProperty(
            name='ContainerInnerRadius',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc='Inner radius of the container environment (cm)')
        self.declareProperty(
            name='ContainerOuterRadius',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc='Outer radius of the container environment (cm)')

        self.setPropertySettings('ContainerInnerRadius',
                                 container_annulus_condition)
        self.setPropertySettings('ContainerOuterRadius',
                                 container_annulus_condition)

        self.setPropertyGroup('ContainerInnerRadius', 'Container Shape')
        self.setPropertyGroup('ContainerOuterRadius', 'Container Shape')

        # Container Material
        self.declareProperty(name='ContainerChemicalFormula',
                             defaultValue='',
                             doc='Chemical formula for the container material')
        self.declareProperty(
            name='ContainerCoherentXSection',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc=
            'The coherent cross-section for the can material in barns. To be used instead of '
            'Chemical Formula.')
        self.declareProperty(
            name='ContainerIncoherentXSection',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc=
            'The incoherent cross-section for the can material in barns. To be used instead of '
            'Chemical Formula.')
        self.declareProperty(
            name='ContainerAttenuationXSection',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc=
            'The absorption cross-section for the can material in barns. To be used instead of '
            'Chemical Formula.')
        self.declareProperty(
            name='ContainerDensityType',
            defaultValue='Mass Density',
            validator=StringListValidator(['Mass Density', 'Number Density']),
            doc='Use of Mass density or Number density for the container.')
        self.declareProperty(
            name='ContainerNumberDensityUnit',
            defaultValue='Atoms',
            validator=StringListValidator(['Atoms', 'Formula Units']),
            doc=
            'Choose which units ContainerDensity refers to. Allowed values: [Atoms, Formula Units]'
        )
        self.declareProperty(
            name='ContainerDensity',
            defaultValue=0.0,
            validator=FloatBoundedValidator(0.0),
            doc=
            'The value for the container Mass density (g/cm^3) or Number density (1/Angstrom^3).'
        )

        self.setPropertyGroup('ContainerChemicalFormula', 'Container Material')
        self.setPropertyGroup('ContainerCoherentXSection',
                              'Container Material')
        self.setPropertyGroup('ContainerIncoherentXSection',
                              'Container Material')
        self.setPropertyGroup('ContainerAttenuationXSection',
                              'Container Material')
        self.setPropertyGroup('ContainerDensityType', 'Container Material')
        self.setPropertyGroup('ContainerNumberDensityUnit',
                              'Container Material')
        self.setPropertyGroup('ContainerDensity', 'Container Material')

        self.setPropertySettings('ContainerChemicalFormula',
                                 container_condition)
        self.setPropertySettings('ContainerDensityType', container_condition)
        self.setPropertySettings('ContainerDensity', container_condition)

        # Output Workspace Group
        self.declareProperty(
            WorkspaceGroupProperty(name='CorrectionsWorkspace',
                                   defaultValue='corrections',
                                   direction=Direction.Output,
                                   optional=PropertyMode.Optional),
            doc='Name of the workspace group to save correction factors')