def _pyinit_output(self):
        # ----------
        # OUTPUT
        # ----------
        self.declareProperty(WorkspaceGroupProperty(
            "OutputWorkspaces", '', direction=Direction.Output),
                             doc='The output workspace.')

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

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

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

        self.declareProperty(WorkspaceGroupProperty(
            'UnfittedTransmissionWorkspaces',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The unfitted transmission workspace')
示例#2
0
    def PyInit(self):
        self.declareProperty(name='Program', defaultValue='QL',
                             validator=StringListValidator(['QL', 'QSe']),
                             doc='The type of program to run (either QL or QSe)')

        self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '', direction=Direction.Input),
                             doc='Name of the Sample input Workspace')

        self.declareProperty(MatrixWorkspaceProperty('ResolutionWorkspace', '', direction=Direction.Input),
                             doc='Name of the resolution input Workspace')

        self.declareProperty(WorkspaceGroupProperty('ResNormWorkspace', '',
                                                    optional=PropertyMode.Optional,
                                                    direction=Direction.Input),
                             doc='Name of the ResNorm input Workspace')

        self.declareProperty(name='MinRange', defaultValue=-0.2,
                             doc='The start of the fit range. Default=-0.2')

        self.declareProperty(name='MaxRange', defaultValue=0.2,
                             doc='The end of the fit range. Default=0.2')

        self.declareProperty(name='SampleBins', defaultValue=1,
                             doc='The number of sample bins')

        self.declareProperty(name='ResolutionBins', defaultValue=1,
                             doc='The number of resolution bins')

        self.declareProperty(name='Elastic', defaultValue=True,
                             doc='Fit option for using the elastic peak')

        self.declareProperty(name='Background', defaultValue='Flat',
                             validator=StringListValidator(['Sloping', 'Flat', 'Zero']),
                             doc='Fit option for the type of background')

        self.declareProperty(name='FixedWidth', defaultValue=True,
                             doc='Fit option for using FixedWidth')

        self.declareProperty(name='UseResNorm', defaultValue=False,
                             doc='fit option for using ResNorm')

        self.declareProperty(name='WidthFile', defaultValue='', doc='The name of the fixedWidth file')

        self.declareProperty(name='Loop', defaultValue=True, doc='Switch Sequential fit On/Off')

        self.declareProperty(WorkspaceGroupProperty('OutputWorkspaceFit', '', direction=Direction.Output),
                             doc='The name of the fit output workspaces')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspaceResult', '', direction=Direction.Output),
                             doc='The name of the result output workspaces')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspaceProb', '',
                                                     optional=PropertyMode.Optional,
                                                     direction=Direction.Output),
                             doc='The name of the probability output workspaces')
示例#3
0
    def PyInit(self):
        self.declareProperty(MatrixWorkspaceProperty(
            'SampleWorkspace', '', direction=Direction.Input),
                             doc='Name of the Sample input Workspace')

        self.declareProperty(MatrixWorkspaceProperty(
            'ResolutionWorkspace', '', direction=Direction.Input),
                             doc='Name of the resolution input Workspace')

        self.declareProperty(name='EMin',
                             defaultValue=-0.2,
                             doc='The start of the fitting range')

        self.declareProperty(name='EMax',
                             defaultValue=0.2,
                             doc='The end of the fitting range')

        self.declareProperty(name='SampleBins',
                             defaultValue=1,
                             doc='The number of sample bins')

        self.declareProperty(name='Elastic',
                             defaultValue=True,
                             doc='Fit option for using the elastic peak')

        self.declareProperty(name='Background',
                             defaultValue='Flat',
                             validator=StringListValidator(
                                 ['Sloping', 'Flat', 'Zero']),
                             doc='Fit option for the type of background')

        self.declareProperty(name='NumberSigma',
                             defaultValue=50,
                             doc='Number of sigma values')

        self.declareProperty(name='NumberBeta',
                             defaultValue=30,
                             doc='Number of beta values')

        self.declareProperty(name='Loop',
                             defaultValue=True,
                             doc='Switch Sequential fit On/Off')

        self.declareProperty(WorkspaceGroupProperty(
            'OutputWorkspaceFit', '', direction=Direction.Output),
                             doc='The name of the fit output workspaces')

        self.declareProperty(WorkspaceGroupProperty(
            'OutputWorkspaceContour', '', direction=Direction.Output),
                             doc='The name of the contour output workspaces')
    def PyInit(self):
        self.declareProperty(MatrixWorkspaceProperty(
            'SampleWorkspace', '', direction=Direction.Input),
                             doc='Name for the input Sample workspace.')

        self.declareProperty(WorkspaceGroupProperty(
            'CorrectionsWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='Name for the input Corrections workspace.')

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

        self.declareProperty(name='CanScaleFactor',
                             defaultValue=1.0,
                             doc='Factor to scale the can data')

        self.declareProperty(MatrixWorkspaceProperty(
            'OutputWorkspace', '', direction=Direction.Output),
                             doc='The output corrections workspace.')
 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.')
示例#6
0
文件: ResNorm2.py 项目: mcvine/mantid
    def PyInit(self):
        self.declareProperty(MatrixWorkspaceProperty('ResolutionWorkspace', '',
                                                     direction=Direction.Input),
                             doc='Workspace containing resolution')

        self.declareProperty(MatrixWorkspaceProperty('VanadiumWorkspace', '',
                                                     direction=Direction.Input),
                             doc='Workspace containing reduction of vanadium run')

        self.declareProperty(name='EnergyMin',
                             defaultValue=-0.2,
                             doc='Minimum energy for fit. Default=-0.2')

        self.declareProperty(name='EnergyMax',
                             defaultValue=0.2,
                             doc='Maximum energy for fit. Default=0.2')

        self.declareProperty(name='CreateOutput',
                             defaultValue=False,
                             doc='Create additional fitting output')

        self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '',
                                                    direction=Direction.Output),
                             doc='Fitted parameter output')

        self.declareProperty(ITableWorkspaceProperty('OutputWorkspaceTable', '',
                                                     optional=PropertyMode.Optional,
                                                     direction=Direction.Output),
                             doc='Table workspace of fit parameters')
示例#7
0
    def PyInit(self):
        self.declareProperty(MatrixWorkspaceProperty(
            'SampleWorkspace', '', direction=Direction.Input),
                             doc='Name for the input Sample workspace.')

        self.declareProperty(WorkspaceGroupProperty(
            'CorrectionsWorkspace',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Input),
                             doc='Name for the input Corrections workspace.')

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

        self.declareProperty(name='CanScaleFactor',
                             defaultValue=1.0,
                             doc='Factor to scale the can data')

        self.declareProperty(name='CanShiftFactor',
                             defaultValue=0.0,
                             doc='Amount by which to shift the container data')

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

        self.declareProperty(
            name='RebinCanToSample',
            defaultValue=True,
            doc='Enable or disable RebinToWorkspace on CanWorkspace.')
示例#8
0
    def PyInit(self):
        # Sample
        self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '', direction=Direction.Input),
                             doc='Sample workspace')
        self.declareProperty(name='SampleChemicalFormula', defaultValue='',
                             validator=StringMandatoryValidator(),
                             doc='Chemical formula for the sample')
        self.declareProperty(name='SampleDensityType', defaultValue = 'Mass Density',
                             validator=StringListValidator(['Mass Density', 'Number Density']),
                             doc = 'Use of Mass density or Number density')
        self.declareProperty(name='SampleDensity', defaultValue=0.1,
                             doc='Mass density (g/cm^3) or Number density (atoms/Angstrom^3)')
        self.declareProperty(name='SampleHeight', defaultValue=1.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample height')
        self.declareProperty(name='SampleWidth', defaultValue=1.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample width')
        self.declareProperty(name='SampleThickness', defaultValue=0.5,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample thickness')

        # Container
        self.declareProperty(MatrixWorkspaceProperty('CanWorkspace', '', optional=PropertyMode.Optional,
                                                     direction=Direction.Input),
                             doc='Container workspace')
        self.declareProperty(name='UseCanCorrections', defaultValue=False,
                             doc='Use can corrections in subtraction')
        self.declareProperty(name='CanChemicalFormula', defaultValue='',
                             doc='Chemical formula for the Container')
        self.declareProperty(name='CanDensityType', defaultValue = 'Mass Density',
                             validator=StringListValidator(['Mass Density', 'Number Density']),
                             doc = 'Use of Mass density or Number density')
        self.declareProperty(name='CanDensity', defaultValue=0.1,
                             doc='Mass density (g/cm^3) or Number density (atoms/Angstrom^3)')
        self.declareProperty(name='CanFrontThickness', defaultValue=0.1,
                             validator=FloatBoundedValidator(0.0),
                             doc='Can front thickness')
        self.declareProperty(name='CanBackThickness', defaultValue=0.1,
                             validator=FloatBoundedValidator(0.0),
                             doc='Can back thickness')
        self.declareProperty(name='CanScaleFactor', defaultValue=1.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Scale factor to multiply can data')

        # General
        self.declareProperty(name='ElementSize', defaultValue=0.1,
                             validator=FloatBoundedValidator(0.0),
                             doc='Element size in mm')

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

        self.declareProperty(WorkspaceGroupProperty('CorrectionsWorkspace', '', direction=Direction.Output,
                                                    optional=PropertyMode.Optional),
                             doc='The workspace group to save correction factors')
示例#9
0
    def PyInit(self):

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.declareProperty(name='AlignTubes', defaultValue=True,
                             doc='Align the tubes vertically and horizontally according to IPF.')
示例#10
0
    def PyInit(self):
        # Sample options
        self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '', direction=Direction.Input),
                             doc='Sample workspace.')

        self.declareProperty(name='SampleChemicalFormula', defaultValue='', validator=StringMandatoryValidator(),
                             doc='Sample chemical formula')
        self.declareProperty(name='SampleDensityType', defaultValue='Mass Density',
                             validator=StringListValidator(['Mass Density', 'Number Density']),
                             doc='Use of Mass density or Number density')
        self.declareProperty(name='SampleDensity', defaultValue=0.1,
                             doc='Mass density (g/cm^3) or Number density (atoms/Angstrom^3)')
        self.declareProperty(name='SampleInnerRadius', defaultValue=0.2,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample radius')
        self.declareProperty(name='SampleOuterRadius', defaultValue=0.25,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample radius')

        # Container options
        self.declareProperty(MatrixWorkspaceProperty('CanWorkspace', '', optional=PropertyMode.Optional,
                                                     direction=Direction.Input),
                             doc='Container workspace.')
        self.declareProperty(name='UseCanCorrections', defaultValue=False,
                             doc='Use can corrections in subtraction')
        self.declareProperty(name='CanChemicalFormula', defaultValue='',
                             doc='Chemical formula for the can')
        self.declareProperty(name='CanDensityType', defaultValue='Mass Density',
                             validator=StringListValidator(['Mass Density', 'Number Density']),
                             doc='Use of Mass density or Number density')
        self.declareProperty(name='CanDensity', defaultValue=0.1,
                             doc='Mass density (g/cm^3) or Number density (atoms/Angstrom^3)')
        self.declareProperty(name='CanInnerRadius', defaultValue=0.19,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample radius')
        self.declareProperty(name='CanOuterRadius', defaultValue=0.26,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample radius')
        self.declareProperty(name='CanScaleFactor', defaultValue=1.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Scale factor to multiply can data')

        # General options
        self.declareProperty(name='Events', defaultValue=5000,
                             validator=IntBoundedValidator(0),
                             doc='Number of neutron events')

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

        self.declareProperty(WorkspaceGroupProperty('CorrectionsWorkspace', '', direction=Direction.Output,
                                                    optional=PropertyMode.Optional),
                             doc='The corrections workspace for scattering and absorptions in sample.')
    def PyInit(self):
        ws_validator = CompositeValidator([WorkspaceUnitValidator('Wavelength'), InstrumentValidator()])

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

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

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

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

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

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

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

        self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '',
                                                    direction=Direction.Output),
                             doc='The output corrections workspace group')
    def PyInit(self):
        ws_validator = CompositeValidator([WorkspaceUnitValidator('Wavelength'), InstrumentValidator()])

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

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

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

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

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

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

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

        self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '',
                                                    direction=Direction.Output),
                             doc='The output corrections workspace group')
示例#13
0
    def PyInit(self):

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

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

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

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

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

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

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

        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspace',
                                   '',
                                   direction=Direction.Output),
            doc='Output workspace containing the reduced data.')
示例#14
0
    def PyInit(self):

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

        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(
            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(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.')
示例#15
0
    def PyInit(self):
        self.declareProperty(MatrixWorkspaceProperty("Sample", "", Direction.Input),
                             doc="Sample to use.")
        self.declareProperty(name='EnergyMin', defaultValue=-0.5,
                             doc='Minimum energy for fit. Default=-0.5')
        self.declareProperty(name='EnergyMax', defaultValue=0.5,
                             doc='Maximum energy for fit. Default=0.5')
        self.declareProperty(name='Scale', defaultValue=1.0,
                             doc='Scale factor to multiply y(Q,w). Default=1.0')
        self.declareProperty(name='Plot', defaultValue=False,
                             doc='Switch Plot Off/On')
        self.declareProperty(name='Save', defaultValue=False,
                             doc='Switch Save result to nxs file Off/On')

        self.declareProperty(WorkspaceGroupProperty("OutputWorkspace", "", Direction.Output),
                             doc="group_workspace workspace that includes all calculated moments.")
    def PyInit(self):
        # Workspace which is to be masked
        self.declareProperty(
            MatrixWorkspaceProperty("InputWorkspace",
                                    '',
                                    optional=PropertyMode.Mandatory,
                                    direction=Direction.Input),
            doc='The workspace which is to be converted to wavelength')

        self.declareProperty(
            self.WAV_PAIRS,
            defaultValue="",
            direction=Direction.Input,
            doc=
            'A JSON encoded list of wavelength ranges. E.g. [[1., 2.], [2., 3.]]'
        )
        self.declareProperty('WavelengthStep',
                             defaultValue=Property.EMPTY_DBL,
                             direction=Direction.Input,
                             doc='The step size of the wavelength binning.')

        # Step type
        allowed_step_types = StringListValidator(
            [RangeStepType.LOG.value, RangeStepType.LIN.value])
        self.declareProperty('WavelengthStepType',
                             RangeStepType.LIN.value,
                             validator=allowed_step_types,
                             direction=Direction.Input,
                             doc='The step type for rebinning.')

        # Rebin type
        allowed_rebin_methods = StringListValidator(
            [RebinType.REBIN.value, RebinType.INTERPOLATING_REBIN.value])
        self.declareProperty(
            "RebinMode",
            RebinType.REBIN.value,
            validator=allowed_rebin_methods,
            direction=Direction.Input,
            doc="The method which is to be applied to the rebinning.")

        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspace',
                                   '',
                                   optional=PropertyMode.Mandatory,
                                   direction=Direction.Output),
            doc='A grouped workspace containing the output workspaces'
            ' in the same order as the input pairs.')
示例#17
0
    def PyInit(self):
        self.declareProperty(name='Run',
                             defaultValue=0,
                             validator=IntBoundedValidator(lower=0),
                             doc='Run number to load')

        self.declareProperty(
            WorkspaceGroupProperty(name='GroupWorkspace',
                                   defaultValue='',
                                   direction=Direction.Output),
            doc='Output group workspace for run')

        self.declareProperty(
            name="Directory",
            defaultValue="",
            direction=Direction.Output,
            doc="provides the directory where the run files were acquired")
示例#18
0
    def PyInit(self):
        # Sample options
        self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '', direction=Direction.Input),
                             doc='Sample workspace.')
        self.declareProperty(name='SampleChemicalFormula', defaultValue='', validator=StringMandatoryValidator(),
                             doc='Sample chemical formula')
        self.declareProperty(name='SampleNumberDensity', defaultValue=0.1,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample number density')
        self.declareProperty(name='SampleRadius', defaultValue=0.1,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample radius')

        # Container options
        self.declareProperty(MatrixWorkspaceProperty('CanWorkspace', '', optional=PropertyMode.Optional,
                                                     direction=Direction.Input),
                             doc='Container workspace.')
        self.declareProperty(name='UseCanCorrections', defaultValue=False,
                             doc='Use can corrections in subtraction')
        self.declareProperty(name='CanChemicalFormula', defaultValue='',
                             doc='Can chemical formula')
        self.declareProperty(name='CanNumberDensity', defaultValue=0.1,
                             validator=FloatBoundedValidator(0.0),
                             doc='Can number density')
        self.declareProperty(name='CanRadius', defaultValue=0.2,
                             validator=FloatBoundedValidator(0.0),
                             doc='Can radius')
        self.declareProperty(name='CanScaleFactor', defaultValue=1.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Scale factor to multiply can data')

        # General options
        self.declareProperty(name='Events', defaultValue=5000,
                             validator=IntBoundedValidator(0),
                             doc='Number of neutron events')
        self.declareProperty(name='Plot', defaultValue=False,
                             doc='Plot options')

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

        self.declareProperty(WorkspaceGroupProperty('CorrectionsWorkspace', '', direction=Direction.Output,
                                                    optional=PropertyMode.Optional),
                             doc='The corrections workspace for scattering and absorptions in sample.')
示例#19
0
    def PyInit(self):
        # Input properties
        self.declareProperty(
            WorkspaceGroupProperty('InputWorkspace',
                                   '',
                                   direction=Direction.Input),
            doc='Workspace group for the workspaces to be sorted.')

        self.declareProperty('OutputGroupPrefix',
                             '',
                             doc='String to prefix the output groups.')
        self.declareProperty('OutputGroupSuffix',
                             '',
                             doc='String to suffix the output groups.')

        self.declareProperty(
            StringArrayProperty('OutputWorkspaceList', [],
                                direction=Direction.Output),
            doc='List of Workspace groups for the resulting workspaces.')
示例#20
0
    def _declare_output_properties(self):
        self.declareProperty(
            MatrixWorkspaceProperty('OutShiftAndScaleFactor',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc=
            'A workspace containing the applied shift factor as X data and applied scale factor '
            'as Y data.')

        # 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(
            WorkspaceGroupProperty('OutputWorkspaceLAB',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc='The output workspace for the low-angle bank.')
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceHAB',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc='The output workspace for the high-angle bank.')
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceMerged',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc='The output workspace for the merged reduction.')
        self.setPropertyGroup("OutShiftAndScaleFactor", 'Output')
        self.setPropertyGroup("OutputWorkspaceLAB", 'Output')
        self.setPropertyGroup("OutputWorkspaceHAB", 'Output')
        self.setPropertyGroup("OutputWorkspaceMerged", 'Output')

        # CAN output
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceLABCan',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can output workspace group for the low-angle bank, provided there is one. '
            'Each workspace in the group is one event slice.')
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceHABCan',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can output workspace group for the high-angle bank, provided there is one. '
            'Each workspace in the group is one event slice.')
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceLABSample',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The sample output workspace group for the low-angle bank, provided there is one. '
            'Each workspace in the group is one event slice.')
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceHABSample',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The sample output workspace group for the high-angle bank, provided there is one. '
            'Each workspace in the group is one event slice.')
        self.declareProperty(MatrixWorkspaceProperty(
            'OutputWorkspaceCalculatedTransmission',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The calculated transmission workspace.')
        self.declareProperty(MatrixWorkspaceProperty(
            'OutputWorkspaceUnfittedTransmission',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The unfitted transmission workspace.')
        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceCalculatedTransmissionCan',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc='The calculated transmission workspace for the can.')
        self.declareProperty(
            MatrixWorkspaceProperty('OutputWorkspaceUnfittedTransmissionCan',
                                    '',
                                    optional=PropertyMode.Optional,
                                    direction=Direction.Output),
            doc='The unfitted transmission workspace for the can.')
        self.setPropertyGroup("OutputWorkspaceLABCan", 'Can Output')
        self.setPropertyGroup("OutputWorkspaceHABCan", 'Can Output')
        self.setPropertyGroup("OutputWorkspaceLABSample", 'Can Output')
        self.setPropertyGroup("OutputWorkspaceHABSample", 'Can Output')

        # Output CAN Count and Norm for optimizations
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceLABCanNorm',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can norm output workspace group for the low-angle bank, provided there is one. '
            'Each workspace in the group is one event slice.')
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceLABCanCount',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can count output workspace group for the low-angle bank, provided there is one. '
            'Each workspace in the group is one event slice.')
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceHABCanCount',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can count output workspace group for the high-angle bank, provided there is one. '
            'Each workspace in the group is one event slice.')
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceHABCanNorm',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can norm output workspace group for the high-angle bank, provided there is one. '
            'Each workspace in the group is one event slice.')

        self.setPropertyGroup("OutputWorkspaceLABCanCount", 'Opt Output')
        self.setPropertyGroup("OutputWorkspaceLABCanNorm", 'Opt Output')
        self.setPropertyGroup("OutputWorkspaceHABCanCount", 'Opt Output')
        self.setPropertyGroup("OutputWorkspaceHABCanNorm", 'Opt Output')
示例#21
0
    def _declare_output_properties(self):
        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(
            WorkspaceGroupProperty('OutputWorkspaceLAB',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc='The output workspace for the low-angle bank.')
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceHAB',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc='The output workspace for the high-angle bank.'),
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceHABScaled',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc='The scaled output HAB workspace when merging')
        self.declareProperty(
            WorkspaceGroupProperty('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("OutputWorkspaceHABScaled", 'Output')
        self.setPropertyGroup("OutputWorkspaceMerged", 'Output')

        # CAN output
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceLABCan',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can output workspace for the low-angle bank, provided there is one.'
        )
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceHABCan',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can output workspace for the high-angle bank, provided there is one.'
        )
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceLABSample',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The sample output workspace for the low-angle bank, provided there is one.'
        )
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceHABSample',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The sample output workspace for the high-angle bank, provided there is one'
        )
        self.declareProperty(WorkspaceGroupProperty(
            'OutputWorkspaceCalculatedTransmission',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The calculated transmission workspace')
        self.declareProperty(WorkspaceGroupProperty(
            'OutputWorkspaceUnfittedTransmission',
            '',
            optional=PropertyMode.Optional,
            direction=Direction.Output),
                             doc='The unfitted transmission workspace')
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceCalculatedTransmissionCan',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc='The calculated transmission workspace for the can')
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceUnfittedTransmissionCan',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc='The unfitted transmission workspace for the can')
        self.setPropertyGroup("OutputWorkspaceLABCan", 'Can Output')
        self.setPropertyGroup("OutputWorkspaceHABCan", 'Can Output')
        self.setPropertyGroup("OutputWorkspaceLABSample", 'Can Output')
        self.setPropertyGroup("OutputWorkspaceHABSample", 'Can Output')

        # Output CAN Count and Norm for optimizations
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceLABCanNorm',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can norm output workspace for the low-angle bank, provided there is one.'
        )
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceLABCanCount',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can count output workspace for the low-angle bank, provided there is one.'
        )
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceHABCanCount',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can count output workspace for the high-angle bank, provided there is one.'
        )
        self.declareProperty(
            WorkspaceGroupProperty('OutputWorkspaceHABCanNorm',
                                   '',
                                   optional=PropertyMode.Optional,
                                   direction=Direction.Output),
            doc=
            'The can norm output workspace for the high-angle bank, provided there is one.'
        )

        self.setPropertyGroup("OutputWorkspaceLABCanCount", 'Opt Output')
        self.setPropertyGroup("OutputWorkspaceLABCanNorm", 'Opt Output')
        self.setPropertyGroup("OutputWorkspaceHABCanCount", 'Opt Output')
        self.setPropertyGroup("OutputWorkspaceHABCanNorm", 'Opt Output')
    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(name='Observable',
                             defaultValue='sample.temperature',
                             doc='Scanning observable, a Sample Log entry\n')

        self.declareProperty(name='SortXAxis',
                             defaultValue=False,
                             doc='Whether or not to sort the x-axis\n')

        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='BackgroundOption',
            defaultValue='Sum',
            validator=StringListValidator(['Sum', 'Interpolate']),
            doc='Whether to sum or interpolate the background runs.')

        self.declareProperty(
            name='CalibrationOption',
            defaultValue='Sum',
            validator=StringListValidator(['Sum', 'Interpolate']),
            doc='Whether to sum or interpolate the calibration runs.')

        self.declareProperty(
            name='CalibrationBackgroundOption',
            defaultValue='Sum',
            validator=StringListValidator(['Sum', 'Interpolate']),
            doc=
            'Whether to sum or interpolate the background run for calibration runs.'
        )

        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='Output workspace group')

        self.declareProperty(name='SpectrumAxis',
                             defaultValue='SpectrumNumber',
                             validator=StringListValidator(
                                 ['SpectrumNumber', '2Theta', 'Q', 'Q2']),
                             doc='The spectrum axis conversion target.')

        self.declareProperty(
            name='DiscardSingleDetectors',
            defaultValue=False,
            doc='Whether to discard the spectra of single detectors.')

        self.declareProperty(
            name='ManualInelasticPeakChannels',
            defaultValue=[-1, -1],
            doc=
            'The channel indices for the inelastic peak positions in the beginning '
            'and in the end of the spectra; by default the maxima of the monitor '
            'spectrum will be used for this. The intensities will be integrated symmetrically '
            'around each peak.')
示例#23
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.')
示例#24
0
    def PyInit(self):

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

        self.declareProperty(MultipleFileProperty(
            'SampleRuns',
            action=FileAction.OptionalLoad,
            extensions=['nxs'],
            allow_empty=True),
                             doc='Sample run(s).')

        self.declareProperty(
            MultipleFileProperty('AbsorberRuns',
                                 action=FileAction.OptionalLoad,
                                 extensions=['nxs']),
            doc='Absorber (Cd/B4C) run(s).')

        self.declareProperty(MultipleFileProperty(
            'BeamRuns', action=FileAction.OptionalLoad, extensions=['nxs']),
                             doc='Empty beam run(s).')

        self.declareProperty(
            MultipleFileProperty('FluxRuns',
                                 action=FileAction.OptionalLoad,
                                 extensions=['nxs']),
            doc='Empty beam run(s) for flux calculation only; '
            'if left blank flux will be calculated from BeamRuns.')

        self.declareProperty(MultipleFileProperty(
            'ContainerRuns',
            action=FileAction.OptionalLoad,
            extensions=['nxs']),
                             doc='Empty container run(s).')

        self.setPropertyGroup('SampleRuns', 'Numors')
        self.setPropertyGroup('AbsorberRuns', 'Numors')
        self.setPropertyGroup('BeamRuns', 'Numors')
        self.setPropertyGroup('FluxRuns', 'Numors')
        self.setPropertyGroup('ContainerRuns', 'Numors')

        self.declareProperty(MultipleFileProperty(
            'SampleTransmissionRuns',
            action=FileAction.OptionalLoad,
            extensions=['nxs']),
                             doc='Sample transmission run(s).')

        self.declareProperty(MultipleFileProperty(
            'ContainerTransmissionRuns',
            action=FileAction.OptionalLoad,
            extensions=['nxs']),
                             doc='Container transmission run(s).')

        self.declareProperty(MultipleFileProperty(
            'TransmissionBeamRuns',
            action=FileAction.OptionalLoad,
            extensions=['nxs']),
                             doc='Empty beam run(s) for transmission.')

        self.declareProperty(MultipleFileProperty(
            'TransmissionAbsorberRuns',
            action=FileAction.OptionalLoad,
            extensions=['nxs']),
                             doc='Absorber (Cd/B4C) run(s) for transmission.')

        self.setPropertyGroup('SampleTransmissionRuns', 'Transmissions')
        self.setPropertyGroup('ContainerTransmissionRuns', 'Transmissions')
        self.setPropertyGroup('TransmissionBeamRuns', 'Transmissions')
        self.setPropertyGroup('TransmissionAbsorberRuns', 'Transmissions')
        self.copyProperties('SANSILLReduction', ['ThetaDependent'])
        self.setPropertyGroup('ThetaDependent', 'Transmissions')

        self.declareProperty(
            'SensitivityMaps',
            '',
            doc=
            'File(s) or workspaces containing the maps of relative detector efficiencies.'
        )

        self.declareProperty(
            'DefaultMaskFile',
            '',
            doc=
            'File or workspace containing the default mask (typically the detector edges and dead pixels/tubes)'
            ' to be applied to all the detector configurations.')

        self.declareProperty(
            'MaskFiles',
            '',
            doc=
            'File(s) or workspaces containing the detector mask (typically beam stop).'
        )

        self.declareProperty(
            'ReferenceFiles',
            '',
            doc=
            'File(s) or workspaces containing the corrected water data (in 2D) for absolute normalisation.'
        )

        self.declareProperty(
            'SolventFiles',
            '',
            doc=
            'File(s) or workspaces containing the corrected solvent data (in 2D) for solvent subtraction.'
        )

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

        self.copyProperties('SANSILLReduction', ['NormaliseBy'])

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

        self.declareProperty('TransmissionBeamRadius',
                             0.1,
                             validator=FloatBoundedValidator(lower=0.),
                             doc='Beam radius [m]; used for transmission '
                             'calculations.')

        self.declareProperty(FloatArrayProperty('BeamRadius', values=[0.1]),
                             doc='Beam radius [m]; used for beam center '
                             'finding and flux calculations.')

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

        self.setPropertyGroup('SensitivityMaps', 'Options')
        self.setPropertyGroup('DefaultMaskFile', 'Options')
        self.setPropertyGroup('MaskFiles', 'Options')
        self.setPropertyGroup('ReferenceFiles', 'Options')
        self.setPropertyGroup('SolventFiles', 'Options')
        self.setPropertyGroup('SensitivityOutputWorkspace', 'Options')
        self.setPropertyGroup('NormaliseBy', 'Options')
        self.setPropertyGroup('SampleThickness', 'Options')
        self.setPropertyGroup('BeamRadius', 'Options')
        self.setPropertyGroup('TransmissionBeamRadius', 'Options')
        self.setPropertyGroup('WaterCrossSection', 'Options')

        self.declareProperty(FloatArrayProperty('MaxQxy', values=[-1]),
                             doc='Maximum of absolute Qx and Qy.')
        self.declareProperty(FloatArrayProperty('DeltaQ', values=[-1]),
                             doc='The dimension of a Qx-Qy cell.')

        self.declareProperty('OutputPanels',
                             False,
                             doc='Whether or not process the individual '
                             'detector panels.')

        self.copyProperties('SANSILLIntegration', [
            'OutputType', 'CalculateResolution', 'DefaultQBinning',
            'BinningFactor', 'NPixelDivision', 'NumberOfWedges', 'WedgeAngle',
            'WedgeOffset', 'AsymmetricWedges', 'IQxQyLogBinning',
            'WavelengthRange'
        ])

        self.declareProperty(
            'OutputBinning',
            '',
            doc=
            'Output binning for each distance. : separated list of binning params.'
        )
        self.setPropertyGroup('OutputBinning', 'Integration Options')
        self.setPropertyGroup('OutputType', 'Integration Options')
        self.setPropertyGroup('CalculateResolution', 'Integration Options')
        self.declareProperty(
            'ClearCorrected2DWorkspace', True,
            'Whether to clear the fully corrected 2D workspace.')

        self.declareProperty(
            'SensitivityWithOffsets', False,
            'Whether the sensitivity data has been measured with different horizontal offsets.'
        )

        self.declareProperty(
            'StitchReferenceIndex',
            defaultValue=1,
            validator=IntBoundedValidator(lower=0),
            doc='Index of reference workspace during stitching.')

        self.copyProperties('SANSILLIntegration', ['ShapeTable'])

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

        self.setPropertyGroup('SampleWorkspace', 'Sample Options')
        self.setPropertyGroup('SampleChemicalFormula', 'Sample Options')
        self.setPropertyGroup('SampleCoherentXSection', 'Sample Options')
        self.setPropertyGroup('SampleIncoherentXSection', 'Sample Options')
        self.setPropertyGroup('SampleAttenuationXSection', 'Sample Options')
        self.setPropertyGroup('SampleDensityType', 'Sample Options')
        self.setPropertyGroup('SampleDensity', 'Sample Options')

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

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

        # Monte Carlo options
        self.declareProperty(name='NumberOfWavelengthPoints',
                             defaultValue=10,
                             validator=IntBoundedValidator(1),
                             doc='Number of wavelengths for calculation')
        self.declareProperty(name='EventsPerPoint',
                             defaultValue=1000,
                             validator=IntBoundedValidator(0),
                             doc='Number of neutron events')
        self.declareProperty(name='Interpolation',
                             defaultValue='Linear',
                             validator=StringListValidator(
                                 ['Linear', 'CSpline']),
                             doc='Type of interpolation')
        self.declareProperty(
            name='MaxScatterPtAttempts',
            defaultValue=5000,
            validator=IntBoundedValidator(0),
            doc='Maximum number of tries made to generate a scattering point')

        self.setPropertyGroup('NumberOfWavelengthPoints',
                              'Monte Carlo Options')
        self.setPropertyGroup('EventsPerPoint', 'Monte Carlo Options')
        self.setPropertyGroup('Interpolation', 'Monte Carlo Options')
        self.setPropertyGroup('MaxScatterPtAttempts', 'Monte Carlo Options')

        # Container options
        self.declareProperty(WorkspaceProperty('ContainerWorkspace',
                                               '',
                                               direction=Direction.Input,
                                               optional=PropertyMode.Optional),
                             doc='Container Workspace')

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

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

        self.setPropertyGroup('ContainerWorkspace', 'Container Options')
        self.setPropertyGroup('ContainerChemicalFormula', 'Container Options')
        self.setPropertyGroup('ContainerCoherentXSection', 'Container Options')
        self.setPropertyGroup('ContainerIncoherentXSection',
                              'Container Options')
        self.setPropertyGroup('ContainerAttenuationXSection',
                              'Container Options')
        self.setPropertyGroup('ContainerDensityType', 'Container Options')
        self.setPropertyGroup('ContainerDensity', 'Container Options')

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        container_flat_plate_condition = VisibleWhenProperty(
            container_condition, flat_plate_condition, LogicOperator.And)

        self.setPropertySettings('ContainerFrontThickness',
                                 container_flat_plate_condition)
        self.setPropertySettings('ContainerBackThickness',
                                 container_flat_plate_condition)

        self.setPropertyGroup('ContainerFrontThickness',
                              'Container Shape Options')
        self.setPropertyGroup('ContainerBackThickness',
                              'Container Shape Options')

        # Both cylinder and annulus have an annulus container

        not_flat_plate_condition = VisibleWhenProperty(
            'Shape', PropertyCriterion.IsNotEqualTo, 'FlatPlate')

        container_n_f_p_condition = VisibleWhenProperty(
            container_condition, not_flat_plate_condition, LogicOperator.And)

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

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

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

        # output
        self.declareProperty(
            WorkspaceGroupProperty(name='CorrectionsWorkspace',
                                   defaultValue='corrections',
                                   direction=Direction.Output,
                                   optional=PropertyMode.Optional),
            doc='Name of the workspace group to save correction factors')
        self.setPropertyGroup('CorrectionsWorkspace', 'Output Options')
示例#26
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):

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

        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(
            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(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.')

        self.declareProperty(name='NormaliseTo',
                             defaultValue='Monitor',
                             validator=StringListValidator(['Monitor',
                                                            'None']),
                             doc='Choose to normalise to monitor.')

        self.declareProperty(
            name='MonitorCutoff',
            defaultValue=0.5,
            validator=FloatBoundedValidator(lower=0., upper=1.),
            doc=
            'Choose the cutoff fraction wrt the maximum of the monitor counts.'
        )

        self.declareProperty(
            WorkspaceProperty('InputElasticChannelWorkspace',
                              '',
                              direction=Direction.Input,
                              optional=PropertyMode.Optional),
            doc='The name of the input elastic channel workspace.')

        self.declareProperty(
            WorkspaceProperty('OutputElasticChannelWorkspace',
                              '',
                              direction=Direction.Output,
                              optional=PropertyMode.Optional),
            doc='The name of the output elastic channel workspace.')

        self.declareProperty(name='ElasticPeakFitting',
                             defaultValue='FitAllPixelGroups',
                             validator=StringListValidator(
                                 ['FitAllPixelGroups', 'FitEquatorialOnly']),
                             doc='Choose the method for calibrating TOF axes.')

        self.declareProperty(
            name='GroupPixelsBy',
            defaultValue=4,
            validator=IntBoundedValidator(lower=1, upper=128),
            doc=
            'Choose how to group the pixels for elastic peak fitting; must be a power of 2.'
        )

        self.declareProperty(FloatArrayProperty("SampleCoordinates",
                                                [0., 0., 0.],
                                                FloatArrayLengthValidator(3),
                                                direction=Direction.Input),
                             doc='The sample coordinates X, Y, Z.')

        self.declareProperty(name='PulseChopper',
                             defaultValue='Auto',
                             validator=StringListValidator(
                                 ['Auto', '12', '34']),
                             doc='Define the pulse chopper.')

        bats_options = 'BATS only options'
        self.setPropertyGroup('MonitorCutoff', bats_options)
        self.setPropertyGroup('InputElasticChannelWorkspace', bats_options)
        self.setPropertyGroup('OutputElasticChannelWorkspace', bats_options)
        self.setPropertyGroup('ElasticPeakFitting', bats_options)
        self.setPropertyGroup('GroupPixelsBy', bats_options)
        self.setPropertyGroup('SampleCoordinates', bats_options)
        self.setPropertyGroup('PulseChopper', bats_options)

        self.declareProperty(
            name='GroupDetectors',
            defaultValue=True,
            doc=
            'Group the pixels using the range, tube-by-tube (default) or in a custom way; \n'
            'it is not recommended to group the detectors at this stage, \n'
            'in order to get absorption corrections right, \n'
            'however the default value is True for backwards compatibility.')

        self.declareProperty(
            name='DiscardSingleDetectors',
            defaultValue=False,
            doc='Whether to discard the spectra of single detectors.')
示例#28
0
    def PyInit(self):
        ws_validator = InstrumentValidator()

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

        self.declareProperty(name='SampleChemicalFormula', defaultValue='',
                             doc='Sample chemical formula')

        self.declareProperty(name='SampleCoherentXSection', defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='The coherent cross-section for the sample material in barns. To be used instead of '
                                 'Chemical Formula.')

        self.declareProperty(name='SampleIncoherentXSection', defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='The incoherent cross-section for the sample material in barns. To be used instead of '
                                 'Chemical Formula.')

        self.declareProperty(name='SampleAttenuationXSection', defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='The absorption cross-section for the sample material in barns. To be used instead of '
                                 'Chemical Formula.')

        self.declareProperty(name='SampleDensityType', defaultValue='Mass Density',
                             validator=StringListValidator(['Mass Density', 'Number Density']),
                             doc='Use of Mass density or Number density for the sample.')

        self.declareProperty(name='SampleNumberDensityUnit', defaultValue='Atoms',
                             validator=StringListValidator(['Atoms', 'Formula Units']),
                             doc='Choose which units SampleDensity refers to. Allowed values: '
                                 '[Atoms, Formula Units]')

        self.declareProperty(name='SampleDensity', defaultValue=0.1,
                             doc='The value for the sample Mass density (g/cm^3) or Number density (1/Angstrom^3).')

        self.declareProperty(name='SampleThickness', defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='Sample thickness in cm')

        self.declareProperty(name='SampleAngle', defaultValue=0.0,
                             doc='Angle between incident beam and normal to flat plate surface')

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

        self.declareProperty(name='CanChemicalFormula', defaultValue='',
                             doc='Container chemical formula')

        self.declareProperty(name='CanCoherentXSection', defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='The coherent cross-section for the can material in barns. To be used instead of '
                                 'Chemical Formula.')

        self.declareProperty(name='CanIncoherentXSection', defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='The incoherent cross-section for the can material in barns. To be used instead of '
                                 'Chemical Formula.')

        self.declareProperty(name='CanAttenuationXSection', defaultValue=0.0,
                             validator=FloatBoundedValidator(0.0),
                             doc='The absorption cross-section for the can material in barns. To be used instead of '
                                 'Chemical Formula.')

        self.declareProperty(name='CanDensityType', defaultValue='Mass Density',
                             validator=StringListValidator(['Mass Density', 'Number Density']),
                             doc='Use of Mass density or Number density for the can.')

        self.declareProperty(name='CanNumberDensityUnit', defaultValue='Atoms',
                             validator=StringListValidator(['Atoms', 'Formula Units']),
                             doc='Choose which units CanDensity refers to. Allowed values: [Atoms, Formula Units]')

        self.declareProperty(name='CanDensity', defaultValue=0.1,
                             doc='The value for the can Mass density (g/cm^3) or Number density (1/Angstrom^3).')

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

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

        self.declareProperty(name='NumberWavelengths', defaultValue=10,
                             validator=IntBoundedValidator(1),
                             doc='Number of wavelengths for calculation')

        self.declareProperty(name='Interpolate', defaultValue=True,
                             doc='Interpolate the correction workspaces to match the sample workspace')

        self.declareProperty(name='Emode', defaultValue='Elastic',
                             validator=StringListValidator(['Elastic', 'Indirect', 'Direct', 'Efixed']),
                             doc='Energy transfer mode.')

        self.declareProperty(name='Efixed', defaultValue=0.,
                             doc='Analyser energy (mev). By default will be read from the instrument parameters. '
                                 'Specify manually to override. This is used only in Efixed energy transfer mode.')

        self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '',
                                                    direction=Direction.Output),
                             doc='The output corrections workspace group')
    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 properties
        self.declareProperty(StringArrayProperty(name='InputFiles'),
                             doc='Comma separated list of input files')

        self.declareProperty(name='SumFiles', defaultValue=False,
                             doc='Toggle input file summing or sequential processing')

        self.declareProperty(name='LoadLogFiles', defaultValue=True,
                             doc='Load log files when loading runs')

        self.declareProperty(WorkspaceProperty('CalibrationWorkspace', '',
                                               direction=Direction.Input,
                                               optional=PropertyMode.Optional),
                             doc='Workspace containing calibration data')

        # Instrument configuration properties
        self.declareProperty(name='Instrument', defaultValue='',
                             validator=StringListValidator(['IRIS', 'OSIRIS', 'TOSCA', 'TFXA']),
                             doc='Instrument used during run.')
        self.declareProperty(name='Analyser', defaultValue='',
                             validator=StringListValidator(['graphite', 'mica', 'fmica']),
                             doc='Analyser bank used during run.')
        self.declareProperty(name='Reflection', defaultValue='',
                             validator=StringListValidator(['002', '004', '006']),
                             doc='Reflection number for instrument setup during run.')

        self.declareProperty(name='Efixed', defaultValue=Property.EMPTY_DBL,
                             validator=FloatBoundedValidator(0.0),
                             doc='Overrides the default Efixed value for the analyser/reflection selection.')

        self.declareProperty(IntArrayProperty(name='SpectraRange', values=[0, 1],
                                              validator=IntArrayMandatoryValidator()),
                             doc='Comma separated range of spectra number to use.')
        self.declareProperty(FloatArrayProperty(name='BackgroundRange'),
                             doc='Range of background to subtract from raw data in time of flight.')
        self.declareProperty(name='RebinString', defaultValue='',
                             doc='Rebin string parameters.')
        self.declareProperty(name='DetailedBalance', defaultValue=Property.EMPTY_DBL,
                             doc='')
        self.declareProperty(name='ScaleFactor', defaultValue=1.0,
                             doc='Factor by which to scale result.')
        self.declareProperty(name='FoldMultipleFrames', defaultValue=True,
                             doc='Folds multiple framed data sets into a single workspace.')

        # Spectra grouping options
        self.declareProperty(name='GroupingMethod', defaultValue='IPF',
                             validator=StringListValidator(['Individual', 'All', 'File', 'Workspace', 'IPF', 'Custom']),
                             doc='Method used to group spectra.')
        self.declareProperty(WorkspaceProperty('GroupingWorkspace', '',
                                               direction=Direction.Input,
                                               optional=PropertyMode.Optional),
                             doc='Workspace containing spectra grouping.')
        self.declareProperty(name='GroupingString', defaultValue='',
                             direction=Direction.Input,
                             doc='Spectra to group as string')
        self.declareProperty(FileProperty('MapFile', '',
                                          action=FileAction.OptionalLoad,
                                          extensions=['.map']),
                             doc='Workspace containing spectra grouping.')

        # Output properties
        self.declareProperty(name='UnitX', defaultValue='DeltaE',
                             validator=StringListValidator(['DeltaE', 'DeltaE_inWavenumber']),
                             doc='X axis units for the result workspace.')

        self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '',
                                                    direction=Direction.Output),
                             doc='Workspace group for the resulting workspaces.')