Exemple #1
0
 def PyInit(self):
     self.declareProperty(MultipleFileProperty('Filename'), doc='List of input files')
     self.declareProperty('LoaderName', defaultValue='Load', validator=StringContainsValidator(['Load']),
                          direction=Direction.InOut,
                          doc='The name of the specific loader. Generic Load by default.')
     self.declareProperty('LoaderVersion', defaultValue=-1, direction=Direction.InOut,
                          doc='The version of the specific loader')
     self.declareProperty(PropertyManagerProperty('LoaderOptions',dict()),
                          doc='Options for the specific loader')
     self.declareProperty(PropertyManagerProperty('MergeRunsOptions',dict()),
                          doc='Options for merging the metadata')
     self.declareProperty(WorkspaceProperty('OutputWorkspace', '', direction=Direction.Output),
                          doc='Output workspace or workspace group.')
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        # Workspace which is to be cropped
        self.declareProperty(PropertyManagerProperty('SANSState'),
                             doc='A property manager which fulfills the SANSState contract.')

        self.declareProperty(MatrixWorkspaceProperty("SampleScatterWorkspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Input),
                             doc='The sample scatter data')

        self.declareProperty(MatrixWorkspaceProperty('SampleScatterMonitorWorkspace', '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Input),
                             doc='The scatter monitor workspace. This workspace only condtains monitors.')

        self.declareProperty("Centre1", 0.0, direction=Direction.InOut)
        self.declareProperty("Centre2", 0.0, direction=Direction.InOut)

        self.declareProperty("RMin", 0.06, direction=Direction.Input)

        self.declareProperty('Tolerance', 0.0001251, direction=Direction.Input)

        self.declareProperty('Iterations', 10, direction=Direction.Input)

        allowed_detectors = StringListValidator([DetectorType.to_string(DetectorType.LAB),
                                                 DetectorType.to_string(DetectorType.HAB)])
        self.declareProperty("Component", DetectorType.to_string(DetectorType.LAB),
                             validator=allowed_detectors, direction=Direction.Input,
                             doc="The component of the instrument which is to be reduced.")
Exemple #3
0
    def PyInit(self):
        # State
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        # Workspace which is to be masked
        self.declareProperty(
            MatrixWorkspaceProperty("Workspace",
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.InOut),
            doc=
            'The sample scatter workspace. This workspace does not contain monitors.'
        )

        # The component, i.e. HAB or LAB
        allowed_detectors = StringListValidator([
            DetectorType.to_string(DetectorType.LAB),
            DetectorType.to_string(DetectorType.HAB)
        ])
        self.declareProperty(
            "Component",
            DetectorType.to_string(DetectorType.LAB),
            validator=allowed_detectors,
            direction=Direction.Input,
            doc="The component of the instrument which is to be masked.")
 def PyInit(self):
     self.declareProperty(
         WorkspaceProperty('InputWorkspace', "", direction=Direction.Input))
     self.declareProperty(PropertyManagerProperty(
         'XAxis', {}, direction=Direction.Input),
                          doc='MSlice Axis object as a dictionary')
     self.declareProperty(PropertyManagerProperty(
         'YAxis', {}, direction=Direction.Input),
                          doc='MSlice Axis object as a dictionary')
     self.declareProperty('EMode', 'Direct', StringMandatoryValidator())
     self.declareProperty('PSD', False)
     self.declareProperty('NormToOne', False)
     self.declareProperty(
         WorkspaceProperty('OutputWorkspace',
                           '',
                           direction=Direction.Output))
    def PyInit(self):
        # State
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        # Input workspace in TOF
        self.declareProperty(
            MatrixWorkspaceProperty("InputWorkspace",
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc='The monitor workspace in time-of-flight units.')

        # A scale factor which could come from event workspace slicing. If the actual data workspace was sliced,
        # then one needs to scale the monitor measurement proportionally. This input is intended for this matter
        self.declareProperty(
            'ScaleFactor',
            defaultValue=1.0,
            direction=Direction.Input,
            validator=FloatBoundedValidator(0.0),
            doc='Optional scale factor for the input workspace.')

        # Output workspace
        self.declareProperty(
            MatrixWorkspaceProperty("OutputWorkspace",
                                    '',
                                    direction=Direction.Output),
            doc='A monitor normalization workspace in units of wavelength.')
Exemple #6
0
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        # Workspace which is to be cropped
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        self.declareProperty(MatrixWorkspaceProperty(
            "SampleScatterWorkspace",
            '',
            optional=PropertyMode.Mandatory,
            direction=Direction.Input),
                             doc='The sample scatter data')

        self.declareProperty(
            MatrixWorkspaceProperty('SampleScatterMonitorWorkspace',
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc=
            'The scatter monitor workspace. This workspace only condtains monitors.'
        )

        self.declareProperty("Centre1", 0.0, direction=Direction.InOut)
        self.declareProperty("Centre2", 0.0, direction=Direction.InOut)

        self.declareProperty("RMin", 0.06, direction=Direction.Input)

        self.declareProperty('Tolerance', 0.0001251, direction=Direction.Input)

        self.declareProperty('Iterations', 10, direction=Direction.Input)
Exemple #7
0
    def PyInit(self):
        # State
        self.declareProperty(PropertyManagerProperty('SANSState'),
                             doc='A property manager which fulfills the SANSState contract.')

        # Workspace which is to be moved
        self.declareProperty(MatrixWorkspaceProperty("Workspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.InOut),
                             doc='The sample scatter workspace. This workspace does not contain monitors.')

        # Move Type
        move_types = StringListValidator(list(self._make_move_type_map().keys()))
        self.declareProperty('MoveType', 'ElementaryDisplacement', validator=move_types, direction=Direction.Input,
                             doc='The type of movement. This can be: '
                                 '1) InitialMove for freshly workspaces, '
                                 '2) ElementaryDisplacement of the instrument component, '
                                 '3) SetToZero resets a component to the initial position.')

        # Coordinates of the beam
        self.declareProperty(FloatArrayProperty(name='BeamCoordinates', values=[]),
                             doc='The coordinates which are used to position the instrument component(s). If nothing '
                                 'is specified, then the coordinates from SANSState are used')

        # Components which are to be moved
        self.declareProperty('Component', '', direction=Direction.Input, doc='Component that should be moved.')

        # If is a transmission workspace
        self.declareProperty('IsTransmissionWorkspace', False, direction=Direction.Input,
                             doc='If the input workspace is a transmission or direct workspace')
Exemple #8
0
 def PyInit(self):
     self.declareProperty(MultipleFileProperty('Filename'),
                          doc='List of input files')
     self.getProperty('Filename').setAutoTrim(setting=False)
     self.declareProperty(
         'LoaderName',
         defaultValue='Load',
         validator=StringContainsValidator(['Load']),
         direction=Direction.InOut,
         doc='The name of the specific loader. Generic Load by default.')
     self.declareProperty('LoaderVersion',
                          defaultValue=-1,
                          direction=Direction.InOut,
                          doc='The version of the specific loader')
     self.declareProperty(PropertyManagerProperty('LoaderOptions', dict()),
                          doc='Options for the specific loader')
     self.declareProperty(PropertyManagerProperty('MergeRunsOptions',
                                                  dict()),
                          doc='Options for merging the metadata')
     self.declareProperty(WorkspaceProperty('OutputWorkspace',
                                            '',
                                            direction=Direction.Output),
                          doc='Output workspace or workspace group.')
     self.declareProperty(
         'OutputBehaviour',
         'Group',
         StringListValidator(['Group', 'Concatenate']),
         doc=
         'Whether to group the workspaces to a workspace group or to concatenate them to a single workspace.'
     )
     self.declareProperty(
         'SampleLogAsXAxis',
         '',
         doc=
         'Sample log to be put as x-axis when concatenating; will use linear indices if left blank.'
     )
     self.setPropertySettings(
         'SampleLogAsXAxis',
         EnabledWhenProperty('OutputBehaviour', PropertyCriterion.IsEqualTo,
                             'Concatenate'))
    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.')
Exemple #10
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")
    def PyInit(self):
        # State
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        self.declareProperty(
            MatrixWorkspaceProperty("InputWorkspace",
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc='The workspace which is to be converted to wavelength')

        self.declareProperty(MatrixWorkspaceProperty(
            'OutputWorkspace',
            '',
            optional=PropertyMode.Mandatory,
            direction=Direction.Output),
                             doc='The output workspace.')
Exemple #12
0
    def PyInit(self):
        # State
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        self.declareProperty(MatrixWorkspaceProperty(
            "InputWorkspace",
            '',
            optional=PropertyMode.Mandatory,
            direction=Direction.Input),
                             doc='The input workspace')

        self.declareProperty(MatrixWorkspaceProperty(
            "OutputWorkspace",
            '',
            optional=PropertyMode.Mandatory,
            direction=Direction.Output),
                             doc='The scaled output workspace')
    def PyInit(self):
        # State
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        # Input workspace in TOF
        self.declareProperty(
            MatrixWorkspaceProperty("TransmissionWorkspace",
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc='The transmission workspace in time-of-flight units.')
        self.declareProperty(
            MatrixWorkspaceProperty("DirectWorkspace",
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc='The direct workspace in time-of-flight units.')
        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.")

        # Output workspace
        self.declareProperty(
            MatrixWorkspaceProperty("OutputWorkspace",
                                    '',
                                    direction=Direction.Output),
            doc='A calculated transmission workspace in units of wavelength.')
        self.declareProperty(MatrixWorkspaceProperty(
            "UnfittedData", '', direction=Direction.Output),
                             doc='An unfitted data in units of wavelength.')
Exemple #14
0
    def PyInit(self):
        # ---------------
        # INPUT
        # ---------------
        # State
        self.declareProperty(PropertyManagerProperty('SANSState'),
                             doc='A property manager which fulfills the SANSState contract.')

        # Workspace which is to be moved
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Input),
                             doc='The input workspace. If it is an event workspace, then the slice is taken. '
                                 'In case of a Workspace2D the original workspace is returned')

        self.declareProperty(MatrixWorkspaceProperty("InputWorkspaceMonitor", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Input),
                             doc='The monitor workspace associated with the main input workspace.')

        # 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.")

        # ---------------
        # OUTPUT
        # ---------------
        self.declareProperty('SliceEventFactor', defaultValue=1.0,
                             direction=Direction.Output,
                             doc='The factor of the event slicing. This corresponds to the proportion of the the total '
                                 'proton charge, which the slice corresponds to.')

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

        self.declareProperty(MatrixWorkspaceProperty("OutputWorkspaceMonitor", '', direction=Direction.Output),
                             doc='The output monitor workspace which has the correct slice factor applied to it.')
 def test_name_direction_constructor_gives_correct_object(self):
     name = "Args"
     direc = Direction.Output
     arr = PropertyManagerProperty(name, direc)
     self._check_object_attributes(arr, name, direc)
 def test_name_only_constructor_gives_correct_object(self):
     name = "Args"
     pmap = PropertyManagerProperty(name)
     self.assertTrue(isinstance(pmap, PropertyManagerProperty))
     self._check_object_attributes(pmap, name, Direction.Input)
Exemple #17
0
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        self.declareProperty(
            "UseOptimizations",
            True,
            direction=Direction.Input,
            doc=
            "When enabled the ADS is being searched for already loaded and reduced workspaces. "
            "Depending on your concrete reduction, this could provide a significant"
            " performance boost")

        # Sample Scatter Workspaces
        self.declareProperty(
            MatrixWorkspaceProperty('SampleScatterWorkspace',
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc=
            'The sample scatter workspace. This workspace does not contain monitors.'
        )
        self.declareProperty(
            MatrixWorkspaceProperty('SampleScatterMonitorWorkspace',
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc=
            'The sample scatter monitor workspace. This workspace only contains monitors.'
        )

        # Sample Transmission Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'SampleTransmissionWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The sample transmission workspace.')

        # Sample Direct Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'SampleDirectWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The sample scatter direct workspace.')

        self.setPropertyGroup("SampleScatterWorkspace", 'Sample')
        self.setPropertyGroup("SampleScatterMonitorWorkspace", 'Sample')
        self.setPropertyGroup("SampleTransmissionWorkspace", 'Sample')
        self.setPropertyGroup("SampleDirectWorkspace", 'Sample')

        # Can Scatter Workspaces
        self.declareProperty(
            MatrixWorkspaceProperty('CanScatterWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Input),
            doc=
            'The can scatter workspace. This workspace does not contain monitors.'
        )
        self.declareProperty(
            MatrixWorkspaceProperty('CanScatterMonitorWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Input),
            doc=
            'The can scatter monitor workspace. This workspace only contains monitors.'
        )

        # Sample Transmission Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'CanTransmissionWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The can transmission workspace.')

        # Sample Direct Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'CanDirectWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The sample scatter direct workspace.')

        self.setPropertyGroup("CanScatterWorkspace", 'Can')
        self.setPropertyGroup("CanScatterMonitorWorkspace", 'Can')
        self.setPropertyGroup("CanTransmissionWorkspace", 'Can')
        self.setPropertyGroup("CanDirectWorkspace", 'Can')

        # ----------
        # OUTPUT
        # ----------
        self.declareProperty('OutScaleFactor',
                             defaultValue=Property.EMPTY_DBL,
                             direction=Direction.Output,
                             doc='Applied scale factor.')

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

        # This breaks our flexibility with the reduction mode. We need to check if we can populate this based on
        # the available reduction modes for the state input. TODO: check if this is possible
        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceLAB',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc='The output workspace for the low-angle bank.')
        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceHAB',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc='The output workspace for the high-angle bank.')
        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceMerged',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc='The output workspace for the merged reduction.')
        self.setPropertyGroup("OutScaleFactor", 'Output')
        self.setPropertyGroup("OutShiftFactor", 'Output')
        self.setPropertyGroup("OutputWorkspaceLAB", 'Output')
        self.setPropertyGroup("OutputWorkspaceHAB", 'Output')
        self.setPropertyGroup("OutputWorkspaceMerged", 'Output')

        # CAN output
        # We want to output the can workspaces since they can be persited in the case of optimizations
        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceLABCan',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc=
            'The can output workspace for the low-angle bank, provided there is one.'
        )
        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceLABCanCount',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc=
            'The can count output workspace for the low-angle bank, provided there is one.'
        )
        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceLABCanNorm',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc=
            'The can norm output workspace for the low-angle bank, provided there is one.'
        )

        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceHABCan',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc=
            'The can output workspace for the high-angle bank, provided there is one.'
        )
        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceHABCanCount',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc=
            'The can count output workspace for the high-angle bank, provided there is one.'
        )
        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceHABCanNorm',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc=
            'The can norm output workspace for the high-angle bank, provided there is one.'
        )
        self.setPropertyGroup("OutputWorkspaceLABCan", 'Can Output')
        self.setPropertyGroup("OutputWorkspaceLABCanCount", 'Can Output')
        self.setPropertyGroup("OutputWorkspaceLABCanNorm", 'Can Output')
        self.setPropertyGroup("OutputWorkspaceHABCan", 'Can Output')
        self.setPropertyGroup("OutputWorkspaceHABCanCount", 'Can Output')
        self.setPropertyGroup("OutputWorkspaceHABCanNorm", 'Can Output')
Exemple #18
0
    def PyInit(self):

        positiveFloat = FloatBoundedValidator(0., exclusive=False)
        validRebinParams = RebinParamsValidator(AllowEmpty=True)
        orderedPairsValidator = FloatArrayOrderedPairsValidator()

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

        self.declareProperty(MultipleFileProperty('Runs',
                                                  action=FileAction.Load,
                                                  extensions=['nxs']),
                             doc='Run(s) to be processed.')

        processes = ['Cadmium', 'Empty', 'Vanadium', 'Sample']
        self.declareProperty(name='ProcessAs',
                             defaultValue='Sample',
                             validator=StringListValidator(processes),
                             doc='Choose the process type.')

        reduction_options = ['Powder', 'SingleCrystal']
        self.declareProperty(
            name='ReductionType',
            defaultValue='Powder',
            validator=StringListValidator(reduction_options),
            doc='Choose the appropriate reduction type for the data to process.'
        )

        self.declareProperty(
            'VanadiumWorkspace',
            '',
            doc='File(s) or workspaces containing vanadium data.')

        self.declareProperty('EmptyContainerWorkspace',
                             '',
                             doc='Empty container workspace.')

        self.declareProperty('EmptyContainerScaling',
                             1.0,
                             doc='Scaling factor for the empty container.')

        self.declareProperty(WorkspaceGroupProperty(
            'CadmiumWorkspace',
            '',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
                             doc='Cadmium absorber workspace.')

        self.copyProperties(
            'DirectILLCollectData',
            [common.PROP_FLAT_BKG, common.PROP_FLAT_BKG_WINDOW])

        self.declareProperty(
            'FlatBackgroundSource',
            "",
            doc=
            'File(s) or workspaces containing the source to calculate flat background.'
        )

        self.copyProperties(
            'DirectILLCollectData',
            [common.PROP_FLAT_BKG_SCALING, common.PROP_OUTPUT_FLAT_BKG_WS])

        self.copyProperties('DirectILLReduction', common.PROP_ABSOLUTE_UNITS)

        additional_inputs_group = 'Corrections'
        self.setPropertyGroup('VanadiumWorkspace', additional_inputs_group)
        self.setPropertyGroup('EmptyContainerWorkspace',
                              additional_inputs_group)
        self.setPropertyGroup('EmptyContainerScaling', additional_inputs_group)
        self.setPropertyGroup('CadmiumWorkspace', additional_inputs_group)
        self.setPropertyGroup(common.PROP_FLAT_BKG, additional_inputs_group)
        self.setPropertyGroup(common.PROP_FLAT_BKG_WINDOW,
                              additional_inputs_group)
        self.setPropertyGroup('FlatBackgroundSource', additional_inputs_group)
        self.setPropertyGroup(common.PROP_FLAT_BKG_SCALING,
                              additional_inputs_group)
        self.setPropertyGroup(common.PROP_OUTPUT_FLAT_BKG_WS,
                              additional_inputs_group)
        self.setPropertyGroup(common.PROP_ABSOLUTE_UNITS,
                              additional_inputs_group)

        self.copyProperties(
            'DirectILLCollectData',
            [common.PROP_NORMALISATION, common.PROP_MON_PEAK_SIGMA_MULTIPLIER])

        self.copyProperties('DirectILLCollectData',
                            common.PROP_INCIDENT_ENERGY_CALIBRATION)

        self.declareProperty(
            name='IncidentEnergy',
            defaultValue=0.0,
            validator=positiveFloat,
            doc='Value for the calibrated incident energy (meV).')

        self.copyProperties(
            'DirectILLCollectData',
            [common.PROP_ELASTIC_CHANNEL_MODE, common.PROP_EPP_METHOD])

        self.declareProperty(
            name='ElasticChannelIndex',
            defaultValue=0.0,
            validator=positiveFloat,
            doc=
            'Bin index value for the centre of the elastic peak. Can be a float.'
        )

        self.declareProperty(
            'SampleAngleOffset',
            0.0,
            doc='Value for the offset parameter in omega scan (degrees).')

        calibration_group = 'Calibration'
        self.setPropertyGroup(common.PROP_INCIDENT_ENERGY_CALIBRATION,
                              calibration_group)
        self.setPropertyGroup('IncidentEnergy', calibration_group)
        self.setPropertyGroup('ElasticChannelIndex', calibration_group)
        self.setPropertyGroup(common.PROP_ELASTIC_CHANNEL_MODE,
                              calibration_group)
        self.setPropertyGroup(common.PROP_EPP_METHOD, calibration_group)
        self.setPropertyGroup('SampleAngleOffset', calibration_group)

        # The mask workspace replaces MaskWorkspace parameter from PantherSingle and DiagnosticsWorkspace from directred
        self.declareProperty('MaskWorkspace',
                             '',
                             doc='File(s) or workspaces containing the mask.')

        self.declareProperty(IntArrayProperty(name='MaskedTubes',
                                              values=[],
                                              direction=Direction.Input),
                             doc='List of tubes to be masked.')

        self.declareProperty(
            'MaskThresholdMin',
            0.0,
            doc='Threshold level below which bins will be masked'
            ' to remove empty / background pixels.')

        self.declareProperty(
            'MaskThresholdMax',
            0.0,
            doc='Threshold level above which bins will be masked'
            ' to remove noisy pixels.')

        self.declareProperty(FloatArrayProperty(
            name='MaskedAngles', values=[], validator=orderedPairsValidator),
                             doc='Mask detectors in the given angular range.')

        self.declareProperty(
            'MaskWithVanadium',
            True,
            doc='Whether to mask using vanadium diagnostics workspace.')

        masking_group_name = 'Masking'
        self.setPropertyGroup('MaskWorkspace', masking_group_name)
        self.setPropertyGroup('MaskedTubes', masking_group_name)
        self.setPropertyGroup('MaskThresholdMin', masking_group_name)
        self.setPropertyGroup('MaskThresholdMax', masking_group_name)
        self.setPropertyGroup('MaskedAngles', masking_group_name)
        self.setPropertyGroup('MaskWithVanadium', masking_group_name)

        self.copyProperties(
            'DirectILLReduction',
            [common.PROP_REBINNING_W, common.PROP_REBINNING_PARAMS_W])

        self.declareProperty(FloatArrayProperty(name='MomentumTransferBinning',
                                                validator=validRebinParams),
                             doc='Momentum transfer binning parameters.')

        rebinning_group = 'Binning parameters'
        self.setPropertyGroup(common.PROP_REBINNING_W, rebinning_group)
        self.setPropertyGroup(common.PROP_REBINNING_PARAMS_W, rebinning_group)
        self.setPropertyGroup('MomentumTransferBinning', rebinning_group)

        self.declareProperty(
            name='AbsorptionCorrection',
            defaultValue='None',
            validator=StringListValidator(['None', 'Fast', 'Full']),
            doc='Choice of approach to absorption correction.')

        self.declareProperty(
            name='SelfAttenuationMethod',
            defaultValue='MonteCarlo',
            validator=StringListValidator(['Numerical', 'MonteCarlo']),
            doc='Choice of calculation method for the attenuation calculation.'
        )

        self.declareProperty(PropertyManagerProperty('SampleMaterial'),
                             doc='Sample material definitions.')

        self.declareProperty(PropertyManagerProperty('SampleGeometry'),
                             doc="Dictionary for the sample geometry.")

        self.declareProperty(PropertyManagerProperty('ContainerMaterial'),
                             doc='Container material definitions.')

        self.declareProperty(PropertyManagerProperty('ContainerGeometry'),
                             doc="Dictionary for the container geometry.")

        attenuation_group = 'Sample attenuation'
        self.setPropertyGroup('AbsorptionCorrection', attenuation_group)
        self.setPropertyGroup('SelfAttenuationMethod', attenuation_group)
        self.setPropertyGroup('SampleMaterial', attenuation_group)
        self.setPropertyGroup('SampleGeometry', attenuation_group)
        self.setPropertyGroup('ContainerMaterial', attenuation_group)
        self.setPropertyGroup('ContainerGeometry', attenuation_group)

        self.declareProperty(
            name=common.PROP_DET_GROUPING,
            defaultValue="",
            doc='Grouping pattern to reduce the granularity of the output.')

        self.declareProperty(
            name=common.PROP_DET_GROUPING_BY,
            defaultValue=1,
            doc=
            'Step to use when grouping detectors to reduce the granularity of the output.'
        )

        self.copyProperties(
            'DirectILLCollectData',
            [common.PROP_DET_HOR_GROUPING, common.PROP_DET_VER_GROUPING])

        self.declareProperty(
            name="ApplyGroupingBy",
            defaultValue=False,
            doc=
            'Whether to apply the pixel grouping horizontally or vertically to the data, and not'
            ' only to increase the statistics of the flat background calculation.'
        )

        self.declareProperty(
            name=common.PROP_GROUPING_ANGLE_STEP,
            defaultValue=0.0,
            validator=positiveFloat,
            doc=
            'A scattering angle step to which to group detectors, in degrees.')

        self.declareProperty(
            name='GroupingBehaviour',
            defaultValue="Sum",
            validator=StringListValidator(['Sum', 'Average']),
            doc='Defines which behaviour should be used when grouping pixels.')

        grouping_options_group = 'Grouping options'
        self.setPropertyGroup(common.PROP_DET_GROUPING, grouping_options_group)
        self.setPropertyGroup(common.PROP_DET_GROUPING_BY,
                              grouping_options_group)
        self.setPropertyGroup(common.PROP_DET_HOR_GROUPING,
                              grouping_options_group)
        self.setPropertyGroup(common.PROP_DET_VER_GROUPING,
                              grouping_options_group)
        self.setPropertyGroup('ApplyGroupingBy', grouping_options_group)
        self.setPropertyGroup(common.PROP_GROUPING_ANGLE_STEP,
                              grouping_options_group)
        self.setPropertyGroup('GroupingBehaviour', grouping_options_group)

        self.declareProperty(
            name="SaveOutput",
            defaultValue=True,
            doc="Whether to save the output directly after processing.")

        self.declareProperty(name='ClearCache',
                             defaultValue=False,
                             doc='Whether to clear intermediate workspaces.')
Exemple #19
0
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        self.declareProperty(
            "PublishToCache",
            True,
            direction=Direction.Input,
            doc=
            "Publish the calibration workspace to a cache, in order to avoid reloading "
            "for subsequent runs.")

        self.declareProperty(
            "UseCached",
            True,
            direction=Direction.Input,
            doc=
            "Checks if there are loaded files available. If they are, those files are used."
        )

        self.declareProperty(
            "MoveWorkspace",
            defaultValue=False,
            direction=Direction.Input,
            doc=
            "Move the workspace according to the SANSState setting. This might be useful"
            "for manual inspection.")

        # Beam coordinates if an initial move of the workspace is requested
        enabled_condition = EnabledWhenProperty("MoveWorkspace",
                                                PropertyCriterion.IsNotDefault)
        self.declareProperty(
            FloatArrayProperty(name='BeamCoordinates', values=[]),
            doc=
            'The coordinates which is used to position the instrument component(s). '
            'If the workspaces should be loaded with an initial move, then this '
            'needs to be specified.')
        # Components which are to be moved
        self.declareProperty(
            'Component',
            '',
            direction=Direction.Input,
            doc='Component that should be moved. '
            'If the workspaces should be loaded with an initial move, then this '
            'needs to be specified.')
        self.setPropertySettings("BeamCoordinates", enabled_condition)
        self.setPropertySettings("Component", enabled_condition)

        # ------------
        #  OUTPUT
        # ------------
        default_number_of_workspaces = 0

        # Sample Scatter Workspaces
        self.declareProperty(
            WorkspaceProperty('SampleScatterWorkspace',
                              '',
                              optional=PropertyMode.Optional,
                              direction=Direction.Output),
            doc=
            'The sample scatter workspace. This workspace does not contain monitors.'
        )
        self.declareProperty(
            WorkspaceProperty('SampleScatterMonitorWorkspace',
                              '',
                              optional=PropertyMode.Optional,
                              direction=Direction.Output),
            doc=
            'The sample scatter monitor workspace. This workspace only contains monitors.'
        )
        self.declareProperty(MatrixWorkspaceProperty(
            'SampleTransmissionWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The sample transmission workspace.')
        self.declareProperty(MatrixWorkspaceProperty(
            'SampleDirectWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The sample scatter direct workspace.')

        self.setPropertyGroup("SampleScatterWorkspace", 'Sample')
        self.setPropertyGroup("SampleScatterMonitorWorkspace", 'Sample')
        self.setPropertyGroup("SampleTransmissionWorkspace", 'Sample')
        self.setPropertyGroup("SampleDirectWorkspace", 'Sample')

        # Number of sample workspaces
        self.declareProperty('NumberOfSampleScatterWorkspaces',
                             defaultValue=default_number_of_workspaces,
                             direction=Direction.Output,
                             doc='The number of workspace for sample scatter.')
        self.declareProperty(
            'NumberOfSampleTransmissionWorkspaces',
            defaultValue=default_number_of_workspaces,
            direction=Direction.Output,
            doc='The number of workspace for sample transmission.')
        self.declareProperty('NumberOfSampleDirectWorkspaces',
                             defaultValue=default_number_of_workspaces,
                             direction=Direction.Output,
                             doc='The number of workspace for sample direct.')

        self.declareProperty(
            MatrixWorkspaceProperty('CanScatterWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc=
            'The can scatter workspace. This workspace does not contain monitors.'
        )
        self.declareProperty(
            MatrixWorkspaceProperty('CanScatterMonitorWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc=
            'The can scatter monitor workspace. This workspace only contains monitors.'
        )
        self.declareProperty(MatrixWorkspaceProperty(
            'CanTransmissionWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The can transmission workspace.')
        self.declareProperty(MatrixWorkspaceProperty(
            'CanDirectWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The sample scatter direct workspace.')
        self.setPropertyGroup("CanScatterWorkspace", 'Can')
        self.setPropertyGroup("CanScatterMonitorWorkspace", 'Can')
        self.setPropertyGroup("CanTransmissionWorkspace", 'Can')
        self.setPropertyGroup("CanDirectWorkspace", 'Can')

        self.declareProperty('NumberOfCanScatterWorkspaces',
                             defaultValue=default_number_of_workspaces,
                             direction=Direction.Output,
                             doc='The number of workspace for can scatter.')
        self.declareProperty(
            'NumberOfCanTransmissionWorkspaces',
            defaultValue=default_number_of_workspaces,
            direction=Direction.Output,
            doc='The number of workspace for can transmission.')
        self.declareProperty('NumberOfCanDirectWorkspaces',
                             defaultValue=default_number_of_workspaces,
                             direction=Direction.Output,
                             doc='The number of workspace for can direct.')
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        # WORKSPACES
        # Scatter Workspaces
        self.declareProperty(
            MatrixWorkspaceProperty('ScatterWorkspace',
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc=
            'The scatter workspace. This workspace does not contain monitors.')
        self.declareProperty(
            MatrixWorkspaceProperty('ScatterMonitorWorkspace',
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc=
            'The scatter monitor workspace. This workspace only condtains monitors.'
        )

        # Transmission Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'TransmissionWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The transmission workspace.')

        # Direct Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'DirectWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The direct workspace.')

        self.setPropertyGroup("ScatterWorkspace", 'Data')
        self.setPropertyGroup("ScatterMonitorWorkspace", 'Data')
        self.setPropertyGroup("TransmissionWorkspace", 'Data')
        self.setPropertyGroup("DirectWorkspace", 'Data')

        allowed_detectors = StringListValidator([
            DetectorType.to_string(DetectorType.LAB),
            DetectorType.to_string(DetectorType.HAB)
        ])
        self.declareProperty(
            "Component",
            DetectorType.to_string(DetectorType.LAB),
            validator=allowed_detectors,
            direction=Direction.Input,
            doc="The component of the instrument which is to be reduced.")

        # 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.")

        self.declareProperty("CompatibilityMode",
                             False,
                             direction=Direction.Input)

        self.declareProperty("Centre1", 0.0, direction=Direction.Input)
        self.declareProperty("Centre2", 0.0, direction=Direction.Input)

        self.declareProperty("RMax", 0.26, direction=Direction.Input)
        self.declareProperty("RMin", 0.06, direction=Direction.Input)

        # ----------
        # OUTPUT
        # ----------
        self.declareProperty(MatrixWorkspaceProperty(
            "OutputWorkspaceLeft",
            'Left',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The left output workspace.')

        self.declareProperty(MatrixWorkspaceProperty(
            "OutputWorkspaceTop",
            'Top',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The top output workspace.')

        self.declareProperty(MatrixWorkspaceProperty(
            "OutputWorkspaceRight",
            'Right',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The right output workspace.')

        self.declareProperty(MatrixWorkspaceProperty(
            "OutputWorkspaceBottom",
            'Bottom',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The bottom output workspace.')
Exemple #21
0
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        # WORKSPACES
        # Scatter Workspaces
        self.declareProperty(
            MatrixWorkspaceProperty('ScatterWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Input),
            doc=
            'The scatter workspace. This workspace does not contain monitors.')
        self.declareProperty(
            MatrixWorkspaceProperty('DummyMaskWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Input),
            doc=
            'The histogram workspace containing mask bins for the event workspace, to be copied '
            'over after event slicing.')
        self.declareProperty(
            MatrixWorkspaceProperty('ScatterMonitorWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Input),
            doc=
            'The scatter monitor workspace. This workspace only contains monitors.'
        )
        # Direct Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'DirectWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The direct workspace.')
        # Transmission Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'TransmissionWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The transmission workspace')

        self.setPropertyGroup("ScatterWorkspace", 'Data')
        self.setPropertyGroup("ScatterMonitorWorkspace", 'Data')
        self.setPropertyGroup("DummyMaskWorkspace", 'Data')
        self.setPropertyGroup("DirectWorkspace", 'Data')
        self.setPropertyGroup("TransmissionWorkspace", 'Data')

        # The component
        allowed_detectors = StringListValidator([
            DetectorType.to_string(DetectorType.LAB),
            DetectorType.to_string(DetectorType.HAB)
        ])
        self.declareProperty(
            "Component",
            DetectorType.to_string(DetectorType.LAB),
            validator=allowed_detectors,
            direction=Direction.Input,
            doc="The component of the instrument which is to be reduced.")

        # 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.")

        # ----------
        # OUTPUT
        # ----------
        # SANSReductionCoreEventSlice has the same outputs as SANSReductionCore
        self._pyinit_output()
Exemple #22
0
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        # Workspace which is to be cropped
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        self.declareProperty(MatrixWorkspaceProperty(
            "SampleScatterWorkspace",
            '',
            optional=PropertyMode.Mandatory,
            direction=Direction.Input),
                             doc='The sample scatter data')

        self.declareProperty(MatrixWorkspaceProperty(
            "SampleScatterMonitorWorkspace",
            '',
            optional=PropertyMode.Mandatory,
            direction=Direction.Input),
                             doc='The sample scatter monitor data')

        self.declareProperty(MatrixWorkspaceProperty(
            "SampleTransmissionWorkspace",
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The sample transmission data')

        self.declareProperty(MatrixWorkspaceProperty(
            "SampleDirectWorkspace",
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The sample direct data')

        self.declareProperty(MatrixWorkspaceProperty(
            "CanScatterWorkspace",
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The can scatter data')

        self.declareProperty(MatrixWorkspaceProperty(
            "CanScatterMonitorWorkspace",
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The can scatter monitor data')

        self.declareProperty(MatrixWorkspaceProperty(
            "CanTransmissionWorkspace",
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The can transmission data')

        self.declareProperty(MatrixWorkspaceProperty(
            "CanDirectWorkspace",
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The can direct data')

        # The component, i.e. HAB or LAB
        allowed_detectors = StringListValidator([
            DetectorType.to_string(DetectorType.LAB),
            DetectorType.to_string(DetectorType.HAB)
        ])
        self.declareProperty(
            "Component",
            DetectorType.to_string(DetectorType.LAB),
            validator=allowed_detectors,
            direction=Direction.Input,
            doc="The component of the instrument which is to be reduced.")

        self.declareProperty("Iterations",
                             10,
                             direction=Direction.Input,
                             doc="The maximum number of iterations.")

        self.declareProperty("RMin",
                             0.6,
                             direction=Direction.Input,
                             doc="The inner radius of the quartile mask")

        self.declareProperty('RMax',
                             0.28,
                             direction=Direction.Input,
                             doc="The outer radius of the quartile mask")

        self.declareProperty('Position1Start',
                             0.0,
                             direction=Direction.Input,
                             doc="The search start position1")

        self.declareProperty('Position2Start',
                             0.0,
                             direction=Direction.Input,
                             doc="The search start position2")

        self.declareProperty('Tolerance',
                             0.0001251,
                             direction=Direction.Input,
                             doc="The search tolerance")

        self.declareProperty(
            'Direction',
            FindDirectionEnum.to_string(FindDirectionEnum.All),
            direction=Direction.Input,
            doc=
            "The search direction is an enumerable which can be either All, LeftRight or UpDown"
        )

        self.declareProperty(
            'Verbose',
            False,
            direction=Direction.Input,
            doc="Whether to keep workspaces from each iteration in ADS.")

        # ----------
        # Output
        # ----------
        # Workspace which is to be cropped

        self.declareProperty(
            'Centre1',
            0.0,
            direction=Direction.Output,
            doc="The centre position found in the first dimension")
        self.declareProperty(
            'Centre2',
            0.0,
            direction=Direction.Output,
            doc="The centre position found in the second dimension")
Exemple #23
0
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        # WORKSPACES
        # Scatter Workspaces
        self.declareProperty(
            MatrixWorkspaceProperty('ScatterWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Input),
            doc=
            'The scatter workspace. This workspace does not contain monitors.')
        self.declareProperty(
            MatrixWorkspaceProperty('ScatterMonitorWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Input),
            doc=
            'The scatter monitor workspace. This workspace only contains monitors.'
        )

        # Transmission Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'TransmissionWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The transmission workspace.')

        # Direct Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'DirectWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The direct workspace.')

        self.setPropertyGroup("ScatterWorkspace", 'Data')
        self.setPropertyGroup("ScatterMonitorWorkspace", 'Data')
        self.setPropertyGroup("TransmissionWorkspace", 'Data')
        self.setPropertyGroup("DirectWorkspace", 'Data')

        # The component
        allowed_detectors = StringListValidator([
            DetectorType.to_string(DetectorType.LAB),
            DetectorType.to_string(DetectorType.HAB)
        ])
        self.declareProperty(
            "Component",
            DetectorType.to_string(DetectorType.LAB),
            validator=allowed_detectors,
            direction=Direction.Input,
            doc="The component of the instrument which is to be reduced.")

        # 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.")

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

        self.declareProperty(
            MatrixWorkspaceProperty('SumOfCounts',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc='The sum of the counts of the output workspace.')

        self.declareProperty(
            MatrixWorkspaceProperty('SumOfNormFactors',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc='The sum of the counts of the output workspace.')

        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')
Exemple #24
0
    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')
 def PyInit(self):
     self.declareProperty(PropertyManagerProperty("Args"))
    def PyInit(self):

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.declareProperty('ClearCache', True,
                             doc='Whether or not to delete intermediate workspaces.')
    def _pyinit(self):
        # ----------
        # INPUT
        # ----------
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

        self.declareProperty(
            "UseOptimizations",
            True,
            direction=Direction.Input,
            doc=
            "When enabled the ADS is being searched for already loaded and reduced workspaces. "
            "Depending on your concrete reduction, this could provide a significant"
            " performance boost")

        self.declareProperty(
            "SaveCan",
            False,
            direction=Direction.Input,
            doc=
            "When enabled, the unsubtracted can and sam workspaces are added to the ADS."
        )

        # Sample Scatter Workspaces
        self.declareProperty(
            MatrixWorkspaceProperty('SampleScatterWorkspace',
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc=
            'The sample scatter workspace. This workspace does not contain monitors.'
        )
        self.declareProperty(
            MatrixWorkspaceProperty('SampleScatterMonitorWorkspace',
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc=
            'The sample scatter monitor workspace. This workspace only contains monitors.'
        )

        # Sample Transmission Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'SampleTransmissionWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The sample transmission workspace.')

        # Sample Direct Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'SampleDirectWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The sample scatter direct workspace.')

        self.setPropertyGroup("SampleScatterWorkspace", 'Sample')
        self.setPropertyGroup("SampleScatterMonitorWorkspace", 'Sample')
        self.setPropertyGroup("SampleTransmissionWorkspace", 'Sample')
        self.setPropertyGroup("SampleDirectWorkspace", 'Sample')

        # Can Scatter Workspaces
        self.declareProperty(
            MatrixWorkspaceProperty('CanScatterWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Input),
            doc=
            'The can scatter workspace. This workspace does not contain monitors.'
        )
        self.declareProperty(
            MatrixWorkspaceProperty('CanScatterMonitorWorkspace',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Input),
            doc=
            'The can scatter monitor workspace. This workspace only contains monitors.'
        )

        # Sample Transmission Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'CanTransmissionWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The can transmission workspace.')

        # Sample Direct Workspace
        self.declareProperty(MatrixWorkspaceProperty(
            'CanDirectWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='The sample scatter direct workspace.')

        self.setPropertyGroup("CanScatterWorkspace", 'Can')
        self.setPropertyGroup("CanScatterMonitorWorkspace", 'Can')
        self.setPropertyGroup("CanTransmissionWorkspace", 'Can')
        self.setPropertyGroup("CanDirectWorkspace", 'Can')

        # ----------
        # OUTPUT
        # ----------
        self._declare_output_properties()