コード例 #1
0
 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.')
コード例 #2
0
 def _get_input_runs_validator():
     mandatoryInputRuns = CompositeValidator()
     mandatoryInputRuns.add(StringArrayMandatoryValidator())
     lenValidator = StringArrayLengthValidator()
     lenValidator.setLengthMin(1)
     mandatoryInputRuns.add(lenValidator)
     return mandatoryInputRuns
コード例 #3
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')
コード例 #4
0
    def PyInit(self):
        arrvalidator = StringArrayMandatoryValidator()
        lrg='Input'
        self.declareProperty(StringArrayProperty('Workspaces', values=[], validator=arrvalidator,\
            direction=Direction.Input), doc='list of input workspaces')
        self.declareProperty('LoadErrors', True, direction=Direction.Input,\
            doc='Do we load error data contained in the workspaces?')
        self.declareProperty(FloatArrayProperty('ParameterValues', values=[],\
            validator=FloatArrayMandatoryValidator(),direction=Direction.Input), doc='list of input parameter values')
        self.setPropertyGroup('Workspaces', lrg)
        self.setPropertyGroup('LoadErrors', lrg)
        self.setPropertyGroup('ParameterValues', lrg)

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

        lrg='Output'
        self.declareProperty(FloatArrayProperty('TargetParameters', values=[], ), doc="Parameters to interpolate the structure factor")
        self.declareProperty(StringArrayProperty('OutputWorkspaces', values=[], validator=arrvalidator),\
            doc='list of output workspaces to save the interpolated structure factors')
        self.setPropertyGroup('TargetParameters', lrg)
        self.setPropertyGroup('OutputWorkspaces', lrg)
        self.channelgroup = None
コード例 #5
0
 def PyInit(self):
     self.declareProperty(
         FloatArrayProperty("FloatInput", FloatArrayMandatoryValidator()))
     self.declareProperty(
         IntArrayProperty("IntInput", IntArrayMandatoryValidator()))
     self.declareProperty(
         StringArrayProperty("StringInput",
                             StringArrayMandatoryValidator()))
コード例 #6
0
 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.'
     )
コード例 #7
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.')
コード例 #8
0
    def PyInit(self):

        mandatoryInputRuns = CompositeValidator()
        mandatoryInputRuns.add(StringArrayMandatoryValidator())
        self.declareProperty(StringArrayProperty('SampleRuns',
                                                 values=[],
                                                 validator=mandatoryInputRuns),
                             doc='Optional cycle number followed by comma separated range of\n'
                                 'sample runs as [cycle::] n1,n2,..\n'
                                 ' eg 123::7333-7341,7345')

        self.declareProperty(name='EmptyRuns',
                             defaultValue='',
                             doc='Optional cycle number followed by comma separated range of\n'
                                 'runs as [cycle::] n1,n2,..\n'
                                 '  eg 123::6300-6308')

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

        self.declareProperty(name='CalibrationRuns',
                             defaultValue='',
                             doc='Optional cycle number followed by comma separated range of\n'
                                 'runs as [cycle::] n1,n2,..\n'
                                 '  eg 123::6350-6365')

        self.declareProperty(name='EmptyCalibrationRuns',
                             defaultValue='',
                             doc='Optional cycle number followed by comma separated range of\n'
                                 'runs as [cycle::] n1,n2,..\n'
                                 '  eg 123::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='0.0, 0.02, 2.6',
                             doc='Momentum transfer range in inverse Angstroms,\n'
                                 ' expressed as min, step, max')

        self.declareProperty(name='Processing', defaultValue='SOFQW1-Centre',
                             validator=StringListValidator(
                                 ['SOFQW1-Centre', 'SOFQW3-NormalisedPolygon', 'NXSPE']),
                             doc='Convert to SOFQW or save file as NXSPE,\n'
                                 'note SOFQW3 is more accurate but much slower than SOFQW1.')

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

        self.declareProperty(WorkspaceProperty('OutputWorkspace', '',
                                               direction=Direction.Output),
                             doc='Name for the reduced workspace.')

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

        self.declareProperty(name='KeepIntermediateWorkspaces', defaultValue=False,
                             doc='Whether to keep the intermediate sample and calibration\n'
                                 'workspaces for diagnostic checks.')

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