Ejemplo n.º 1
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
Ejemplo n.º 2
0
 def PyInit(self):
     self.declareProperty(
         FloatArrayProperty("FloatInput", FloatArrayMandatoryValidator()))
     self.declareProperty(
         IntArrayProperty("IntInput", IntArrayMandatoryValidator()))
     self.declareProperty(
         StringArrayProperty("StringInput",
                             StringArrayMandatoryValidator()))
Ejemplo n.º 3
0
 def PyInit(self):
     self.declareProperty("StringInput", "",
                          StringMandatoryValidator())
     self.declareProperty(
         FloatArrayProperty("ArrayInput",
                            FloatArrayMandatoryValidator()))
Ejemplo n.º 4
0
    def PyInit(self):

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

        self.declareProperty(
            MultipleFileProperty('BackgroundRun',
                                 action=FileAction.OptionalLoad,
                                 extensions=['nxs']),
            doc='Run number(s) of background (empty can) run(s).')

        self.declareProperty(
            MultipleFileProperty('CalibrationRun',
                                 action=FileAction.OptionalLoad,
                                 extensions=['nxs']),
            doc='Run number(s) of vanadium calibration run(s).')

        self.declareProperty(
            MultipleFileProperty('CalibrationBackgroundRun',
                                 action=FileAction.OptionalLoad,
                                 extensions=['nxs']),
            doc=
            'Run number(s) of background (empty can) run(s) for vanadium run.')

        self.declareProperty(
            MultipleFileProperty('AlignmentRun',
                                 action=FileAction.OptionalLoad,
                                 extensions=['nxs']),
            doc='Run number(s) of vanadium run(s) used for '
            'peak alignment for UnmirrorOption=[5, 7]')

        self.declareProperty(name='SumRuns',
                             defaultValue=False,
                             doc='Whether to sum all the input runs.')

        self.declareProperty(
            name='CropDeadMonitorChannels',
            defaultValue=False,
            doc='Whether or not to exclude the first and last few channels '
            'with 0 monitor count in the energy transfer formula.')

        self.declareProperty(
            name='UnmirrorOption',
            defaultValue=6,
            validator=IntBoundedValidator(lower=0, upper=7),
            doc='Unmirroring options : \n'
            '0 no unmirroring\n'
            '1 sum of left and right\n'
            '2 left\n'
            '3 right\n'
            '4 shift right according to left and sum\n'
            '5 like 4, but use alignment run for peak positions\n'
            '6 center both left and right at zero and sum\n'
            '7 like 6, but use alignment run for peak positions')

        self.declareProperty(name='BackgroundScalingFactor',
                             defaultValue=1.,
                             validator=FloatBoundedValidator(lower=0),
                             doc='Scaling factor for background subtraction')

        self.declareProperty(
            name='CalibrationBackgroundScalingFactor',
            defaultValue=1.,
            validator=FloatBoundedValidator(lower=0),
            doc=
            'Scaling factor for background subtraction for vanadium calibration'
        )

        self.declareProperty(
            name='CalibrationPeakRange',
            defaultValue=[-0.003, 0.003],
            validator=FloatArrayMandatoryValidator(),
            doc='Peak range for integration over calibration file peak (in mev)'
        )

        self.declareProperty(
            FileProperty('MapFile',
                         '',
                         action=FileAction.OptionalLoad,
                         extensions=['map', 'xml']),
            doc='Filename of the detector grouping map file to use. \n'
            'By default all the pixels will be summed per each tube. \n'
            'Use .map or .xml file (see GroupDetectors documentation) '
            'only if different range is needed for each tube.')

        self.declareProperty(
            name='ManualPSDIntegrationRange',
            defaultValue=[1, 128],
            doc='Integration range of vertical pixels in each PSD tube. \n'
            'By default all the pixels will be summed per each tube. \n'
            'Use this option if the same range (other than default) '
            'is needed for all the tubes.')

        self.declareProperty(name='Analyser',
                             defaultValue='silicon',
                             validator=StringListValidator(['silicon']),
                             doc='Analyser crystal.')

        self.declareProperty(name='Reflection',
                             defaultValue='111',
                             validator=StringListValidator(['111', '311']),
                             doc='Analyser reflection.')

        self.declareProperty(WorkspaceGroupProperty(
            'OutputWorkspace', '', direction=Direction.Output),
                             doc='Group name for the reduced workspace(s).')

        self.declareProperty(name='SpectrumAxis',
                             defaultValue='SpectrumNumber',
                             validator=StringListValidator(
                                 ['SpectrumNumber', '2Theta', 'Q', 'Q2']),
                             doc='The spectrum axis conversion target.')
    def PyInit(self):
        # input
        self.declareProperty(MatrixWorkspaceProperty(
            'InputWorkspace',
            '',
            direction=Direction.Input,
            optional=PropertyMode.Mandatory),
                             doc='Particle counts as a function of wavelength')

        self.declareProperty(MatrixWorkspaceProperty(
            'InputMaskingWorkspace',
            '',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
                             doc='Mask for the scattering data')

        # blocked beam, beam shape and detector corrections
        self.declareProperty(MatrixWorkspaceProperty(
            'BlockedBeamWorkspace',
            '',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
                             doc='Blocked beam scattering')

        self.declareProperty(
            MatrixWorkspaceProperty(
                'EmptyBeamSpectrumShapeWorkspace',
                '',
                direction=Direction.Input,
                optional=PropertyMode.Mandatory,
                validator=WorkspaceUnitValidator("Wavelength")),
            doc=
            'Empty beam transmission, where only a given wavelength slice is considered'
        )

        self.declareProperty(MatrixWorkspaceProperty(
            'SensitivityCorrectionMatrix',
            '',
            direction=Direction.Input,
            optional=PropertyMode.Optional),
                             doc='Detector sensitivity calibration data set')

        self.declareProperty(MatrixWorkspaceProperty(
            'TransmissionWorkspace',
            '',
            direction=Direction.Input,
            optional=PropertyMode.Mandatory),
                             doc='Sample transmission workspace')

        self.declareProperty(MatrixWorkspaceProperty(
            'TransmissionEmptyBeamWorkspace',
            '',
            direction=Direction.Input,
            optional=PropertyMode.Mandatory),
                             doc='Empty beam transmission workspace')

        self.declareProperty(MatrixWorkspaceProperty(
            'TransmissionMaskingWorkspace',
            '',
            direction=Direction.Input,
            optional=PropertyMode.Mandatory),
                             doc='Mask for the transmission data')

        self.declareProperty(
            name='FitMethod',
            defaultValue='log',
            doc='Function to use to fit transmission; can be Linear,'
            ' Log, Polynomial (first letter shall be capital)')

        self.declareProperty(
            name='PolynomialOrder',
            defaultValue='3',
            doc=
            'Used only for Polynomial function, but needed as an input parameter anyway'
        )

        self.declareProperty(name='ScalingFactor',
                             defaultValue=1.0,
                             validator=FloatBoundedValidator(lower=0.0),
                             doc='Attenuating factor')

        self.declareProperty(name='SampleThickness',
                             defaultValue=1.0,
                             validator=FloatBoundedValidator(lower=0.0),
                             doc='Thickness of sample')

        self.declareProperty(
            FloatArrayProperty('BinningWavelength',
                               direction=Direction.Input,
                               validator=FloatArrayMandatoryValidator()),
            doc=
            'Wavelength boundaries for reduction: a comma separated list of first bin boundary,'
            ' width, last bin boundary')

        self.declareProperty(
            FloatArrayProperty('BinningWavelengthTransm',
                               direction=Direction.Input,
                               validator=FloatArrayMandatoryValidator()),
            doc=
            'Wavelengths boundaries for transmission binning: a comma separated list of first bin'
            ' boundary, width, last bin')

        self.declareProperty(
            FloatArrayProperty('BinningQ',
                               direction=Direction.Input,
                               validator=FloatArrayMandatoryValidator()),
            doc=
            'Output Q-boundaries: a comma separated list of first bin boundary,'
            ' width, last bin boundary')

        self.declareProperty(
            name='Timemode',
            defaultValue=True,
            doc='If data collected in ToF or monochromatic mode')

        self.declareProperty(
            name='AccountForGravity',
            defaultValue=True,
            doc='Whether to correct for the effects of gravity')

        self.declareProperty(
            name='SolidAngleWeighting',
            defaultValue=True,
            doc='If True, pixels will be weighted by their solid angle')

        self.declareProperty(
            name='RadiusCut',
            defaultValue=1.0,
            validator=FloatBoundedValidator(lower=0.0),
            doc=
            'To increase resolution some wavelengths are excluded within this distance from the'
            ' beam center (mm). Note that RadiusCut and WaveCut both need to be larger than 0 to'
            ' affect the effective cutoff. See the algorithm description for a detailed'
            ' explanation of the cutoff.')

        self.declareProperty(
            name='WaveCut',
            defaultValue=1.0,
            validator=FloatBoundedValidator(lower=0.0),
            doc=
            'To increase resolution by starting to remove some wavelengths below this threshold'
            ' (angstrom). Note that WaveCut and RadiusCut both need to be larger than 0 to affect'
            ' on the effective cutoff. See the algorithm description for a detailed explanation'
            ' of the cutoff.')

        self.declareProperty(
            name='WideAngleCorrection',
            defaultValue=True,
            doc=
            'If true, the wide angle correction for transmissions will be applied'
        )

        self.declareProperty(
            name='Reduce2D',
            defaultValue=False,
            doc='If true, 2D data reduction will be performed')

        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspace',
                                    '',
                                    direction=Direction.Output),
            doc=
            'Name of the workspace that contains the result of the calculation. '
            'Created automatically.')

        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceTransmissionFit',
                                    '',
                                    direction=Direction.Output),
            # This works only when transmission is True. Problems starts when it is not...
            doc='Counts vs wavelength, fit for the sample transmission')