def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     mandatoryInputRuns = CompositeValidator()
     mandatoryInputRuns.add(StringArrayMandatoryValidator())
     lenValidator = StringArrayLengthValidator()
     lenValidator.setLengthMin(1)
     mandatoryInputRuns.add(lenValidator)
     self.declareProperty(StringArrayProperty(Prop.RUNS,
                                              values=[],
                                              validator=mandatoryInputRuns),
                          doc='A list of run numbers or workspace names for the input runs. '
                          'Multiple runs will be summed before reduction.')
     self.declareProperty(StringArrayProperty(Prop.FIRST_TRANS_RUNS,
                                              values=[]),
                          doc='A list of run numbers or workspace names for the first transmission run. '
                          'Multiple runs will be summed before reduction.')
     self.declareProperty(StringArrayProperty(Prop.SECOND_TRANS_RUNS,
                                              values=[]),
                          doc='A list of run numbers or workspace names for the second transmission run. '
                          'Multiple runs will be summed before reduction.')
     self._declareSliceAlgorithmProperties()
     self._declareReductionAlgorithmProperties()
     self.declareProperty(WorkspaceProperty(Prop.OUTPUT_WS, '',
                                            optional=PropertyMode.Optional,
                                            direction=Direction.Output),
                          doc='The output workspace, or workspace group if sliced.')
     self.declareProperty(WorkspaceProperty(Prop.OUTPUT_WS_BINNED, '',
                                            optional=PropertyMode.Optional,
                                            direction=Direction.Output),
                          doc='The binned output workspace, or workspace group if sliced.')
     self.declareProperty(WorkspaceProperty(Prop.OUTPUT_WS_LAM, '',
                                            optional=PropertyMode.Optional,
                                            direction=Direction.Output),
                          doc='The output workspace in wavelength, or workspace group if sliced.')
 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     mandatoryInputWorkspaces = CompositeValidator()
     mandatoryInputWorkspaces.add(StringArrayMandatoryValidator())
     mandatoryInputWorkspaces.add(StringArrayLengthValidator(1, 4))
     self.declareProperty(StringArrayProperty(Prop.INPUT_WS,
                                              values=[],
                                              validator=mandatoryInputWorkspaces),
                          doc='A set of polarized workspaces, in wavelength.')
     self.declareProperty(WorkspaceGroupProperty(Prop.OUTPUT_WS,
                                                 defaultValue='',
                                                 direction=Direction.Output),
                          doc='A group of polarization efficiency corrected workspaces.')
     self.declareProperty(Prop.SUBALG_LOGGING,
                          defaultValue=SubalgLogging.OFF,
                          validator=StringListValidator([SubalgLogging.OFF, SubalgLogging.ON]),
                          doc='Enable or disable child algorithm logging.')
     self.declareProperty(Prop.CLEANUP,
                          defaultValue=common.WSCleanup.ON,
                          validator=StringListValidator([common.WSCleanup.ON, common.WSCleanup.OFF]),
                          doc='Enable or disable intermediate workspace cleanup.')
     self.declareProperty(FileProperty(Prop.EFFICIENCY_FILE,
                                       defaultValue='',
                                       action=FileAction.Load),
                          doc='A file containing the polarization efficiency factors.')
    def PyInit(self):
        # State
        self.declareProperty(PropertyManagerProperty('SANSState'),
                             doc='A property manager which fulfills the SANSState contract.')
        # Input workspaces
        workspace_validator = CompositeValidator()
        workspace_validator.add(WorkspaceUnitValidator("Wavelength"))

        self.declareProperty(MatrixWorkspaceProperty("TransmissionWorkspace", '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The calculated transmission workspace in wavelength units.')
        self.declareProperty(MatrixWorkspaceProperty("NormalizeToMonitorWorkspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The monitor normalization workspace in wavelength units.')
        allowed_detector_types = StringListValidator([DetectorType.to_string(DetectorType.HAB),
                                                      DetectorType.to_string(DetectorType.LAB)])
        self.declareProperty("Component", DetectorType.to_string(DetectorType.LAB),
                             validator=allowed_detector_types, direction=Direction.Input,
                             doc="The component of the instrument which is currently being investigated.")

        # Output workspace
        self.declareProperty(MatrixWorkspaceProperty("OutputWorkspaceWavelengthAdjustment", '',
                                                     direction=Direction.Output),
                             doc='A wavelength adjustment output workspace.')
        self.declareProperty(MatrixWorkspaceProperty("OutputWorkspacePixelAdjustment", '',
                                                     direction=Direction.Output),
                             doc='A pixel adjustment output workspace.')
Exemplo n.º 4
0
 def test_creation_with_add_succeeds_correctly_in_algorithm(self):
     """
         Tests that a composite validator created with the add
         method validates correctly
     """
     validation = CompositeValidator()
     validation.add(FloatBoundedValidator(lower=5))
     validation.add(FloatBoundedValidator(upper=10))
     self._do_validation_test(validation)
Exemplo n.º 5
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='A workspace to be integrated.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='The integrated workspace.')
        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='Vanadium temperature in Kelvin for Debye-Waller correction, ' +
                                 'overrides the default value from the sample logs.')
        self.setPropertySettings(common.PROP_TEMPERATURE, EnabledWhenProperty(common.PROP_DWF_CORRECTION,
                                                                              PropertyCriterion.IsDefault))
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))
        scalingFactor = FloatBoundedValidator(lower=0, upper=1)

        # Properties.
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input),
            doc='A workspace to which to apply the corrections.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='The corrected workspace.')
        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(MatrixWorkspaceProperty(
            name=common.PROP_EC_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input,
            optional=PropertyMode.Optional),
            doc='An empty container workspace for subtraction from the input workspace.')
        self.declareProperty(name=common.PROP_EC_SCALING,
                             defaultValue=1.0,
                             validator=scalingFactor,
                             direction=Direction.Input,
                             doc='A multiplier (transmission, if no self ' +
                                 'shielding is applied) for the empty container.')
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_SELF_SHIELDING_CORRECTION_WS,
            defaultValue='',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
            doc='A workspace containing the self shielding correction factors.')
Exemplo n.º 7
0
 def PyInit(self):
     """ Declare properties
     """
     validator = CompositeValidator()
     validator.add(WorkspaceUnitValidator("TOF"))
     validator.add(InstrumentValidator())
     self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", "", direction=Direction.Input, validator=validator),
                          doc="Input workspace.")
     self.declareProperty(ITableWorkspaceProperty("EPPTable", "", direction=Direction.Input),
                          doc="Input EPP table. May be produced by FindEPP algorithm.")
     self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", "", direction=Direction.Output),
                          doc="Name of the workspace that will contain the results")
     return
Exemplo n.º 8
0
 def PyInit(self):
     """
     Declare properties
     """
     allowed_units = CompositeValidator([
         WorkspaceUnitValidator("DeltaE"),
         WorkspaceUnitValidator("Momentum")
     ],
                                        relation=CompositeRelation.OR)
     self.declareProperty(
         IEventWorkspaceProperty("InputWorkspace",
                                 "",
                                 direction=Direction.Input,
                                 validator=allowed_units),
         doc="Input workspace. It has to be an event workspace" +
         " with units of energy transfer or momentum")
     self.declareProperty(name="XMin",
                          defaultValue=Property.EMPTY_DBL,
                          direction=Direction.Input,
                          validator=FloatMandatoryValidator(),
                          doc="Minimum energy transfer or momentum")
     self.declareProperty(name="XMax",
                          defaultValue=Property.EMPTY_DBL,
                          direction=Direction.Input,
                          validator=FloatMandatoryValidator(),
                          doc="Maximum energy transfer or momentum")
     self.declareProperty(WorkspaceProperty('OutputWorkspace',
                                            '',
                                            direction=Direction.Output),
                          doc='Output workspace')
Exemplo n.º 9
0
 def test_creation_with_constructor_and_list(self):
     """
         Tests that a composite validator created with the constructor method
     """
     validation = CompositeValidator(
         [FloatBoundedValidator(lower=5),
          FloatBoundedValidator(upper=10)])
     self._do_validation_test(validation)
    def PyInit(self):
        # State
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')
        # Input workspaces
        workspace_validator = CompositeValidator()
        workspace_validator.add(WorkspaceUnitValidator("Wavelength"))

        self.declareProperty(
            MatrixWorkspaceProperty("TransmissionWorkspace",
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Input,
                                    validator=workspace_validator),
            doc='The calculated transmission workspace in wavelength units.')
        self.declareProperty(
            MatrixWorkspaceProperty("NormalizeToMonitorWorkspace",
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input,
                                    validator=workspace_validator),
            doc='The monitor normalization workspace in wavelength units.')
        allowed_detector_types = StringListValidator([
            DetectorType.to_string(DetectorType.HAB),
            DetectorType.to_string(DetectorType.LAB)
        ])
        self.declareProperty(
            "Component",
            DetectorType.to_string(DetectorType.LAB),
            validator=allowed_detector_types,
            direction=Direction.Input,
            doc=
            "The component of the instrument which is currently being investigated."
        )

        # Output workspace
        self.declareProperty(MatrixWorkspaceProperty(
            "OutputWorkspaceWavelengthAdjustment",
            '',
            direction=Direction.Output),
                             doc='A wavelength adjustment output workspace.')
        self.declareProperty(MatrixWorkspaceProperty(
            "OutputWorkspacePixelAdjustment", '', direction=Direction.Output),
                             doc='A pixel adjustment output workspace.')
Exemplo n.º 11
0
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        # State
        self.declareProperty(PropertyManagerProperty('SANSState'),
                             doc='A property manager which fulfills the SANSState contract.')

        # Main workspace
        workspace_validator = CompositeValidator()
        workspace_validator.add(WorkspaceUnitValidator("Wavelength"))
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The main input workspace.')

        # Adjustment workspaces
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspaceWavelengthAdjustment", '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The workspace which contains only wavelength-specific adjustments, ie which affects '
                                 'all spectra equally.')
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspacePixelAdjustment", '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input),
                             doc='The workspace which contains only pixel-specific adjustments, ie which affects '
                                 'all bins within a spectrum equally.')
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspaceWavelengthAndPixelAdjustment", '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The workspace which contains wavelength- and pixel-specific adjustments.')

        self.declareProperty('OutputParts', defaultValue=False,
                             direction=Direction.Input,
                             doc='Set to true to output two additional workspaces which will have the names '
                                 'OutputWorkspace_sumOfCounts OutputWorkspace_sumOfNormFactors. The division '
                                 'of _sumOfCounts and _sumOfNormFactors equals the workspace returned by the '
                                 'property OutputWorkspace (default is false).')

        # ----------
        # Output
        # ----------
        self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Output),
                             doc="The reduced workspace")
Exemplo n.º 12
0
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        # State
        self.declareProperty(PropertyManagerProperty('SANSState'),
                             doc='A property manager which fulfills the SANSState contract.')

        # Main workspace
        workspace_validator = CompositeValidator()
        workspace_validator.add(WorkspaceUnitValidator("Wavelength"))
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The main input workspace.')

        # Adjustment workspaces
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspaceWavelengthAdjustment", '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The workspace which contains only wavelength-specific adjustments, ie which affects '
                                 'all spectra equally.')
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspacePixelAdjustment", '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input),
                             doc='The workspace which contains only pixel-specific adjustments, ie which affects '
                                 'all bins within a spectrum equally.')
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspaceWavelengthAndPixelAdjustment", '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The workspace which contains wavelength- and pixel-specific adjustments.')

        self.declareProperty('OutputParts', defaultValue=False,
                             direction=Direction.Input,
                             doc='Set to true to output two additional workspaces which will have the names '
                                 'OutputWorkspace_sumOfCounts OutputWorkspace_sumOfNormFactors. The division '
                                 'of _sumOfCounts and _sumOfNormFactors equals the workspace returned by the '
                                 'property OutputWorkspace (default is false).')

        # ----------
        # Output
        # ----------
        self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Output),
                             doc="The reduced workspace")
Exemplo n.º 13
0
    def PyInit(self):

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

        self.declareProperty(name='NormaliseTo',
                             defaultValue='Monitor',
                             validator=StringListValidator(['None', 'Monitor']),
                             doc='Normalise to monitor, or skip normalisation.')

        self.declareProperty(FileProperty('CalibrationFile', '', action=FileAction.OptionalLoad, extensions=['nxs']),
                             doc='File containing the detector efficiencies.')

        self.declareProperty(name='UseCalibratedData',
                             defaultValue=True,
                             doc='Whether or not to use the calibrated data in the NeXus files.')

        self.declareProperty(name='Output2DTubes',
                             defaultValue=False,
                             doc='Output a 2D workspace of height along tube against tube scattering angle.')

        self.declareProperty(name='Output2D',
                             defaultValue=False,
                             doc='Output a 2D workspace of height along tube against the real scattering angle.')

        self.declareProperty(name='Output1D',
                             defaultValue=True,
                             doc='Output a 1D workspace with counts against scattering angle.')

        self.declareProperty(name='CropNegativeScatteringAngles', defaultValue=True,
                             doc='Whether or not to crop the negative scattering angles.')

        self.declareProperty(FloatArrayProperty(name='HeightRange', values=[],
                                                validator=CompositeValidator([FloatArrayOrderedPairsValidator(),
                                                                              FloatArrayLengthValidator(0, 2)])),
                             doc='A pair of values, comma separated, to give the minimum and maximum height range (in m). If not specified '
                                 'the full height range is used.')

        self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '',
                                                    direction=Direction.Output),
                             doc='Output workspace containing the reduced data.')

        self.declareProperty(name='InitialMask', defaultValue=20, validator=IntBoundedValidator(lower=0, upper=64),
                             doc='Number of pixels to mask from the bottom and the top of each tube before superposition.')

        self.declareProperty(name='FinalMask', defaultValue=30, validator=IntBoundedValidator(lower=0, upper=70),
                             doc='Number of spectra to mask from the bottom and the top of the result of 2D options.')

        self.declareProperty(name='ComponentsToMask', defaultValue='',
                             doc='Comma separated list of component names to mask, for instance: tube_1, tube_2')

        self.declareProperty(name='ComponentsToReduce', defaultValue='',
                             doc='Comma separated list of component names to output the reduced data for; for example tube_1')

        self.declareProperty(name='AlignTubes', defaultValue=True,
                             doc='Align the tubes vertically and horizontally according to IPF.')
    def PyInit(self):
        ws_validator = CompositeValidator([WorkspaceUnitValidator('Wavelength'), InstrumentValidator()])

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

        self.declareProperty(name='SampleChemicalFormula', defaultValue='',
                             validator=StringMandatoryValidator(),
                             doc='Sample chemical formula')
        self.declareProperty(name='SampleNumberDensity', defaultValue=0.1,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample number density in atoms/Angstrom3')
        self.declareProperty(name='SampleThickness', defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample thickness in cm')
        self.declareProperty(name='SampleAngle', defaultValue=0.0,
                             doc='Sample angle in degrees')

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

        self.declareProperty(name='CanChemicalFormula', defaultValue='',
                             doc='Container chemical formula')
        self.declareProperty(name='CanNumberDensity', defaultValue=0.1,
                             validator=FloatBoundedValidator(0.0),
                             doc='Container number density in atoms/Angstrom3')

        self.declareProperty(name='CanFrontThickness', defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Container front thickness in cm')
        self.declareProperty(name='CanBackThickness', defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Container back thickness in cm')

        self.declareProperty(name='NumberWavelengths', defaultValue=10,
                             validator=IntBoundedValidator(1),
                             doc='Number of wavelengths for calculation')
        self.declareProperty(name='Interpolate', defaultValue=True,
                             doc='Interpolate the correction workspaces to match the sample workspace')

        self.declareProperty(name='Emode', defaultValue='Elastic',
                             validator=StringListValidator(['Elastic', 'Indirect']),
                             doc='Emode: Elastic or Indirect')
        self.declareProperty(name='Efixed', defaultValue=1.0,
                             doc='Analyser energy')

        self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '',
                                                    direction=Direction.Output),
                             doc='The output corrections workspace group')
Exemplo n.º 15
0
 def PyInit(self):
     validators = CompositeValidator()
     validators.add(HistogramValidator(True))
     validators.add(CommonBinsValidator())
     self.declareProperty(MatrixWorkspaceProperty(name='InputWorkspace', defaultValue='', direction=Direction.Input, validator=validators),
                          doc='Input MatrixWorkspace containing the reduced inelastic neutron spectrum in (Q,E) space.')
     self.declareProperty(name='Temperature', defaultValue=300., validator=FloatBoundedValidator(lower=0),
                          doc='Sample temperature in Kelvin.')
     self.declareProperty(name='MeanSquareDisplacement', defaultValue=0., validator=FloatBoundedValidator(lower=0),
                          doc='Average mean square displacement in Angstrom^2.')
     self.declareProperty(name='QSumRange', defaultValue='0,Qmax',
                          doc='Range in Q (in Angstroms^-1) to sum data over.')
     self.declareProperty(name='EnergyBinning', defaultValue='0,Emax/50,Emax*0.9',
                          doc='Energy binning parameters [Emin, Estep, Emax] in meV.')
     self.declareProperty(name='Wavenumbers', defaultValue=False,
                          doc='Should the output be in Wavenumbers (cm^-1)?')
     self.declareProperty(name='StatesPerEnergy', defaultValue=False,
                          doc='Should the output be in states per unit energy rather than mb/sr/fu/energy?\n'+
                          '(Only for pure elements, need to set the sample material information)')
     self.declareProperty(MatrixWorkspaceProperty(name='OutputWorkspace', defaultValue='', direction=Direction.Output),
                          doc='Output workspace name.')
Exemplo n.º 16
0
 def _declareRunProperties(self):
     mandatoryInputRuns = CompositeValidator()
     mandatoryInputRuns.add(StringArrayMandatoryValidator())
     lenValidator = StringArrayLengthValidator()
     lenValidator.setLengthMin(1)
     mandatoryInputRuns.add(lenValidator)
     # Add property for the input runs
     self.declareProperty(
         StringArrayProperty(Prop.RUNS,
                             values=[],
                             validator=mandatoryInputRuns),
         doc='A list of run numbers or workspace names for the input runs. '
         'Multiple runs will be summed before reduction.')
     # Add properties from child algorithm
     properties = [
         'ThetaIn',
         'ThetaLogName',
     ]
     self.copyProperties('ReflectometryReductionOneAuto', properties)
     self._reduction_properties += properties
     # Add properties for settings to apply to input runs
     self.declareProperty(
         Prop.RELOAD,
         True,
         doc=
         'If true, reload input workspaces if they are of the incorrect type'
     )
     self.declareProperty(Prop.GROUP_TOF,
                          True,
                          doc='If true, group the TOF workspaces')
 def _get_input_runs_validator():
     mandatoryInputRuns = CompositeValidator()
     mandatoryInputRuns.add(StringArrayMandatoryValidator())
     lenValidator = StringArrayLengthValidator()
     lenValidator.setLengthMin(1)
     mandatoryInputRuns.add(lenValidator)
     return mandatoryInputRuns
 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     mandatoryInputWorkspaces = CompositeValidator()
     mandatoryInputWorkspaces.add(StringArrayMandatoryValidator())
     mandatoryInputWorkspaces.add(StringArrayLengthValidator(1, 4))
     self.declareProperty(
         StringArrayProperty(Prop.INPUT_WS,
                             values=[],
                             validator=mandatoryInputWorkspaces),
         doc='A set of polarized workspaces, in wavelength.')
     self.declareProperty(
         WorkspaceGroupProperty(Prop.OUTPUT_WS,
                                defaultValue='',
                                direction=Direction.Output),
         doc='A group of polarization efficiency corrected workspaces.')
     self.declareProperty(Prop.SUBALG_LOGGING,
                          defaultValue=SubalgLogging.OFF,
                          validator=StringListValidator(
                              [SubalgLogging.OFF, SubalgLogging.ON]),
                          doc='Enable or disable child algorithm logging.')
     self.declareProperty(
         Prop.CLEANUP,
         defaultValue=utils.Cleanup.ON,
         validator=StringListValidator(
             [utils.Cleanup.ON, utils.Cleanup.OFF]),
         doc='Enable or disable intermediate workspace cleanup.')
     self.declareProperty(
         FileProperty(Prop.EFFICIENCY_FILE,
                      defaultValue='',
                      action=FileAction.Load),
         doc='A file containing the polarization efficiency factors.')
Exemplo n.º 19
0
    def PyInit(self):

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

        self.declareProperty(
            name='NormaliseTo',
            defaultValue='Monitor',
            validator=StringListValidator(['None', 'Monitor']),
            doc='Normalise to monitor, or skip normalisation.')

        self.declareProperty(
            name='UseCalibratedData',
            defaultValue=True,
            doc='Whether or not to use the calibrated data in the NeXus files.'
        )

        self.declareProperty(
            name='Output2DTubes',
            defaultValue=False,
            doc=
            'Output a 2D workspace of height along tube against tube scattering angle.'
        )

        self.declareProperty(
            name='Output2D',
            defaultValue=False,
            doc=
            'Output a 2D workspace of height along tube against the real scattering angle.'
        )

        self.declareProperty(
            name='Output1D',
            defaultValue=True,
            doc='Output a 1D workspace with counts against scattering angle.')

        self.declareProperty(
            FloatArrayProperty(name='HeightRange',
                               values=[],
                               validator=CompositeValidator([
                                   FloatArrayOrderedPairsValidator(),
                                   FloatArrayLengthValidator(0, 2)
                               ])),
            doc=
            'A pair of values, comma separated, to give the minimum and maximum height range (in m). If not specified '
            'the full height range is used.')

        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspace',
                                   '',
                                   direction=Direction.Output),
            doc='Output workspace containing the reduced data.')
Exemplo n.º 20
0
    def PyInit(self):
        ws_validator = CompositeValidator([WorkspaceUnitValidator('Wavelength'), InstrumentValidator()])

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

        self.declareProperty(name='SampleChemicalFormula', defaultValue='',
                             validator=StringMandatoryValidator(),
                             doc='Sample chemical formula')
        self.declareProperty(name='SampleNumberDensity', defaultValue=0.1,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample number density in atoms/Angstrom3')
        self.declareProperty(name='SampleInnerRadius', defaultValue=0.05,
                             doc='Sample inner radius')
        self.declareProperty(name='SampleOuterRadius', defaultValue=0.1,
                             doc='Sample outer radius')

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

        self.declareProperty(name='CanChemicalFormula', defaultValue='',
                             doc='Container chemical formula')
        self.declareProperty(name='CanNumberDensity', defaultValue=0.1,
                             validator=FloatBoundedValidator(0.0),
                             doc='Container number density in atoms/Angstrom3')
        self.declareProperty(name='CanOuterRadius', defaultValue=0.15,
                             doc='Can outer radius')

        self.declareProperty(name='BeamHeight', defaultValue=3.0,
                             doc='Height of the beam at the sample.')
        self.declareProperty(name='BeamWidth', defaultValue=2.0,
                             doc='Width of the beam at the sample.')

        self.declareProperty(name='StepSize', defaultValue=0.002,
                             doc='Step size for calculation')
        self.declareProperty(name='Interpolate', defaultValue=True,
                             doc='Interpolate the correction workspaces to match the sample workspace')

        self.declareProperty(name='Emode', defaultValue='Elastic',
                             validator=StringListValidator(['Elastic', 'Indirect']),
                             doc='Emode: Elastic or Indirect')
        self.declareProperty(name='Efixed', defaultValue=1.0,
                             doc='Analyser energy')

        self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '',
                                                    direction=Direction.Output),
                             doc='The output corrections workspace group')
Exemplo n.º 21
0
    def PyInit(self):
        """ Declare properties
        """
        validator = CompositeValidator()
        validator.add(WorkspaceUnitValidator("TOF"))
        validator.add(InstrumentValidator())

        self.declareProperty(
            MatrixWorkspaceProperty("InputWorkspace", "", direction=Direction.Input, validator=validator),
            doc="Input Sample workspace",
        )
        # Optional but required if tof_elastic must be taken from fitted Vanadium or sample data
        self.declareProperty(
            ITableWorkspaceProperty("EPPTable", "", direction=Direction.Input, optional=PropertyMode.Optional),
            "Input EPP table (optional). May be produced by FindEPP algorithm.",
        )
        self.declareProperty(
            WorkspaceProperty("OutputWorkspace", "", direction=Direction.Output),
            "Name of the workspace that will contain the result",
        )

        return
Exemplo n.º 22
0
    def PyInit(self):
        self.declareProperty(FileProperty('CalibrationRun', '', action=FileAction.Load, extensions=['nxs']),
                             doc='File path of calibration run. Must be a detector scan.')

        self.declareProperty(FileProperty('CalibrationFile', '', action=FileAction.OptionalLoad, extensions=['nxs']),
                             doc='Optional file containing previous calibration constants.')

        self.declareProperty(name='CalibrationMethod',
                             defaultValue='Median',
                             validator=StringListValidator(['Median', 'Mean', 'MostLikelyMean']),
                             doc='The method of how the calibration constant of a '
                                 'pixel relative to the neighbouring one is derived.')

        self.declareProperty(name='InterpolateOverlappingAngles', defaultValue=False,
                             doc='Wheter to interpolate 2theta values for overlapping regions between neighbouring cells.')

        self.declareProperty(name='NormaliseTo',
                             defaultValue='None',
                             validator=StringListValidator(['None', 'Monitor', 'ROI']),
                             doc='Normalise to time, monitor or ROI counts before deriving the calibration.')

        thetaRangeValidator = FloatArrayOrderedPairsValidator()

        self.declareProperty(FloatArrayProperty(name='ROI', values=[0,100.], validator=thetaRangeValidator),
                             doc='Regions of interest for normalisation [in scattering angle in degrees].')

        normaliseToROI = VisibleWhenProperty('NormaliseTo', PropertyCriterion.IsEqualTo, 'ROI')
        self.setPropertySettings('ROI', normaliseToROI)

        self.declareProperty(FloatArrayProperty(name='ExcludedRange', values=[], validator=thetaRangeValidator),
                             doc='2theta regions to exclude from the computation of relative calibration constants '
                                 '[in scattering angle in degrees]. ')

        pixelRangeValidator = CompositeValidator()
        greaterThanOne = IntArrayBoundedValidator()
        greaterThanOne.setLower(1)
        lengthTwo = IntArrayLengthValidator()
        lengthTwo.setLength(2)
        orderedPairsValidator = IntArrayOrderedPairsValidator()
        pixelRangeValidator.add(greaterThanOne)
        pixelRangeValidator.add(lengthTwo)
        pixelRangeValidator.add(orderedPairsValidator)

        self.declareProperty(IntArrayProperty(name='PixelRange', values=[1,3072], validator=pixelRangeValidator),
                             doc='Range of the pixel numbers to compute the calibration factors for. '
                                 'For the other pixels outside the range, the factor will be set to 1.')

        self.declareProperty(MatrixWorkspaceProperty('OutputResponseWorkspace', '',
                                                     optional=PropertyMode.Optional, direction=Direction.Output),
                             doc='Output workspace containing the summed diffraction patterns of all the pixels.')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace', '',
                                                     direction=Direction.Output),
                             doc='Output workspace containing the detector efficiencies for each pixel.')
Exemplo n.º 23
0
 def test_creation_with_add_succeeds_correctly_in_algorithm(self):
     """
         Tests that a composite validator created with the add
         method validates correctly
     """
     validation = CompositeValidator()
     validation.add(FloatBoundedValidator(lower=5))
     validation.add(FloatBoundedValidator(upper=10))
     self._do_validation_test(validation)
Exemplo n.º 24
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))
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))
        mustBePositive = FloatBoundedValidator(lower=0)

        # Properties.
        self.declareProperty(
            MatrixWorkspaceProperty(name=common.PROP_INPUT_WS,
                                    defaultValue='',
                                    validator=inputWorkspaceValidator,
                                    direction=Direction.Input),
            doc='A workspace to which to apply the corrections.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='The corrected workspace.')
        self.declareProperty(name=common.PROP_CLEANUP_MODE,
                             defaultValue=utils.Cleanup.ON,
                             validator=StringListValidator(
                                 [utils.Cleanup.ON, utils.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(
            MatrixWorkspaceProperty(name=common.PROP_EC_WS,
                                    defaultValue='',
                                    validator=inputWorkspaceValidator,
                                    direction=Direction.Input,
                                    optional=PropertyMode.Optional),
            doc=
            'An empty container workspace for subtraction from the input workspace.'
        )
        self.declareProperty(
            name=common.PROP_EC_SCALING,
            defaultValue=1.0,
            validator=mustBePositive,
            direction=Direction.Input,
            doc=
            'A multiplier (transmission, if no self shielding is applied) for the empty container.'
        )
        self.declareProperty(
            MatrixWorkspaceProperty(
                name=common.PROP_SELF_SHIELDING_CORRECTION_WS,
                defaultValue='',
                direction=Direction.Input,
                optional=PropertyMode.Optional),
            doc='A workspace containing the self shielding correction factors.'
        )
    def PyInit(self):
        """Initialize the input and output properties of the algorithm."""
        threeNonnegativeInts = CompositeValidator()
        threeNonnegativeInts.add(IntArrayLengthValidator(3))
        nonnegativeInts = IntArrayBoundedValidator()
        nonnegativeInts.setLower(0)
        threeNonnegativeInts.add(nonnegativeInts)

        self.declareProperty(
            MatrixWorkspaceProperty(
                Prop.INPUT_WS,
                defaultValue='',
                direction=Direction.Input,
                validator=WorkspaceUnitValidator('Wavelength')),
            doc='An input workspace (units wavelength) to be integrated.')
        self.declareProperty(
            MatrixWorkspaceProperty(Prop.OUTPUT_WS,
                                    defaultValue='',
                                    direction=Direction.Output),
            doc='The integrated foreground divided by the summed direct beam.')
        self.declareProperty(Prop.SUBALG_LOGGING,
                             defaultValue=SubalgLogging.OFF,
                             validator=StringListValidator(
                                 [SubalgLogging.OFF, SubalgLogging.ON]),
                             doc='Enable or disable child algorithm logging.')
        self.declareProperty(
            Prop.CLEANUP,
            defaultValue=common.WSCleanup.ON,
            validator=StringListValidator(
                [common.WSCleanup.ON, common.WSCleanup.OFF]),
            doc='Enable or disable intermediate workspace cleanup.')
        self.declareProperty(Prop.SUM_TYPE,
                             defaultValue=SumType.IN_LAMBDA,
                             validator=StringListValidator(
                                 [SumType.IN_LAMBDA, SumType.IN_Q]),
                             doc='Type of summation to perform.')
        self.declareProperty(
            MatrixWorkspaceProperty(
                Prop.DIRECT_FOREGROUND_WS,
                defaultValue='',
                direction=Direction.Input,
                optional=PropertyMode.Optional,
                validator=WorkspaceUnitValidator('Wavelength')),
            doc=
            'Summed direct beam workspace if output in reflectivity is required.'
        )
        self.declareProperty(
            IntArrayProperty(Prop.FOREGROUND_INDICES,
                             values=[
                                 Property.EMPTY_INT, Property.EMPTY_INT,
                                 Property.EMPTY_INT
                             ],
                             validator=threeNonnegativeInts),
            doc=
            'A three element array of foreground start, centre and end workspace indices.'
        )
Exemplo n.º 27
0
    def PyInit(self):
        validator = CompositeValidator()
        validator.add(WorkspaceUnitValidator('Wavelength'))
        validator.add(HistogramValidator())
        validator.add(InstrumentValidator())

        self.declareProperty(MatrixWorkspaceProperty('InputWorkspace', defaultValue='',
                                                     validator = validator,
                                                     direction = Direction.Input),
                             doc='The input workspace in wavelength')

        self.declareProperty('BeamRadius', 0.1, FloatBoundedValidator(lower=0.), 'The radius of the beam [m]')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace',
                                                     defaultValue='',
                                                     direction = Direction.Output),
                             doc='The output workspace')
 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     mandatoryInputRuns = CompositeValidator()
     mandatoryInputRuns.add(StringArrayMandatoryValidator())
     lenValidator = StringArrayLengthValidator()
     lenValidator.setLengthMin(1)
     mandatoryInputRuns.add(lenValidator)
     self.declareProperty(
         StringArrayProperty(Prop.RUNS,
                             values=[],
                             validator=mandatoryInputRuns),
         doc='A list of run numbers or workspace names for the input runs. '
         'Multiple runs will be summed before reduction.')
     self.declareProperty(
         StringArrayProperty(Prop.FIRST_TRANS_RUNS, values=[]),
         doc=
         'A list of run numbers or workspace names for the first transmission run. '
         'Multiple runs will be summed before reduction.')
     self.declareProperty(
         StringArrayProperty(Prop.SECOND_TRANS_RUNS, values=[]),
         doc=
         'A list of run numbers or workspace names for the second transmission run. '
         'Multiple runs will be summed before reduction.')
     self._declareSliceAlgorithmProperties()
     self._declareReductionAlgorithmProperties()
     self.declareProperty(Prop.GROUP_TOF,
                          True,
                          doc='If true, group the input TOF workspace')
     self.declareProperty(
         Prop.RELOAD,
         True,
         doc=
         'If true, reload input workspaces if they are of the incorrect type'
     )
     self.declareProperty(
         WorkspaceProperty(Prop.OUTPUT_WS,
                           '',
                           optional=PropertyMode.Optional,
                           direction=Direction.Output),
         doc='The output workspace, or workspace group if sliced.')
     self.declareProperty(
         WorkspaceProperty(Prop.OUTPUT_WS_BINNED,
                           '',
                           optional=PropertyMode.Optional,
                           direction=Direction.Output),
         doc='The binned output workspace, or workspace group if sliced.')
     self.declareProperty(
         WorkspaceProperty(Prop.OUTPUT_WS_LAM,
                           '',
                           optional=PropertyMode.Optional,
                           direction=Direction.Output),
         doc=
         'The output workspace in wavelength, or workspace group if sliced.'
     )
Exemplo n.º 29
0
 def PyInit(self):
     validators = CompositeValidator()
     validators.add(HistogramValidator(True))
     validators.add(CommonBinsValidator())
     self.declareProperty(
         MatrixWorkspaceProperty(name='InputWorkspace',
                                 defaultValue='',
                                 direction=Direction.Input,
                                 validator=validators),
         doc=
         'Input MatrixWorkspace containing the reduced inelastic neutron spectrum in (Q,E) or (2theta,E) space.'
     )
     self.declareProperty(name='Temperature',
                          defaultValue=300.,
                          validator=FloatBoundedValidator(lower=0),
                          doc='Sample temperature in Kelvin.')
     self.declareProperty(
         name='MeanSquareDisplacement',
         defaultValue=0.,
         validator=FloatBoundedValidator(lower=0),
         doc='Average mean square displacement in Angstrom^2.')
     self.declareProperty(
         name='QSumRange',
         defaultValue='0,Qmax',
         doc='Range in Q (in Angstroms^-1) to sum data over.')
     self.declareProperty(
         name='EnergyBinning',
         defaultValue='0,Emax/50,Emax*0.9',
         doc=
         'Energy binning parameters [Emin, Emax] or [Emin, Estep, Emax] in meV.'
     )
     self.declareProperty(
         name='Wavenumbers',
         defaultValue=False,
         doc='Should the output be in Wavenumbers (cm^-1)?')
     self.declareProperty(
         name='StatesPerEnergy',
         defaultValue=False,
         doc=
         'Should the output be in states per unit energy rather than mb/sr/fu/energy?\n'
         +
         '(Only for pure elements, need to set the sample material information)'
     )
     self.declareProperty(MatrixWorkspaceProperty(
         name='OutputWorkspace',
         defaultValue='',
         direction=Direction.Output),
                          doc='Output workspace name.')
     self.declareProperty(
         name='TwoThetaSumRange',
         defaultValue='Twothetamin, Twothetamax',
         doc='Range in 2theta (in degrees) to sum data over.')
Exemplo n.º 30
0
    def PyInit(self):
        """Declare properties
        """
        wsValidators = CompositeValidator()
        # X axis must be a NumericAxis in energy transfer units.
        wsValidators.add(WorkspaceUnitValidator("DeltaE"))
        # Workspace must have an Instrument
        wsValidators.add(InstrumentValidator())

        self.declareProperty(MatrixWorkspaceProperty(name="InputWorkspace", defaultValue="", direction=Direction.Input,
                             validator=wsValidators), doc="Workspace name for input")
        self.declareProperty(FileProperty(name="Filename", defaultValue="", action=FileAction.Save, extensions=""),
                             doc="The name to use when writing the file")
Exemplo n.º 31
0
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))
        scalingFactor = FloatBoundedValidator(lower=0, upper=1)

        # Properties.
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            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(MatrixWorkspaceProperty(
            name=common.PROP_EC_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input,
            optional=PropertyMode.Optional),
                             doc='Reduced empty container workspace.')
        self.declareProperty(name=common.PROP_EC_SCALING,
                             defaultValue=1.0,
                             validator=scalingFactor,
                             direction=Direction.Input,
                             doc='Scaling factor (transmission, if no self ' +
                             'shielding is applied) for empty container.')
        self.declareProperty(
            MatrixWorkspaceProperty(
                name=common.PROP_SELF_SHIELDING_CORRECTION_WS,
                defaultValue='',
                direction=Direction.Input,
                optional=PropertyMode.Optional),
            doc='A workspace containing self shielding correction factors.')
Exemplo n.º 32
0
    def test_composite_validator_with_or_relation(self):
        validation = CompositeValidator([FloatBoundedValidator(lower=5, upper=10),
                                         FloatBoundedValidator(lower=15, upper=20)],
                                        relation=CompositeRelation.OR)

        test_alg = self._create_test_algorithm(validation)

        prop = test_alg.getProperty("Input")
        self.assertNotEquals(prop.isValid, "")

        test_alg.setProperty("Input", 6.8)
        self.assertEqual(prop.isValid, "")

        test_alg.setProperty("Input", 17.3)
        self.assertEqual(prop.isValid, "")

        self.assertRaises(ValueError, test_alg.setProperty, "Input", 3.0)
        self.assertRaises(ValueError, test_alg.setProperty, "Input", 13.0)
        self.assertRaises(ValueError, test_alg.setProperty, "Input", 23.0)
Exemplo n.º 33
0
 def PyInit(self):
     """ Declare properties
     """
     validator = CompositeValidator()
     validator.add(WorkspaceUnitValidator("TOF"))
     validator.add(InstrumentValidator())
     self.declareProperty(MatrixWorkspaceProperty("InputWorkspace",
                                                  "",
                                                  direction=Direction.Input,
                                                  validator=validator),
                          doc="Input workspace.")
     self.declareProperty(
         ITableWorkspaceProperty("EPPTable", "", direction=Direction.Input),
         doc="Input EPP table. May be produced by FindEPP algorithm.")
     self.declareProperty(
         MatrixWorkspaceProperty("OutputWorkspace",
                                 "",
                                 direction=Direction.Output),
         doc="Name of the workspace that will contain the results")
     return
Exemplo n.º 34
0
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        PROPGROUP_FLAT_BKG = 'Flat Time-Independent Background'
        PROPGROUP_INCIDENT_ENERGY_CALIBRATION = 'Indicent Energy Calibration'
        PROPGROUP_MON_NORMALISATION = 'Neutron Flux Normalisation'
        # Validators.
        mandatoryPositiveInt = CompositeValidator()
        mandatoryPositiveInt.add(IntMandatoryValidator())
        mandatoryPositiveInt.add(IntBoundedValidator(lower=0))
        positiveFloat = FloatBoundedValidator(lower=0)
        positiveInt = IntBoundedValidator(lower=0)
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))

        # Properties.
        self.declareProperty(MultipleFileProperty(name=common.PROP_INPUT_FILE,
                                                  action=FileAction.OptionalLoad,
                                                  extensions=['nxs']),
                             doc='An input run number (or a list thereof) or a filename.')
        self.getProperty(common.PROP_INPUT_FILE).setAutoTrim(False)
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            optional=PropertyMode.Optional,
            direction=Direction.Input),
            doc='Input workspace if no run is given.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='A flux normalized and background subtracted workspace.')
        self.declareProperty(name=common.PROP_CLEANUP_MODE,
                             defaultValue=utils.Cleanup.ON,
                             validator=StringListValidator([
                                 utils.Cleanup.ON,
                                 utils.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_EPP_METHOD,
                             defaultValue=common.EPP_METHOD_AUTO,
                             validator=StringListValidator([
                                 common.EPP_METHOD_AUTO,
                                 common.EPP_METHOD_FIT,
                                 common.EPP_METHOD_CALCULATE]),
                             direction=Direction.Input,
                             doc='Method to create the EPP table for detectors (monitor is awlays fitted).')
        self.declareProperty(name=common.PROP_EPP_SIGMA,
                             defaultValue=Property.EMPTY_DBL,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc='Nominal sigma for the EPP table when ' + common.PROP_EPP_METHOD
                                 + ' is set to ' + common.EPP_METHOD_CALCULATE
                                 + ' (default: 10 times the first bin width).')
        self.declareProperty(name=common.PROP_ELASTIC_CHANNEL_MODE,
                             defaultValue=common.ELASTIC_CHANNEL_AUTO,
                             validator=StringListValidator([
                                 common.ELASTIC_CHANNEL_AUTO,
                                 common.ELASTIC_CHANNEL_SAMPLE_LOG,
                                 common.ELASTIC_CHANNEL_FIT]),
                             direction=Direction.Input,
                             doc='How to acquire the nominal elastic channel.')
        self.declareProperty(MatrixWorkspaceProperty(
                             name=common.PROP_ELASTIC_CHANNEL_WS,
                             defaultValue='',
                             direction=Direction.Input,
                             optional=PropertyMode.Optional),
                             doc='A single value workspace containing the nominal elastic channel index'
                                 '(can be floating point). Overrides {}.'.format(common.PROP_ELASTIC_CHANNEL_MODE))
        self.declareProperty(name=common.PROP_MON_INDEX,
                             defaultValue=Property.EMPTY_INT,
                             validator=positiveInt,
                             direction=Direction.Input,
                             doc='Index of the incident monitor, if not specified in instrument parameters.')
        self.declareProperty(name=common.PROP_INCIDENT_ENERGY_CALIBRATION,
                             defaultValue=common.INCIDENT_ENERGY_CALIBRATION_AUTO,
                             validator=StringListValidator([
                                 common.INCIDENT_ENERGY_CALIBRATION_AUTO,
                                 common.INCIDENT_ENERGY_CALIBRATION_ON,
                                 common.INCIDENT_ENERGY_CALIBRATION_OFF]),
                             direction=Direction.Input,
                             doc='Control the incident energy calibration.')
        self.setPropertyGroup(common.PROP_INCIDENT_ENERGY_CALIBRATION, PROPGROUP_INCIDENT_ENERGY_CALIBRATION)
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INCIDENT_ENERGY_WS,
            defaultValue='',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
            doc='A single-valued workspace holding a previously determined ' + 'incident energy.')
        self.setPropertyGroup(common.PROP_INCIDENT_ENERGY_WS, PROPGROUP_INCIDENT_ENERGY_CALIBRATION)
        self.declareProperty(name=common.PROP_FLAT_BKG,
                             defaultValue=common.BKG_AUTO,
                             validator=StringListValidator([
                                 common.BKG_AUTO,
                                 common.BKG_ON,
                                 common.BKG_OFF]),
                             direction=Direction.Input,
                             doc='Control flat background subtraction.')
        self.setPropertyGroup(common.PROP_FLAT_BKG, PROPGROUP_FLAT_BKG)
        self.declareProperty(name=common.PROP_FLAT_BKG_SCALING,
                             defaultValue=1.0,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc='Flat background multiplication factor.')
        self.setPropertyGroup(common.PROP_FLAT_BKG_SCALING, PROPGROUP_FLAT_BKG)
        self.declareProperty(name=common.PROP_FLAT_BKG_WINDOW,
                             defaultValue=30,
                             validator=mandatoryPositiveInt,
                             direction=Direction.Input,
                             doc='Running average window width (in bins) for flat background.')
        self.setPropertyGroup(common.PROP_FLAT_BKG_WINDOW, PROPGROUP_FLAT_BKG)
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_FLAT_BKG_WS,
            defaultValue='',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
            doc='Workspace with previously determined flat background data.')
        self.setPropertyGroup(common.PROP_FLAT_BKG_WS, PROPGROUP_FLAT_BKG)
        self.declareProperty(name=common.PROP_DET_HOR_GROUPING,
                             defaultValue=1,
                             doc='Step to use when grouping detectors horizontally (between tubes) to increase'
                                 ' the statistics for flat background calculation.')
        self.setPropertyGroup(common.PROP_DET_HOR_GROUPING, PROPGROUP_FLAT_BKG)
        self.declareProperty(name=common.PROP_DET_VER_GROUPING,
                             defaultValue=1,
                             doc='Step to use when grouping detectors vertically (inside the same tube)'
                                 ' to increase the statistics for flat background calculation.')
        self.setPropertyGroup(common.PROP_DET_VER_GROUPING, PROPGROUP_FLAT_BKG)
        self.declareProperty(name=common.PROP_NORMALISATION,
                             defaultValue=common.NORM_METHOD_MON,
                             validator=StringListValidator([
                                 common.NORM_METHOD_MON,
                                 common.NORM_METHOD_TIME,
                                 common.NORM_METHOD_OFF]),
                             direction=Direction.Input,
                             doc='Normalisation method.')
        self.setPropertyGroup(common.PROP_NORMALISATION, PROPGROUP_MON_NORMALISATION)
        self.declareProperty(name=common.PROP_MON_PEAK_SIGMA_MULTIPLIER,
                             defaultValue=7.0,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc="Width of the monitor peak in multiples " + " of 'Sigma' in monitor's EPP table.")
        self.setPropertyGroup(common.PROP_MON_PEAK_SIGMA_MULTIPLIER, PROPGROUP_MON_NORMALISATION)
        # Rest of the output properties.
        self.declareProperty(WorkspaceProperty(
            name=common.PROP_OUTPUT_RAW_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Non-normalized and non-background subtracted output workspace for DirectILLDiagnostics.')
        self.setPropertyGroup(common.PROP_OUTPUT_RAW_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
        self.declareProperty(WorkspaceProperty(
            name=common.PROP_OUTPUT_ELASTIC_CHANNEL_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Output workspace for elastic channel index.')
        self.setPropertyGroup(common.PROP_OUTPUT_ELASTIC_CHANNEL_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
        self.declareProperty(ITableWorkspaceProperty(
            name=common.PROP_OUTPUT_DET_EPP_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Output workspace for elastic peak positions.')
        self.setPropertyGroup(common.PROP_OUTPUT_DET_EPP_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
        self.declareProperty(WorkspaceProperty(
            name=common.PROP_OUTPUT_INCIDENT_ENERGY_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Output workspace for calibrated incident energy.')
        self.setPropertyGroup(common.PROP_OUTPUT_INCIDENT_ENERGY_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
        self.declareProperty(WorkspaceProperty(
            name=common.PROP_OUTPUT_FLAT_BKG_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Output workspace for flat background.')
        self.setPropertyGroup(common.PROP_OUTPUT_FLAT_BKG_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
Exemplo n.º 35
0
 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     nonnegativeInt = IntBoundedValidator(lower=0)
     wsIndexRange = IntBoundedValidator(lower=0, upper=255)
     nonnegativeIntArray = IntArrayBoundedValidator(lower=0)
     maxTwoNonnegativeInts = CompositeValidator()
     maxTwoNonnegativeInts.add(IntArrayLengthValidator(lenmin=0, lenmax=2))
     maxTwoNonnegativeInts.add(nonnegativeIntArray)
     self.declareProperty(MultipleFileProperty(
         Prop.RUN, action=FileAction.OptionalLoad, extensions=['nxs']),
                          doc='A list of input run numbers/files.')
     self.declareProperty(
         MatrixWorkspaceProperty(Prop.INPUT_WS,
                                 defaultValue='',
                                 direction=Direction.Input,
                                 validator=WorkspaceUnitValidator('TOF'),
                                 optional=PropertyMode.Optional),
         doc='An input workspace (units TOF) if no Run is specified.')
     self.declareProperty(
         MatrixWorkspaceProperty(Prop.OUTPUT_WS,
                                 defaultValue='',
                                 direction=Direction.Output),
         doc=
         'The preprocessed output workspace (unit wavelength), single histogram.'
     )
     self.declareProperty(
         Prop.TWO_THETA,
         defaultValue=Property.EMPTY_DBL,
         doc='A user-defined scattering angle 2 theta (unit degrees).')
     self.declareProperty(
         name=Prop.LINE_POSITION,
         defaultValue=Property.EMPTY_DBL,
         doc=
         'A workspace index corresponding to the beam centre between 0.0 and 255.0.'
     )
     self.declareProperty(MatrixWorkspaceProperty(
         Prop.DIRECT_LINE_WORKSPACE,
         defaultValue='',
         direction=Direction.Input,
         optional=PropertyMode.Optional),
                          doc='A pre-processed direct beam workspace.')
     self.declareProperty(Prop.SUBALG_LOGGING,
                          defaultValue=SubalgLogging.OFF,
                          validator=StringListValidator(
                              [SubalgLogging.OFF, SubalgLogging.ON]),
                          doc='Enable or disable child algorithm logging.')
     self.declareProperty(
         Prop.CLEANUP,
         defaultValue=utils.Cleanup.ON,
         validator=StringListValidator(
             [utils.Cleanup.ON, utils.Cleanup.OFF]),
         doc='Enable or disable intermediate workspace cleanup.')
     self.declareProperty(MatrixWorkspaceProperty(
         Prop.WATER_REFERENCE,
         defaultValue='',
         direction=Direction.Input,
         validator=WorkspaceUnitValidator("TOF"),
         optional=PropertyMode.Optional),
                          doc='A (water) calibration workspace (unit TOF).')
     self.declareProperty(Prop.SLIT_NORM,
                          defaultValue=SlitNorm.OFF,
                          validator=StringListValidator(
                              [SlitNorm.OFF, SlitNorm.ON]),
                          doc='Enable or disable slit normalisation.')
     self.declareProperty(Prop.FLUX_NORM_METHOD,
                          defaultValue=FluxNormMethod.TIME,
                          validator=StringListValidator([
                              FluxNormMethod.TIME, FluxNormMethod.MONITOR,
                              FluxNormMethod.OFF
                          ]),
                          doc='Neutron flux normalisation method.')
     self.declareProperty(
         IntArrayProperty(Prop.FOREGROUND_HALF_WIDTH,
                          validator=maxTwoNonnegativeInts),
         doc=
         'Number of foreground pixels at lower and higher angles from the centre pixel.'
     )
     self.declareProperty(
         Prop.BKG_METHOD,
         defaultValue=BkgMethod.CONSTANT,
         validator=StringListValidator(
             [BkgMethod.CONSTANT, BkgMethod.LINEAR, BkgMethod.OFF]),
         doc='Flat background calculation method for background subtraction.'
     )
     self.declareProperty(
         Prop.LOW_BKG_OFFSET,
         defaultValue=7,
         validator=nonnegativeInt,
         doc=
         'Distance of flat background region towards smaller detector angles from the '
         + 'foreground centre, in pixels.')
     self.declareProperty(
         Prop.LOW_BKG_WIDTH,
         defaultValue=5,
         validator=nonnegativeInt,
         doc=
         'Width of flat background region towards smaller detector angles from the '
         + 'foreground centre, in pixels.')
     self.declareProperty(
         Prop.HIGH_BKG_OFFSET,
         defaultValue=7,
         validator=nonnegativeInt,
         doc=
         'Distance of flat background region towards larger detector angles from the '
         + 'foreground centre, in pixels.')
     self.declareProperty(
         Prop.HIGH_BKG_WIDTH,
         defaultValue=5,
         validator=nonnegativeInt,
         doc=
         'Width of flat background region towards larger detector angles from the '
         + 'foreground centre, in pixels.')
     self.declareProperty(
         Prop.START_WS_INDEX,
         validator=wsIndexRange,
         defaultValue=0,
         doc='Start workspace index used for peak fitting.')
     self.declareProperty(Prop.END_WS_INDEX,
                          validator=wsIndexRange,
                          defaultValue=255,
                          doc='Last workspace index used for peak fitting.')
     self.declareProperty(
         Prop.XMIN,
         defaultValue=Property.EMPTY_DBL,
         doc='Minimum x value (unit Angstrom) used for peak fitting.')
     self.declareProperty(
         Prop.XMAX,
         defaultValue=Property.EMPTY_DBL,
         doc='Maximum x value (unit Angstrom) used for peak fitting.')
 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     nonnegativeInt = IntBoundedValidator(lower=0)
     wsIndexRange = IntBoundedValidator(lower=0, upper=255)
     nonnegativeIntArray = IntArrayBoundedValidator(lower=0)
     maxTwoNonnegativeInts = CompositeValidator()
     maxTwoNonnegativeInts.add(IntArrayLengthValidator(lenmin=0, lenmax=2))
     maxTwoNonnegativeInts.add(nonnegativeIntArray)
     self.declareProperty(MultipleFileProperty(Prop.RUN,
                                               action=FileAction.OptionalLoad,
                                               extensions=['nxs']),
                          doc='A list of input run numbers/files.')
     self.declareProperty(MatrixWorkspaceProperty(Prop.INPUT_WS,
                                                  defaultValue='',
                                                  direction=Direction.Input,
                                                  validator=WorkspaceUnitValidator('TOF'),
                                                  optional=PropertyMode.Optional),
                          doc='An input workspace (units TOF) if no Run is specified.')
     self.declareProperty(MatrixWorkspaceProperty(Prop.OUTPUT_WS,
                                                  defaultValue='',
                                                  direction=Direction.Output),
                          doc='The preprocessed output workspace (unit wavelength), single histogram.')
     self.declareProperty(Prop.TWO_THETA,
                          defaultValue=Property.EMPTY_DBL,
                          doc='A user-defined scattering angle 2 theta (unit degrees).')
     self.declareProperty(name=Prop.LINE_POSITION,
                          defaultValue=Property.EMPTY_DBL,
                          doc='A workspace index corresponding to the beam centre between 0.0 and 255.0.')
     self.declareProperty(MatrixWorkspaceProperty(Prop.DIRECT_LINE_WORKSPACE,
                                                  defaultValue='',
                                                  direction=Direction.Input,
                                                  optional=PropertyMode.Optional),
                          doc='A pre-processed direct beam workspace.')
     self.declareProperty(Prop.SUBALG_LOGGING,
                          defaultValue=SubalgLogging.OFF,
                          validator=StringListValidator([SubalgLogging.OFF, SubalgLogging.ON]),
                          doc='Enable or disable child algorithm logging.')
     self.declareProperty(Prop.CLEANUP,
                          defaultValue=utils.Cleanup.ON,
                          validator=StringListValidator([utils.Cleanup.ON, utils.Cleanup.OFF]),
                          doc='Enable or disable intermediate workspace cleanup.')
     self.declareProperty(MatrixWorkspaceProperty(Prop.WATER_REFERENCE,
                                                  defaultValue='',
                                                  direction=Direction.Input,
                                                  validator=WorkspaceUnitValidator("TOF"),
                                                  optional=PropertyMode.Optional),
                          doc='A (water) calibration workspace (unit TOF).')
     self.declareProperty(Prop.SLIT_NORM,
                          defaultValue=SlitNorm.OFF,
                          validator=StringListValidator([SlitNorm.OFF, SlitNorm.ON]),
                          doc='Enable or disable slit normalisation.')
     self.declareProperty(Prop.FLUX_NORM_METHOD,
                          defaultValue=FluxNormMethod.TIME,
                          validator=StringListValidator([FluxNormMethod.TIME,
                                                         FluxNormMethod.MONITOR,
                                                         FluxNormMethod.OFF]),
                          doc='Neutron flux normalisation method.')
     self.declareProperty(IntArrayProperty(Prop.FOREGROUND_HALF_WIDTH,
                                           validator=maxTwoNonnegativeInts),
                          doc='Number of foreground pixels at lower and higher angles from the centre pixel.')
     self.declareProperty(Prop.BKG_METHOD,
                          defaultValue=BkgMethod.CONSTANT,
                          validator=StringListValidator([BkgMethod.CONSTANT, BkgMethod.LINEAR, BkgMethod.OFF]),
                          doc='Flat background calculation method for background subtraction.')
     self.declareProperty(Prop.LOW_BKG_OFFSET,
                          defaultValue=7,
                          validator=nonnegativeInt,
                          doc='Distance of flat background region towards smaller detector angles from the ' +
                              'foreground centre, in pixels.')
     self.declareProperty(Prop.LOW_BKG_WIDTH,
                          defaultValue=5,
                          validator=nonnegativeInt,
                          doc='Width of flat background region towards smaller detector angles from the ' +
                              'foreground centre, in pixels.')
     self.declareProperty(Prop.HIGH_BKG_OFFSET,
                          defaultValue=7,
                          validator=nonnegativeInt,
                          doc='Distance of flat background region towards larger detector angles from the ' +
                              'foreground centre, in pixels.')
     self.declareProperty(Prop.HIGH_BKG_WIDTH,
                          defaultValue=5,
                          validator=nonnegativeInt,
                          doc='Width of flat background region towards larger detector angles from the ' +
                              'foreground centre, in pixels.')
     self.declareProperty(Prop.START_WS_INDEX,
                          validator=wsIndexRange,
                          defaultValue=0,
                          doc='Start workspace index used for peak fitting.')
     self.declareProperty(Prop.END_WS_INDEX,
                          validator=wsIndexRange,
                          defaultValue=255,
                          doc='Last workspace index used for peak fitting.')
     self.declareProperty(Prop.XMIN,
                          defaultValue=Property.EMPTY_DBL,
                          doc='Minimum x value (unit Angstrom) used for peak fitting.')
     self.declareProperty(Prop.XMAX,
                          defaultValue=Property.EMPTY_DBL,
                          doc='Maximum x value (unit Angstrom) used for peak fitting.')
Exemplo n.º 37
0
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        PROPGROUP_REBINNING = 'Rebinning for SofQW'
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))

        # Properties.
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input),
            doc='A workspace to reduce.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='The reduced S(Q, DeltaE) workspace.')
        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(MatrixWorkspaceProperty(
            name=common.PROP_VANA_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input,
            optional=PropertyMode.Optional),
            doc='An integrated vanadium workspace.')
        self.declareProperty(name=common.PROP_ABSOLUTE_UNITS,
                             defaultValue=common.ABSOLUTE_UNITS_OFF,
                             validator=StringListValidator([
                                 common.ABSOLUTE_UNITS_OFF,
                                 common.ABSOLUTE_UNITS_ON]),
                             direction=Direction.Input,
                             doc='Enable or disable normalisation to absolute units.')
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_DIAGNOSTICS_WS,
            defaultValue='',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
            doc='Detector diagnostics workspace for masking.')
        self.declareProperty(FloatArrayProperty(name=common.PROP_REBINNING_PARAMS_W),
                             doc='Manual energy rebinning parameters.')
        self.setPropertyGroup(common.PROP_REBINNING_PARAMS_W, PROPGROUP_REBINNING)
        self.declareProperty(FloatArrayProperty(name=common.PROP_BINNING_PARAMS_Q),
                             doc='Manual q rebinning parameters.')
        self.setPropertyGroup(common.PROP_BINNING_PARAMS_Q, PROPGROUP_REBINNING)
        self.declareProperty(name=common.PROP_TRANSPOSE_SAMPLE_OUTPUT,
                             defaultValue=common.TRANSPOSING_ON,
                             validator=StringListValidator([
                                 common.TRANSPOSING_ON,
                                 common.TRANSPOSING_OFF]),
                             direction=Direction.Input,
                             doc='Enable or disable ' + common.PROP_OUTPUT_WS + ' transposing.')
        self.declareProperty(WorkspaceProperty(
            name=common.PROP_OUTPUT_THETA_W_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Output workspace for reduced S(theta, DeltaE).')
        self.setPropertyGroup(common.PROP_OUTPUT_THETA_W_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
Exemplo n.º 38
0
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        PROPGROUP_REBINNING = 'Rebinning for SofQW'
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))
        positiveFloat = FloatBoundedValidator(0., exclusive=True)
        validRebinParams = RebinParamsValidator(AllowEmpty=True)

        # Properties.
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input),
            doc='A workspace to reduce.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='The reduced S(Q, DeltaE) workspace.')
        self.declareProperty(name=common.PROP_CLEANUP_MODE,
                             defaultValue=utils.Cleanup.ON,
                             validator=StringListValidator([
                                 utils.Cleanup.ON,
                                 utils.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(MatrixWorkspaceProperty(
            name=common.PROP_VANA_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input,
            optional=PropertyMode.Optional),
            doc='An integrated vanadium workspace.')
        self.declareProperty(name=common.PROP_ABSOLUTE_UNITS,
                             defaultValue=common.ABSOLUTE_UNITS_OFF,
                             validator=StringListValidator([
                                 common.ABSOLUTE_UNITS_OFF,
                                 common.ABSOLUTE_UNITS_ON]),
                             direction=Direction.Input,
                             doc='Enable or disable normalisation to absolute units.')
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_DIAGNOSTICS_WS,
            defaultValue='',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
            doc='Detector diagnostics workspace for masking.')
        self.declareProperty(name=common.PROP_GROUPING_ANGLE_STEP,
                             defaultValue=Property.EMPTY_DBL,
                             validator=positiveFloat,
                             doc='A scattering angle step to which to group detectors, in degrees.')
        self.declareProperty(FloatArrayProperty(name=common.PROP_REBINNING_PARAMS_W, validator=validRebinParams),
                             doc='Manual energy rebinning parameters.')
        self.setPropertyGroup(common.PROP_REBINNING_PARAMS_W, PROPGROUP_REBINNING)
        self.declareProperty(name=common.PROP_REBINNING_W,
                             defaultValue='',
                             doc='Energy rebinning when mixing manual and automatic binning parameters.')
        self.declareProperty(FloatArrayProperty(name=common.PROP_BINNING_PARAMS_Q, validator=validRebinParams),
                             doc='Manual q rebinning parameters.')
        self.setPropertyGroup(common.PROP_BINNING_PARAMS_Q, PROPGROUP_REBINNING)
        self.declareProperty(name=common.PROP_TRANSPOSE_SAMPLE_OUTPUT,
                             defaultValue=common.TRANSPOSING_ON,
                             validator=StringListValidator([
                                 common.TRANSPOSING_ON,
                                 common.TRANSPOSING_OFF]),
                             direction=Direction.Input,
                             doc='Enable or disable ' + common.PROP_OUTPUT_WS + ' transposing.')
        self.declareProperty(WorkspaceProperty(
            name=common.PROP_OUTPUT_THETA_W_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Output workspace for reduced S(theta, DeltaE).')
        self.setPropertyGroup(common.PROP_OUTPUT_THETA_W_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
Exemplo n.º 39
0
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        PROPGROUP_BEAM_STOP_DIAGNOSTICS = 'Beam Stop Diagnostics'
        PROPGROUP_BKG_DIAGNOSTICS = 'Background Diagnostics'
        PROPGROUP_PEAK_DIAGNOSTICS = 'Elastic Peak Diagnostics'
        PROPGROUP_USER_MASK = 'Additional Masking'
        greaterThanUnityFloat = FloatBoundedValidator(lower=1)
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))
        positiveFloat = FloatBoundedValidator(lower=0)
        positiveIntArray = IntArrayBoundedValidator()
        positiveIntArray.setLower(0)
        scalingFactor = FloatBoundedValidator(lower=0, upper=1)

        # Properties.
        self.declareProperty(
            MatrixWorkspaceProperty(name=common.PROP_INPUT_WS,
                                    defaultValue='',
                                    validator=inputWorkspaceValidator,
                                    direction=Direction.Input),
            doc=
            "A 'raw' workspace from DirectILLCollectData to calculate the diagnostics from."
        )
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='A diagnostics mask workspace.')
        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.Optional),
            doc='Table workspace containing results from the FindEPP algorithm.'
        )
        self.declareProperty(name=common.PROP_ELASTIC_PEAK_DIAGNOSTICS,
                             defaultValue=common.ELASTIC_PEAK_DIAGNOSTICS_AUTO,
                             validator=StringListValidator([
                                 common.ELASTIC_PEAK_DIAGNOSTICS_AUTO,
                                 common.ELASTIC_PEAK_DIAGNOSTICS_ON,
                                 common.ELASTIC_PEAK_DIAGNOSTICS_OFF
                             ]),
                             direction=Direction.Input,
                             doc='Enable or disable elastic peak diagnostics.')
        self.setPropertyGroup(common.PROP_ELASTIC_PEAK_DIAGNOSTICS,
                              PROPGROUP_PEAK_DIAGNOSTICS)
        self.declareProperty(
            name=common.PROP_ELASTIC_PEAK_SIGMA_MULTIPLIER,
            defaultValue=3.0,
            validator=positiveFloat,
            direction=Direction.Input,
            doc="Integration half width of the elastic peak in multiples " +
            " of 'Sigma' in the EPP table.")
        self.setPropertyGroup(common.PROP_ELASTIC_PEAK_SIGMA_MULTIPLIER,
                              PROPGROUP_PEAK_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_PEAK_DIAGNOSTICS_LOW_THRESHOLD,
                             defaultValue=Property.EMPTY_DBL,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc='Multiplier for lower acceptance limit ' +
                             'used in elastic peak diagnostics.')
        self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_LOW_THRESHOLD,
                              PROPGROUP_PEAK_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_PEAK_DIAGNOSTICS_HIGH_THRESHOLD,
                             defaultValue=Property.EMPTY_DBL,
                             validator=greaterThanUnityFloat,
                             direction=Direction.Input,
                             doc='Multiplier for higher acceptance limit ' +
                             'used in elastic peak diagnostics.')
        self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_HIGH_THRESHOLD,
                              PROPGROUP_PEAK_DIAGNOSTICS)
        self.declareProperty(
            name=common.PROP_PEAK_DIAGNOSTICS_SIGNIFICANCE_TEST,
            defaultValue=Property.EMPTY_DBL,
            validator=positiveFloat,
            direction=Direction.Input,
            doc=
            'To fail the elastic peak diagnostics, the intensity must also exceed '
            +
            'this number of error bars with respect to the median intensity.')
        self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_SIGNIFICANCE_TEST,
                              PROPGROUP_PEAK_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS,
                             defaultValue=common.BKG_DIAGNOSTICS_AUTO,
                             validator=StringListValidator([
                                 common.BKG_DIAGNOSTICS_AUTO,
                                 common.BKG_DIAGNOSTICS_ON,
                                 common.BKG_DIAGNOSTICS_OFF
                             ]),
                             direction=Direction.Input,
                             doc='Control the background diagnostics.')
        self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS,
                              PROPGROUP_BKG_DIAGNOSTICS)
        self.declareProperty(
            name=common.PROP_BKG_SIGMA_MULTIPLIER,
            defaultValue=10.0,
            validator=positiveFloat,
            direction=Direction.Input,
            doc=
            "Width of the range excluded from background integration around " +
            "the elastic peaks in multiplies of 'Sigma' in the EPP table")
        self.setPropertyGroup(common.PROP_BKG_SIGMA_MULTIPLIER,
                              PROPGROUP_BKG_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS_LOW_THRESHOLD,
                             defaultValue=Property.EMPTY_DBL,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc='Multiplier for lower acceptance limit ' +
                             'used in noisy background diagnostics.')
        self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_LOW_THRESHOLD,
                              PROPGROUP_BKG_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS_HIGH_THRESHOLD,
                             defaultValue=Property.EMPTY_DBL,
                             validator=greaterThanUnityFloat,
                             direction=Direction.Input,
                             doc='Multiplier for higher acceptance limit ' +
                             'used in noisy background diagnostics.')
        self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_HIGH_THRESHOLD,
                              PROPGROUP_BKG_DIAGNOSTICS)
        self.declareProperty(
            name=common.PROP_BKG_DIAGNOSTICS_SIGNIFICANCE_TEST,
            defaultValue=Property.EMPTY_DBL,
            validator=positiveFloat,
            direction=Direction.Input,
            doc=
            'To fail the background diagnostics, the background level must also exceed '
            + 'this number of error bars with respect to the median level.')
        self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_SIGNIFICANCE_TEST,
                              PROPGROUP_BKG_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_BEAM_STOP_DIAGNOSTICS,
                             defaultValue=common.BEAM_STOP_DIAGNOSTICS_AUTO,
                             validator=StringListValidator([
                                 common.BEAM_STOP_DIAGNOSTICS_AUTO,
                                 common.BEAM_STOP_DIAGNOSTICS_ON,
                                 common.BEAM_STOP_DIAGNOSTICS_OFF
                             ]),
                             direction=Direction.Input,
                             doc='Control the beam stop diagnostics.')
        self.setPropertyGroup(common.PROP_BEAM_STOP_DIAGNOSTICS,
                              PROPGROUP_BEAM_STOP_DIAGNOSTICS)
        self.declareProperty(
            name=common.PROP_BEAM_STOP_THRESHOLD,
            defaultValue=0.67,
            validator=scalingFactor,
            direction=Direction.Input,
            doc=
            'Multiplier for the lower acceptance limit for beam stop diagnostics.'
        )
        self.setPropertyGroup(common.PROP_BEAM_STOP_THRESHOLD,
                              PROPGROUP_BEAM_STOP_DIAGNOSTICS)
        self.declareProperty(
            name=common.PROP_DEFAULT_MASK,
            defaultValue=common.DEFAULT_MASK_ON,
            validator=StringListValidator(
                [common.DEFAULT_MASK_ON, common.DEFAULT_MASK_OFF]),
            direction=Direction.Input,
            doc='Enable or disable instrument specific default mask.')
        self.declareProperty(IntArrayProperty(name=common.PROP_USER_MASK,
                                              values='',
                                              validator=positiveIntArray,
                                              direction=Direction.Input),
                             doc='List of spectra to mask.')
        self.setPropertyGroup(common.PROP_USER_MASK, PROPGROUP_USER_MASK)
        self.declareProperty(StringArrayProperty(
            name=common.PROP_USER_MASK_COMPONENTS,
            values='',
            direction=Direction.Input),
                             doc='List of instrument components to mask.')
        self.setPropertyGroup(common.PROP_USER_MASK_COMPONENTS,
                              PROPGROUP_USER_MASK)
        # Rest of the output properties
        self.declareProperty(
            ITableWorkspaceProperty(
                name=common.PROP_OUTPUT_DIAGNOSTICS_REPORT_WS,
                defaultValue='',
                direction=Direction.Output,
                optional=PropertyMode.Optional),
            doc='Output table workspace for detector diagnostics reporting.')
        self.setPropertyGroup(common.PROP_OUTPUT_DIAGNOSTICS_REPORT_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
        self.declareProperty(name=common.PROP_OUTPUT_DIAGNOSTICS_REPORT,
                             defaultValue='',
                             direction=Direction.Output,
                             doc='Diagnostics report as a string.')
        self.setPropertyGroup(common.PROP_OUTPUT_DIAGNOSTICS_REPORT,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
Exemplo n.º 40
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).'
        )
Exemplo n.º 41
0
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        PROPGROUP_BEAM_STOP_DIAGNOSTICS = 'Beam Stop Diagnostics'
        PROPGROUP_BKG_DIAGNOSTICS = 'Background Diagnostics'
        PROPGROUP_PEAK_DIAGNOSTICS = 'Elastic Peak Diagnostics'
        PROPGROUP_USER_MASK = 'Additional Masking'
        greaterThanUnityFloat = FloatBoundedValidator(lower=1)
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))
        positiveFloat = FloatBoundedValidator(lower=0)
        positiveIntArray = IntArrayBoundedValidator()
        positiveIntArray.setLower(0)
        scalingFactor = FloatBoundedValidator(lower=0, upper=1)

        # Properties.
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input),
            doc="A 'raw' workspace from DirectILLCollectData to calculate the diagnostics from.")
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='A diagnostics mask workspace.')
        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.Optional),
            doc='Table workspace containing results from the FindEPP algorithm.')
        self.declareProperty(name=common.PROP_ELASTIC_PEAK_DIAGNOSTICS,
                             defaultValue=common.ELASTIC_PEAK_DIAGNOSTICS_AUTO,
                             validator=StringListValidator([
                                 common.ELASTIC_PEAK_DIAGNOSTICS_AUTO,
                                 common.ELASTIC_PEAK_DIAGNOSTICS_ON,
                                 common.ELASTIC_PEAK_DIAGNOSTICS_OFF]),
                             direction=Direction.Input,
                             doc='Enable or disable elastic peak diagnostics.')
        self.setPropertyGroup(common.PROP_ELASTIC_PEAK_DIAGNOSTICS,
                              PROPGROUP_PEAK_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_ELASTIC_PEAK_SIGMA_MULTIPLIER,
                             defaultValue=3.0,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc="Integration width of the elastic peak in multiples " +
                                 " of 'Sigma' in the EPP table.")
        self.setPropertyGroup(common.PROP_ELASTIC_PEAK_SIGMA_MULTIPLIER,
                              PROPGROUP_PEAK_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_PEAK_DIAGNOSTICS_LOW_THRESHOLD,
                             defaultValue=0.1,
                             validator=scalingFactor,
                             direction=Direction.Input,
                             doc='Multiplier for lower acceptance limit ' +
                                 'used in elastic peak diagnostics.')
        self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_LOW_THRESHOLD,
                              PROPGROUP_PEAK_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_PEAK_DIAGNOSTICS_HIGH_THRESHOLD,
                             defaultValue=3.0,
                             validator=greaterThanUnityFloat,
                             direction=Direction.Input,
                             doc='Multiplier for higher acceptance limit ' +
                                 'used in elastic peak diagnostics.')
        self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_HIGH_THRESHOLD,
                              PROPGROUP_PEAK_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_PEAK_DIAGNOSTICS_SIGNIFICANCE_TEST,
                             defaultValue=3.3,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc='To fail the elastic peak diagnostics, the intensity must also exceed ' +
                                 'this number of error bars with respect to the median intensity.')
        self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_SIGNIFICANCE_TEST,
                              PROPGROUP_PEAK_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS,
                             defaultValue=common.BKG_DIAGNOSTICS_AUTO,
                             validator=StringListValidator([
                                 common.BKG_DIAGNOSTICS_AUTO,
                                 common.BKG_DIAGNOSTICS_ON,
                                 common.BKG_DIAGNOSTICS_OFF]),
                             direction=Direction.Input,
                             doc='Control the background diagnostics.')
        self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS, PROPGROUP_BKG_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_BKG_SIGMA_MULTIPLIER,
                             defaultValue=10.0,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc="Width of the range excluded from background integration around " +
                                 "the elastic peaks in multiplies of 'Sigma' in the EPP table")
        self.setPropertyGroup(common.PROP_BKG_SIGMA_MULTIPLIER,
                              PROPGROUP_BKG_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS_LOW_THRESHOLD,
                             defaultValue=0.1,
                             validator=scalingFactor,
                             direction=Direction.Input,
                             doc='Multiplier for lower acceptance limit ' +
                                 'used in noisy background diagnostics.')
        self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_LOW_THRESHOLD,
                              PROPGROUP_BKG_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS_HIGH_THRESHOLD,
                             defaultValue=3.3,
                             validator=greaterThanUnityFloat,
                             direction=Direction.Input,
                             doc='Multiplier for higher acceptance limit ' +
                                 'used in noisy background diagnostics.')
        self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_HIGH_THRESHOLD,
                              PROPGROUP_BKG_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS_SIGNIFICANCE_TEST,
                             defaultValue=3.3,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc='To fail the background diagnostics, the background level must also exceed ' +
                                 'this number of error bars with respect to the median level.')
        self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_SIGNIFICANCE_TEST,
                              PROPGROUP_BKG_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_BEAM_STOP_DIAGNOSTICS,
                             defaultValue=common.BEAM_STOP_DIAGNOSTICS_AUTO,
                             validator=StringListValidator([
                                 common.BEAM_STOP_DIAGNOSTICS_AUTO,
                                 common.BEAM_STOP_DIAGNOSTICS_ON,
                                 common.BEAM_STOP_DIAGNOSTICS_OFF]),
                             direction=Direction.Input,
                             doc='Control the beam stop diagnostics.')
        self.setPropertyGroup(common.PROP_BEAM_STOP_DIAGNOSTICS, PROPGROUP_BEAM_STOP_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_BEAM_STOP_THRESHOLD,
                             defaultValue=0.67,
                             validator=scalingFactor,
                             direction=Direction.Input,
                             doc='Multiplier for the lower acceptance limit for beam stop diagnostics.')
        self.setPropertyGroup(common.PROP_BEAM_STOP_THRESHOLD, PROPGROUP_BEAM_STOP_DIAGNOSTICS)
        self.declareProperty(name=common.PROP_DEFAULT_MASK,
                             defaultValue=common.DEFAULT_MASK_ON,
                             validator=StringListValidator([
                                 common.DEFAULT_MASK_ON,
                                 common.DEFAULT_MASK_OFF]),
                             direction=Direction.Input,
                             doc='Enable or disable instrument specific default mask.')
        self.declareProperty(IntArrayProperty(name=common.PROP_USER_MASK,
                                              values='',
                                              validator=positiveIntArray,
                                              direction=Direction.Input),
                             doc='List of spectra to mask.')
        self.setPropertyGroup(common.PROP_USER_MASK, PROPGROUP_USER_MASK)
        self.declareProperty(
            StringArrayProperty(name=common.PROP_USER_MASK_COMPONENTS,
                                values='',
                                direction=Direction.Input),
            doc='List of instrument components to mask.')
        self.setPropertyGroup(common.PROP_USER_MASK_COMPONENTS, PROPGROUP_USER_MASK)
        # Rest of the output properties
        self.declareProperty(ITableWorkspaceProperty(
            name=common.PROP_OUTPUT_DIAGNOSTICS_REPORT_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Output table workspace for detector diagnostics reporting.')
        self.setPropertyGroup(common.PROP_OUTPUT_DIAGNOSTICS_REPORT_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
        self.declareProperty(name=common.PROP_OUTPUT_DIAGNOSTICS_REPORT,
                             defaultValue='',
                             direction=Direction.Output,
                             doc='Diagnostics report as a string.')
        self.setPropertyGroup(common.PROP_OUTPUT_DIAGNOSTICS_REPORT,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
    def PyInit(self):
        # ---------------
        # INPUT
        # ---------------
        # State
        self.declareProperty(PropertyManagerProperty('SANSState'),
                             doc='A property manager which fulfills the SANSState contract.')

        # Input workspaces
        self.declareProperty(MatrixWorkspaceProperty('TransmissionWorkspace', '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input),
                             doc='The transmission workspace.')
        self.declareProperty(MatrixWorkspaceProperty('DirectWorkspace', '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input),
                             doc='The direct workspace.')
        self.declareProperty(MatrixWorkspaceProperty('MonitorWorkspace', '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input),
                             doc='The scatter monitor workspace. This workspace only contains monitors.')

        workspace_validator = CompositeValidator()
        workspace_validator.add(WorkspaceUnitValidator("Wavelength"))
        self.declareProperty(MatrixWorkspaceProperty('SampleData', '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='A workspace cropped to the detector to be reduced (the SAME as the input to Q1D). '
                                 'This used to verify the solid angle. The workspace is not modified, just inspected.')

        # The component
        allowed_detector_types = StringListValidator([DetectorType.to_string(DetectorType.HAB),
                                                      DetectorType.to_string(DetectorType.LAB)])
        self.declareProperty("Component", DetectorType.to_string(DetectorType.LAB),
                             validator=allowed_detector_types, direction=Direction.Input,
                             doc="The component of the instrument which is currently being investigated.")

        # The data type
        allowed_data = StringListValidator([DataType.to_string(DataType.Sample),
                                            DataType.to_string(DataType.Can)])
        self.declareProperty("DataType", DataType.to_string(DataType.Sample),
                             validator=allowed_data, direction=Direction.Input,
                             doc="The component of the instrument which is to be reduced.")

        # Slice factor for monitor
        self.declareProperty('SliceEventFactor', 1.0, direction=Direction.Input, doc='The slice factor for the monitor '
                                                                                     'normalization. This factor is the'
                                                                                     ' one obtained from event '
                                                                                     'slicing.')

        # ---------------
        # Output
        # ---------------
        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspaceWavelengthAdjustment', '',
                                                     direction=Direction.Output),
                             doc='The workspace for wavelength-based adjustments.')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspacePixelAdjustment', '',
                                                     direction=Direction.Output),
                             doc='The workspace for wavelength-based adjustments.')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspaceWavelengthAndPixelAdjustment', '',
                                                     direction=Direction.Output),
                             doc='The workspace for, both, wavelength- and pixel-based adjustments.')

        self.declareProperty(MatrixWorkspaceProperty('CalculatedTransmissionWorkspace', ''
                                                     ,optional=PropertyMode.Optional, direction=Direction.Output),
                             doc='The calculated transmission workspace')

        self.declareProperty(MatrixWorkspaceProperty('UnfittedTransmissionWorkspace', ''
                                                     ,optional=PropertyMode.Optional, direction=Direction.Output),
                             doc='The unfitted transmission workspace')
Exemplo n.º 43
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).')
Exemplo n.º 44
0
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        PROPGROUP_FLAT_BKG = 'Flat Time-Independent Background'
        PROPGROUP_INCIDENT_ENERGY_CALIBRATION = 'Indicent Energy Calibration'
        PROPGROUP_MON_NORMALISATION = 'Neutron Flux Normalisation'
        # Validators.
        mandatoryPositiveInt = CompositeValidator()
        mandatoryPositiveInt.add(IntMandatoryValidator())
        mandatoryPositiveInt.add(IntBoundedValidator(lower=0))
        positiveFloat = FloatBoundedValidator(lower=0)
        positiveInt = IntBoundedValidator(lower=0)
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))

        # Properties.
        self.declareProperty(MultipleFileProperty(name=common.PROP_INPUT_FILE,
                                                  action=FileAction.OptionalLoad,
                                                  extensions=['nxs']),
                             doc='An input run number (or a list thereof) or a filename.')
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            optional=PropertyMode.Optional,
            direction=Direction.Input),
            doc='Input workspace if no run is given.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='A flux normalized and background subtracted workspace.')
        self.declareProperty(name=common.PROP_CLEANUP_MODE,
                             defaultValue=utils.Cleanup.ON,
                             validator=StringListValidator([
                                 utils.Cleanup.ON,
                                 utils.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_EPP_METHOD,
                             defaultValue=common.EPP_METHOD_AUTO,
                             validator=StringListValidator([
                                 common.EPP_METHOD_AUTO,
                                 common.EPP_METHOD_FIT,
                                 common.EPP_METHOD_CALCULATE]),
                             direction=Direction.Input,
                             doc='Method to create the EPP table for detectors (monitor is awlays fitted).')
        self.declareProperty(name=common.PROP_EPP_SIGMA,
                             defaultValue=Property.EMPTY_DBL,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc='Nominal sigma for the EPP table when ' + common.PROP_EPP_METHOD +
                                 ' is set to ' + common.EPP_METHOD_CALCULATE +
                                 ' (default: 10 times the first bin width).')
        self.declareProperty(name=common.PROP_ELASTIC_CHANNEL_MODE,
                             defaultValue=common.ELASTIC_CHANNEL_AUTO,
                             validator=StringListValidator([
                                 common.ELASTIC_CHANNEL_AUTO,
                                 common.ELASTIC_CHANNEL_SAMPLE_LOG,
                                 common.ELASTIC_CHANNEL_FIT]),
                             direction=Direction.Input,
                             doc='How to acquire the nominal elastic channel.')
        self.declareProperty(MatrixWorkspaceProperty(
                             name=common.PROP_ELASTIC_CHANNEL_WS,
                             defaultValue='',
                             direction=Direction.Input,
                             optional=PropertyMode.Optional),
                             doc='A single value workspace containing the nominal elastic channel index. Overrides '
                                 + common.PROP_ELASTIC_CHANNEL_MODE + '.')
        self.declareProperty(name=common.PROP_MON_INDEX,
                             defaultValue=Property.EMPTY_INT,
                             validator=positiveInt,
                             direction=Direction.Input,
                             doc='Index of the incident monitor, if not specified in instrument parameters.')
        self.declareProperty(name=common.PROP_INCIDENT_ENERGY_CALIBRATION,
                             defaultValue=common.INCIDENT_ENERGY_CALIBRATION_AUTO,
                             validator=StringListValidator([
                                 common.INCIDENT_ENERGY_CALIBRATION_AUTO,
                                 common.INCIDENT_ENERGY_CALIBRATION_ON,
                                 common.INCIDENT_ENERGY_CALIBRATION_OFF]),
                             direction=Direction.Input,
                             doc='Control the incident energy calibration.')
        self.setPropertyGroup(common.PROP_INCIDENT_ENERGY_CALIBRATION, PROPGROUP_INCIDENT_ENERGY_CALIBRATION)
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INCIDENT_ENERGY_WS,
            defaultValue='',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
            doc='A single-valued workspace holding a previously determined ' +
                'incident energy.')
        self.setPropertyGroup(common.PROP_INCIDENT_ENERGY_WS, PROPGROUP_INCIDENT_ENERGY_CALIBRATION)
        self.declareProperty(name=common.PROP_FLAT_BKG,
                             defaultValue=common.BKG_AUTO,
                             validator=StringListValidator([
                                 common.BKG_AUTO,
                                 common.BKG_ON,
                                 common.BKG_OFF]),
                             direction=Direction.Input,
                             doc='Control flat background subtraction.')
        self.setPropertyGroup(common.PROP_FLAT_BKG, PROPGROUP_FLAT_BKG)
        self.declareProperty(name=common.PROP_FLAT_BKG_SCALING,
                             defaultValue=1.0,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc='Flat background multiplication factor.')
        self.setPropertyGroup(common.PROP_FLAT_BKG_SCALING, PROPGROUP_FLAT_BKG)
        self.declareProperty(name=common.PROP_FLAT_BKG_WINDOW,
                             defaultValue=30,
                             validator=mandatoryPositiveInt,
                             direction=Direction.Input,
                             doc='Running average window width (in bins) for flat background.')
        self.setPropertyGroup(common.PROP_FLAT_BKG_WINDOW, PROPGROUP_FLAT_BKG)
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_FLAT_BKG_WS,
            defaultValue='',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
            doc='Workspace with previously determined flat background data.')
        self.setPropertyGroup(common.PROP_FLAT_BKG_WS, PROPGROUP_FLAT_BKG)
        self.declareProperty(name=common.PROP_NORMALISATION,
                             defaultValue=common.NORM_METHOD_MON,
                             validator=StringListValidator([
                                 common.NORM_METHOD_MON,
                                 common.NORM_METHOD_TIME,
                                 common.NORM_METHOD_OFF]),
                             direction=Direction.Input,
                             doc='Normalisation method.')
        self.setPropertyGroup(common.PROP_NORMALISATION, PROPGROUP_MON_NORMALISATION)
        self.declareProperty(name=common.PROP_MON_PEAK_SIGMA_MULTIPLIER,
                             defaultValue=3.0,
                             validator=positiveFloat,
                             direction=Direction.Input,
                             doc="Width of the monitor peak in multiples " +
                                 " of 'Sigma' in monitor's EPP table.")
        self.setPropertyGroup(common.PROP_MON_PEAK_SIGMA_MULTIPLIER, PROPGROUP_MON_NORMALISATION)
        # Rest of the output properties.
        self.declareProperty(WorkspaceProperty(
            name=common.PROP_OUTPUT_RAW_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Non-normalized and non-background subtracted output workspace for DirectILLDiagnostics.')
        self.setPropertyGroup(common.PROP_OUTPUT_RAW_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
        self.declareProperty(WorkspaceProperty(
            name=common.PROP_OUTPUT_ELASTIC_CHANNEL_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Output workspace for elastic channel index.')
        self.setPropertyGroup(common.PROP_OUTPUT_ELASTIC_CHANNEL_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
        self.declareProperty(ITableWorkspaceProperty(
            name=common.PROP_OUTPUT_DET_EPP_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Output workspace for elastic peak positions.')
        self.setPropertyGroup(common.PROP_OUTPUT_DET_EPP_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
        self.declareProperty(WorkspaceProperty(
            name=common.PROP_OUTPUT_INCIDENT_ENERGY_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Output workspace for calibrated incident energy.')
        self.setPropertyGroup(common.PROP_OUTPUT_INCIDENT_ENERGY_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
        self.declareProperty(WorkspaceProperty(
            name=common.PROP_OUTPUT_FLAT_BKG_WS,
            defaultValue='',
            direction=Direction.Output,
            optional=PropertyMode.Optional),
            doc='Output workspace for flat background.')
        self.setPropertyGroup(common.PROP_OUTPUT_FLAT_BKG_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
Exemplo n.º 45
0
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        PROPGROUP_REBINNING = 'Rebinning for SofQW'
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))
        positiveFloat = FloatBoundedValidator(0., exclusive=True)
        validRebinParams = RebinParamsValidator(AllowEmpty=True)

        # Properties.
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input),
                             doc='A workspace to reduce.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='The reduced S(Q, DeltaE) workspace.')
        self.declareProperty(name=common.PROP_CLEANUP_MODE,
                             defaultValue=utils.Cleanup.ON,
                             validator=StringListValidator(
                                 [utils.Cleanup.ON, utils.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(MatrixWorkspaceProperty(
            name=common.PROP_VANA_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input,
            optional=PropertyMode.Optional),
                             doc='An integrated vanadium workspace.')
        self.declareProperty(
            name=common.PROP_ABSOLUTE_UNITS,
            defaultValue=common.ABSOLUTE_UNITS_OFF,
            validator=StringListValidator(
                [common.ABSOLUTE_UNITS_OFF, common.ABSOLUTE_UNITS_ON]),
            direction=Direction.Input,
            doc='Enable or disable normalisation to absolute units.')
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_DIAGNOSTICS_WS,
            defaultValue='',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
                             doc='Detector diagnostics workspace for masking.')
        self.declareProperty(
            name=common.PROP_GROUPING_ANGLE_STEP,
            defaultValue=Property.EMPTY_DBL,
            validator=positiveFloat,
            doc=
            'A scattering angle step to which to group detectors, in degrees.')
        self.declareProperty(FloatArrayProperty(
            name=common.PROP_REBINNING_PARAMS_W, validator=validRebinParams),
                             doc='Manual energy rebinning parameters.')
        self.setPropertyGroup(common.PROP_REBINNING_PARAMS_W,
                              PROPGROUP_REBINNING)
        self.declareProperty(
            name=common.PROP_REBINNING_W,
            defaultValue='',
            doc=
            'Energy rebinning when mixing manual and automatic binning parameters.'
        )
        self.declareProperty(FloatArrayProperty(
            name=common.PROP_BINNING_PARAMS_Q, validator=validRebinParams),
                             doc='Manual q rebinning parameters.')
        self.setPropertyGroup(common.PROP_BINNING_PARAMS_Q,
                              PROPGROUP_REBINNING)
        self.declareProperty(
            name=common.PROP_TRANSPOSE_SAMPLE_OUTPUT,
            defaultValue=common.TRANSPOSING_ON,
            validator=StringListValidator(
                [common.TRANSPOSING_ON, common.TRANSPOSING_OFF]),
            direction=Direction.Input,
            doc='Enable or disable ' + common.PROP_OUTPUT_WS + ' transposing.')
        self.declareProperty(
            WorkspaceProperty(name=common.PROP_OUTPUT_THETA_W_WS,
                              defaultValue='',
                              direction=Direction.Output,
                              optional=PropertyMode.Optional),
            doc='Output workspace for reduced S(theta, DeltaE).')
        self.setPropertyGroup(common.PROP_OUTPUT_THETA_W_WS,
                              common.PROPGROUP_OPTIONAL_OUTPUT)
Exemplo n.º 46
0
    def PyInit(self):
        self.declareProperty(
            MultipleFileProperty('CalibrationRun',
                                 action=FileAction.Load,
                                 extensions=['nxs']),
            doc=
            'File path of calibration runs (numors). Must be detector scans.')

        self.declareProperty(
            FileProperty('CalibrationFile',
                         '',
                         action=FileAction.OptionalLoad,
                         extensions=['nxs']),
            doc='Optional file containing previous calibration constants.')

        self.declareProperty(
            name='CalibrationMethod',
            defaultValue='Median',
            validator=StringListValidator(['Median', 'Mean',
                                           'MostLikelyMean']),
            doc='The method of how the calibration constant of a pixel '
            'is derived from the distribution of ratios.')

        self.declareProperty(
            name='DerivationMethod',
            defaultValue='SequentialSummedReference1D',
            validator=StringListValidator(
                ['SequentialSummedReference1D', 'GlobalSummedReference2D']),
            doc=
            'Choose sequential for D20 (1D detector), global for D2B (2D detector).'
        )

        self.declareProperty(
            name='InterpolateOverlappingAngles',
            defaultValue=False,
            doc=
            'Whether to interpolate scattering angle values in overlapping regions (D20 only).'
        )

        self.declareProperty(
            name='NormaliseTo',
            defaultValue='None',
            validator=StringListValidator(['None', 'Monitor', 'ROI']),
            doc=
            'Normalise to monitor or ROI counts before deriving the calibration.'
        )

        thetaRangeValidator = FloatArrayOrderedPairsValidator()

        self.declareProperty(
            FloatArrayProperty(name='ROI',
                               values=[0, 100.],
                               validator=thetaRangeValidator),
            doc=
            'Scattering angle regions of interest for normalisation [degrees].'
        )

        normaliseToROI = VisibleWhenProperty('NormaliseTo',
                                             PropertyCriterion.IsEqualTo,
                                             'ROI')
        self.setPropertySettings('ROI', normaliseToROI)

        self.declareProperty(
            FloatArrayProperty(name='ExcludedRange',
                               values=[],
                               validator=thetaRangeValidator),
            doc='Scattering angle regions to exclude from the computation of '
            'relative calibration constants; for example, the beam stop [degrees]. '
        )

        pixelRangeValidator = CompositeValidator()
        greaterThanOne = IntArrayBoundedValidator(lower=1)
        lengthTwo = IntArrayLengthValidator()
        lengthTwo.setLength(2)
        orderedPairsValidator = IntArrayOrderedPairsValidator()
        pixelRangeValidator.add(greaterThanOne)
        pixelRangeValidator.add(lengthTwo)
        pixelRangeValidator.add(orderedPairsValidator)

        self.declareProperty(
            IntArrayProperty(name='PixelRange',
                             values=[1, 3072],
                             validator=pixelRangeValidator),
            doc=
            'Range of the pixel numbers to compute the calibration factors for (D20 only); '
            'for the other pixels outside the range, the factor will be set to 1.'
        )

        self.declareProperty(
            MatrixWorkspaceProperty('OutputResponseWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc=
            'Output workspace containing the summed diffraction patterns of all the overlapping pixels.'
        )

        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspace',
                                    '',
                                    direction=Direction.Output),
            doc=
            'Output workspace containing the calibration constants (inverse of efficiency) for each pixel.'
        )

        self.declareProperty(
            name='NumberOfIterations',
            defaultValue=1,
            validator=IntBoundedValidator(lower=0, upper=10),
            doc=
            'Number of iterations to perform (D2B only): 0 means auto; that is, the '
            'iterations will terminate after reaching some Chi2/NdoF.')

        maskCriterionValidator = CompositeValidator()
        arrayLengthTwo = FloatArrayLengthValidator()
        arrayLengthTwo.setLengthMax(2)
        orderedPairs = FloatArrayOrderedPairsValidator()
        maskCriterionValidator.add(arrayLengthTwo)
        maskCriterionValidator.add(orderedPairs)

        self.declareProperty(
            FloatArrayProperty(name='MaskCriterion',
                               values=[],
                               validator=maskCriterionValidator),
            doc='Efficiency constants outside this range will be set to zero.')

        self.declareProperty(
            name='UseCalibratedData',
            defaultValue=False,
            doc=
            'Whether or not to use the calibrated data in the NeXus files (D2B only).'
        )
Exemplo n.º 47
0
 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     threeNonnegativeInts = CompositeValidator()
     threeNonnegativeInts.add(IntArrayLengthValidator(3))
     nonnegativeInts = IntArrayBoundedValidator(lower=0)
     threeNonnegativeInts.add(nonnegativeInts)
     nonnegativeFloatArray = FloatArrayBoundedValidator(lower=0.)
     inWavelength = WorkspaceUnitValidator('Wavelength')
     self.declareProperty(
         MatrixWorkspaceProperty(
             Prop.INPUT_WS,
             defaultValue='',
             direction=Direction.Input,
             validator=inWavelength),
         doc='A reflected beam workspace (units wavelength).')
     self.declareProperty(
         MatrixWorkspaceProperty(
             Prop.OUTPUT_WS,
             defaultValue='',
             direction=Direction.Output),
         doc='The summed foreground workspace.')
     self.declareProperty(
         Prop.SUBALG_LOGGING,
         defaultValue=SubalgLogging.OFF,
         validator=StringListValidator([SubalgLogging.OFF, SubalgLogging.ON]),
         doc='Enable or disable child algorithm logging.')
     self.declareProperty(
         Prop.CLEANUP,
         defaultValue=utils.Cleanup.ON,
         validator=StringListValidator([utils.Cleanup.ON, utils.Cleanup.OFF]),
         doc='Enable or disable intermediate workspace cleanup.')
     self.declareProperty(
         Prop.SUM_TYPE,
         defaultValue=SumType.IN_LAMBDA,
         validator=StringListValidator([SumType.IN_LAMBDA, SumType.IN_Q]),
         doc='Type of summation to perform.')
     self.declareProperty(
         MatrixWorkspaceProperty(
             Prop.DIRECT_FOREGROUND_WS,
             defaultValue='',
             direction=Direction.Input,
             optional=PropertyMode.Optional,
             validator=inWavelength),
         doc='Summed direct beam workspace (units wavelength).')
     self.declareProperty(
         IntArrayProperty(
             Prop.FOREGROUND_INDICES,
             values=[Property.EMPTY_INT, Property.EMPTY_INT, Property.EMPTY_INT],
             validator=threeNonnegativeInts),
         doc='A three element array of foreground start, centre and end workspace indices.')
     self.declareProperty(
         MatrixWorkspaceProperty(
             Prop.DIRECT_WS,
             defaultValue='',
             direction=Direction.Input,
             optional=PropertyMode.Optional,
             validator=inWavelength),
         doc='The (not summed) direct beam workspace (units wavelength).')
     self.declareProperty(
         FloatArrayProperty(
             Prop.WAVELENGTH_RANGE,
             values=[0.],
             validator=nonnegativeFloatArray),
         doc='The wavelength bounds.')
    def PyInit(self):
        self.declareProperty(MultipleFileProperty('CalibrationRun', action=FileAction.Load, extensions=['nxs']),
                             doc='File path of calibration runs (numors). Must be detector scans.')

        self.declareProperty(FileProperty('CalibrationFile', '', action=FileAction.OptionalLoad, extensions=['nxs']),
                             doc='Optional file containing previous calibration constants.')

        self.declareProperty(name='CalibrationMethod',
                             defaultValue='Median',
                             validator=StringListValidator(['Median', 'Mean', 'MostLikelyMean']),
                             doc='The method of how the calibration constant of a pixel '
                                 'is derived from the distribution of ratios.')

        self.declareProperty(name='DerivationMethod', defaultValue='SequentialSummedReference1D',
                             validator=StringListValidator(['SequentialSummedReference1D', 'GlobalSummedReference2D']),
                             doc='Choose sequential for D20 (1D detector), global for D2B (2D detector).')

        self.declareProperty(name='InterpolateOverlappingAngles', defaultValue=False,
                             doc='Whether to interpolate scattering angle values in overlapping regions (D20 only).')

        self.declareProperty(name='NormaliseTo',
                             defaultValue='None',
                             validator=StringListValidator(['None', 'Monitor', 'ROI']),
                             doc='Normalise to monitor or ROI counts before deriving the calibration.')

        thetaRangeValidator = FloatArrayOrderedPairsValidator()

        self.declareProperty(FloatArrayProperty(name='ROI', values=[0,100.], validator=thetaRangeValidator),
                             doc='Scattering angle regions of interest for normalisation [degrees].')

        normaliseToROI = VisibleWhenProperty('NormaliseTo', PropertyCriterion.IsEqualTo, 'ROI')
        self.setPropertySettings('ROI', normaliseToROI)

        self.declareProperty(FloatArrayProperty(name='ExcludedRange', values=[], validator=thetaRangeValidator),
                             doc='Scattering angle regions to exclude from the computation of '
                                 'relative calibration constants; for example, the beam stop [degrees]. ')

        pixelRangeValidator = CompositeValidator()
        greaterThanOne = IntArrayBoundedValidator()
        greaterThanOne.setLower(1)
        lengthTwo = IntArrayLengthValidator()
        lengthTwo.setLength(2)
        orderedPairsValidator = IntArrayOrderedPairsValidator()
        pixelRangeValidator.add(greaterThanOne)
        pixelRangeValidator.add(lengthTwo)
        pixelRangeValidator.add(orderedPairsValidator)

        self.declareProperty(IntArrayProperty(name='PixelRange', values=[1,3072], validator=pixelRangeValidator),
                             doc='Range of the pixel numbers to compute the calibration factors for (D20 only); '
                                 'for the other pixels outside the range, the factor will be set to 1.')

        self.declareProperty(MatrixWorkspaceProperty('OutputResponseWorkspace', '',
                                                     optional=PropertyMode.Optional, direction=Direction.Output),
                             doc='Output workspace containing the summed diffraction patterns of all the overlapping pixels.')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace', '',
                                                     direction=Direction.Output),
                             doc='Output workspace containing the calibration constants (inverse of efficiency) for each pixel.')

        self.declareProperty(name='NumberOfIterations',
                             defaultValue=1,
                             validator=IntBoundedValidator(lower=0, upper=10),
                             doc='Number of iterations to perform (D2B only): 0 means auto; that is, the '
                                 'iterations will terminate after reaching some Chi2/NdoF.')

        maskCriterionValidator = CompositeValidator()
        arrayLengthTwo = FloatArrayLengthValidator()
        arrayLengthTwo.setLengthMax(2)
        orderedPairs = FloatArrayOrderedPairsValidator()
        maskCriterionValidator.add(arrayLengthTwo)
        maskCriterionValidator.add(orderedPairs)

        self.declareProperty(FloatArrayProperty(name='MaskCriterion', values=[], validator=maskCriterionValidator),
                             doc='Efficiency constants outside this range will be set to zero.')

        self.declareProperty(name='UseCalibratedData',
                             defaultValue=False,
                             doc='Whether or not to use the calibrated data in the NeXus files (D2B only).')
Exemplo n.º 49
0
    def PyInit(self):

        mandatoryInputRuns = CompositeValidator()
        mandatoryInputRuns.add(StringArrayMandatoryValidator())
        self.declareProperty(StringArrayProperty('SampleRuns',
                                                 values=[],
                                                 validator=mandatoryInputRuns),
                             doc='Comma separated range of sample runs,\n'
                             ' eg [cycle::] 7333-7341,7345')

        self.declareProperty(
            name='EmptyRuns',
            defaultValue='',
            doc='Optional path followed by comma separated range of runs,\n'
            'looking for runs in the sample folder if path not included,\n'
            '  eg [cycle::] 6300-6308')

        self.declareProperty(name='ScaleEmptyRuns',
                             defaultValue=1.0,
                             doc='Scale the empty runs prior to subtraction')

        self.declareProperty(
            name='CalibrationRuns',
            defaultValue='',
            doc='Optional path followed by comma separated range of runs,\n'
            'looking for runs in the sample folder if path not included,\n'
            '  eg [cycle::] 6350-6365')

        self.declareProperty(
            name='EmptyCalibrationRuns',
            defaultValue='',
            doc='Optional path followed by comma separated range of runs,\n'
            'looking for runs in the sample folder if path not included,\n'
            '  eg [cycle::] 6370-6375')

        self.declareProperty(
            name='EnergyTransfer',
            defaultValue='0.0, 0.02, 3.0',
            doc='Energy transfer range in meV expressed as min, step, max')

        self.declareProperty(
            name='MomentumTransfer',
            defaultValue='',
            doc='Momentum transfer range in inverse Angstroms,\n'
            'expressed as min, step, max. Default estimates\n'
            'the max range based on energy transfer.')

        self.declareProperty(
            name='LambdaOnTwoMode',
            defaultValue=False,
            doc='Set if instrument running in lambda on two mode.')

        self.declareProperty(
            name='FrameOverlap',
            defaultValue=False,
            doc='Set if the energy transfer extends over a frame.')

        self.declareProperty(name='FixedDetector',
                             defaultValue=True,
                             doc='Fix detector positions to the first run')

        self.declareProperty(FileProperty('ScratchFolder',
                                          '',
                                          action=FileAction.OptionalDirectory,
                                          direction=Direction.Input),
                             doc='Path to save and restore merged workspaces.')

        mandatoryOutputFolder = CompositeValidator()
        mandatoryOutputFolder.add(StringArrayMandatoryValidator())
        self.declareProperty(FileProperty('OutputFolder',
                                          '',
                                          action=FileAction.Directory,
                                          direction=Direction.Input),
                             doc='Path to save the output nxspe files.')

        self.declareProperty(
            FileProperty('ConfigurationFile',
                         '',
                         action=FileAction.OptionalLoad,
                         extensions=['ini']),
            doc='Optional: INI file to override default processing values.')

        self.declareProperty(name='KeepReducedWorkspace',
                             defaultValue=False,
                             doc='Keep the last reduced workspace.')
 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     nonnegativeInt = IntBoundedValidator(lower=0)
     nonnegativeIntArray = IntArrayBoundedValidator()
     nonnegativeIntArray.setLower(0)
     nonnegativeFloatArray = FloatArrayBoundedValidator()
     nonnegativeFloatArray.setLower(0.)
     twoNonnegativeFloats = CompositeValidator()
     twoNonnegativeFloats.add(FloatArrayLengthValidator(length=2))
     twoNonnegativeFloats.add(nonnegativeFloatArray)
     maxTwoNonnegativeInts = CompositeValidator()
     maxTwoNonnegativeInts.add(IntArrayLengthValidator(lenmin=0, lenmax=2))
     maxTwoNonnegativeInts.add(nonnegativeIntArray)
     self.declareProperty(MultipleFileProperty(Prop.RUN,
                                               action=FileAction.OptionalLoad,
                                               extensions=['nxs']),
                          doc='A list of input run numbers/files.')
     self.declareProperty(MatrixWorkspaceProperty(Prop.INPUT_WS,
                                                  defaultValue='',
                                                  direction=Direction.Input,
                                                  validator=WorkspaceUnitValidator('TOF'),
                                                  optional=PropertyMode.Optional),
                          doc='An input workspace (units TOF) if no Run is specified.')
     self.declareProperty(ITableWorkspaceProperty(Prop.BEAM_POS_WS,
                                                  defaultValue='',
                                                  direction=Direction.Input,
                                                  optional=PropertyMode.Optional),
                          doc='A beam position table corresponding to InputWorkspace.')
     self.declareProperty(Prop.BEAM_ANGLE,
                          defaultValue=Property.EMPTY_DBL,
                          doc='A user-defined beam angle (unit degrees).')
     self.declareProperty(name=Prop.BEAM_CENTRE,
                          defaultValue=Property.EMPTY_DBL,
                          doc='A workspace index corresponding to the beam centre.')
     self.declareProperty(MatrixWorkspaceProperty(Prop.OUTPUT_WS,
                                                  defaultValue='',
                                                  direction=Direction.Output),
                          doc='The preprocessed output workspace (unit wavelength), single histogram.')
     self.declareProperty(Prop.SUBALG_LOGGING,
                          defaultValue=SubalgLogging.OFF,
                          validator=StringListValidator([SubalgLogging.OFF, SubalgLogging.ON]),
                          doc='Enable or disable child algorithm logging.')
     self.declareProperty(Prop.CLEANUP,
                          defaultValue=common.WSCleanup.ON,
                          validator=StringListValidator([common.WSCleanup.ON, common.WSCleanup.OFF]),
                          doc='Enable or disable intermediate workspace cleanup.')
     self.declareProperty(ITableWorkspaceProperty(Prop.DIRECT_BEAM_POS_WS,
                                                  defaultValue='',
                                                  direction=Direction.Input,
                                                  optional=PropertyMode.Optional),
                          doc='A beam position table from a direct beam measurement.')
     self.declareProperty(MatrixWorkspaceProperty(Prop.WATER_REFERENCE,
                                                  defaultValue='',
                                                  direction=Direction.Input,
                                                  validator=WorkspaceUnitValidator("TOF"),
                                                  optional=PropertyMode.Optional),
                          doc='A (water) calibration workspace (unit TOF).')
     self.declareProperty(Prop.SLIT_NORM,
                          defaultValue=SlitNorm.OFF,
                          validator=StringListValidator([SlitNorm.OFF, SlitNorm.ON]),
                          doc='Enable or disable slit normalisation.')
     self.declareProperty(Prop.FLUX_NORM_METHOD,
                          defaultValue=FluxNormMethod.TIME,
                          validator=StringListValidator([FluxNormMethod.TIME, FluxNormMethod.MONITOR, FluxNormMethod.OFF]),
                          doc='Neutron flux normalisation method.')
     self.declareProperty(IntArrayProperty(Prop.FOREGROUND_HALF_WIDTH,
                                           validator=maxTwoNonnegativeInts),
                          doc='Number of foreground pixels at lower and higher angles from the centre pixel.')
     self.declareProperty(Prop.BKG_METHOD,
                          defaultValue=BkgMethod.CONSTANT,
                          validator=StringListValidator([BkgMethod.CONSTANT, BkgMethod.LINEAR, BkgMethod.OFF]),
                          doc='Flat background calculation method for background subtraction.')
     self.declareProperty(Prop.LOW_BKG_OFFSET,
                          defaultValue=7,
                          validator=nonnegativeInt,
                          doc='Distance of flat background region towards smaller detector angles from the foreground centre, ' +
                              'in pixels.')
     self.declareProperty(Prop.LOW_BKG_WIDTH,
                          defaultValue=5,
                          validator=nonnegativeInt,
                          doc='Width of flat background region towards smaller detector angles from the foreground centre, in pixels.')
     self.declareProperty(Prop.HIGH_BKG_OFFSET,
                          defaultValue=7,
                          validator=nonnegativeInt,
                          doc='Distance of flat background region towards larger detector angles from the foreground centre, in pixels.')
     self.declareProperty(Prop.HIGH_BKG_WIDTH,
                          defaultValue=5,
                          validator=nonnegativeInt,
                          doc='Width of flat background region towards larger detector angles from the foreground centre, in pixels.')
     self.declareProperty(ITableWorkspaceProperty(Prop.OUTPUT_BEAM_POS_WS,
                                                  defaultValue='',
                                                  direction=Direction.Output,
                                                  optional=PropertyMode.Optional),
                          doc='Output the beam position table.')