Ejemplo n.º 1
0
	def PyInit(self):
		self.declareProperty(name='Instrument',defaultValue='IRIS',validator=StringListValidator(['IRIS','OSIRIS']), doc='Instrument')
		self.declareProperty(name='Analyser',defaultValue='graphite',validator=StringListValidator(['graphite','fmica']), doc='Analyser')
		self.declareProperty(name='Reflection',defaultValue='002',validator=StringListValidator(['002','004']), doc='Reflection')
		self.declareProperty(name='Chemical Formula',defaultValue='',validator=StringMandatoryValidator(), doc='Sample chemical formula')
		self.declareProperty(name='Number Density', defaultValue=0.1, doc='Number denisty. Default=0.1')
		self.declareProperty(name='Thickness', defaultValue=0.1, doc='Sample thickness. Default=0.1')
Ejemplo n.º 2
0
    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('WavelengthLow', defaultValue=Property.EMPTY_DBL, direction=Direction.Input,
                             doc='The low value of the wavelength binning.')
        self.declareProperty('WavelengthHigh', defaultValue=Property.EMPTY_DBL, direction=Direction.Input,
                             doc='The high value of the wavelength binning.')
        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(MatrixWorkspaceProperty('OutputWorkspace', '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Output),
                             doc='The output workspace.')
Ejemplo n.º 3
0
    def PyInit(self):
        self.declareProperty(mantid.api.WorkspaceProperty('InputWorkspace',
                                                          '',
                                                          mantid.kernel.Direction.Input),
                             "Workspace to save")
        self.declareProperty(mantid.api.FileProperty('OutputFilename',
                                                     '',
                                                     action=mantid.api.FileAction.Save,
                                                     extensions=['.h5']),
                             doc='Name of the savefile')

        group = 'Options'

        self.declareProperty('NXentry', '',
                             'Overrides the NXentry name from the workspace name')
        self.declareProperty('DataType', 'float32',
                             StringListValidator(['float32', 'float64']),
                             doc='All data saved will be converted to this type')
        self.declareProperty('Compression', 'gzip',
                             StringListValidator(['gzip', 'lzf', 'None']),
                             doc='Algorithm for compressing data')
        self.declareProperty('WriteMomentumTransfer', True,
                             doc="Add the momentum transfer (Q) axis to the file")
        self.declareProperty('ProtonChargeUnits', 'uA.hour',
                             StringListValidator(['uA.hour', 'C', 'pC']))
        self.declareProperty('Append', False)

        self.setPropertyGroup('NXentry', group)
        self.setPropertyGroup('DataType', group)
        self.setPropertyGroup('Compression', group)
        self.setPropertyGroup('WriteMomentumTransfer', group)
        self.setPropertyGroup('ProtonChargeUnits', group)
        self.setPropertyGroup('Append', group)
Ejemplo n.º 4
0
 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     mandatoryInputWorkspaces = CompositeValidator()
     mandatoryInputWorkspaces.add(StringArrayMandatoryValidator())
     mandatoryInputWorkspaces.add(StringArrayLengthValidator(1, 4))
     self.declareProperty(
         StringArrayProperty(Prop.INPUT_WS,
                             values=[],
                             validator=mandatoryInputWorkspaces),
         doc='A set of polarized workspaces, in wavelength.')
     self.declareProperty(
         WorkspaceGroupProperty(Prop.OUTPUT_WS,
                                defaultValue='',
                                direction=Direction.Output),
         doc='A group of polarization efficiency corrected workspaces.')
     self.declareProperty(Prop.SUBALG_LOGGING,
                          defaultValue=SubalgLogging.OFF,
                          validator=StringListValidator(
                              [SubalgLogging.OFF, SubalgLogging.ON]),
                          doc='Enable or disable child algorithm logging.')
     self.declareProperty(
         Prop.CLEANUP,
         defaultValue=common.WSCleanup.ON,
         validator=StringListValidator(
             [common.WSCleanup.ON, common.WSCleanup.OFF]),
         doc='Enable or disable intermediate workspace cleanup.')
     self.declareProperty(
         FileProperty(Prop.EFFICIENCY_FILE,
                      defaultValue='',
                      action=FileAction.Load),
         doc='A file containing the polarization efficiency factors.')
Ejemplo n.º 5
0
    def PyInit(self):
        # Input workspace/data info (filename or IPTS+RunNumber)
        # Priority: Filename > IPTS + RunNumber
        self.declareProperty(
            MultipleFileProperty(name="Filename",
                                 action=FileAction.OptionalLoad,
                                 extensions=[".nxs.h5"]), "Files to load")
        self.declareProperty('IPTS', Property.EMPTY_INT,
                             "IPTS number to load from")
        self.declareProperty(IntArrayProperty("RunNumbers", []),
                             'Run numbers to load')

        # Normalization info (optional, skip normalization if not specified)
        # Priority: IPTS + RunNumber > Filename >  NormalizationFile
        # NOTE:
        #   The current convention for loading Vanadium data is by IPTS+RunNumber, so this is the default\
        # -- default
        self.declareProperty('VanadiumIPTS', Property.EMPTY_INT,
                             "IPTS number to load Vanadium normalization")
        self.declareProperty('VanadiumRunNumber', Property.EMPTY_INT,
                             "Run number to load Vanadium normalization")
        # -- alternative
        self.declareProperty(FileProperty(name="VanadiumFile",
                                          defaultValue="",
                                          extensions=[".nxs"],
                                          direction=Direction.Input,
                                          action=FileAction.OptionalLoad),
                             doc="File with Vanadium normalization scan data")
        # alternative
        self.declareProperty(
            IMDHistoWorkspaceProperty("VanadiumWorkspace",
                                      defaultValue="",
                                      direction=Direction.Input,
                                      optional=PropertyMode.Optional),
            doc="MDHisto workspace containing vanadium normalization data")
        # normalization method
        self.declareProperty(
            "NormalizedBy", 'None',
            StringListValidator(['None', 'Counts', 'Monitor', 'Time']),
            "Normalize to Counts, Monitor, Time.")
        # group normalization properties
        self.setPropertyGroup('VanadiumIPTS', 'Normalization')
        self.setPropertyGroup('VanadiumRunNumber', 'Normalization')
        self.setPropertyGroup('VanadiumFile', 'Normalization')
        self.setPropertyGroup('VanadiumWorkspace', 'Normalization')
        self.setPropertyGroup('NormalizedBy', 'Normalization')

        # Grouping info
        self.declareProperty(
            "Grouping", 'None', StringListValidator(['None', '2x2', '4x4']),
            "Group pixels (shared by input and normalization)")

        # Output workspace/data info
        self.declareProperty(
            WorkspaceProperty("OutputWorkspace",
                              "",
                              optional=PropertyMode.Mandatory,
                              direction=Direction.Output), "Output Workspace")
Ejemplo n.º 6
0
    def PyInit(self):
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))
        positiveFloat = FloatBoundedValidator(lower=0)

        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            optional=PropertyMode.Mandatory,
            direction=Direction.Input),
                             doc='Input workspace.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='The output of the algorithm.')
        self.declareProperty(name=common.PROP_CLEANUP_MODE,
                             defaultValue=common.CLEANUP_ON,
                             validator=StringListValidator(
                                 [common.CLEANUP_ON, common.CLEANUP_OFF]),
                             direction=Direction.Input,
                             doc='What to do with intermediate workspaces.')
        self.declareProperty(
            name=common.PROP_SUBALG_LOGGING,
            defaultValue=common.SUBALG_LOGGING_OFF,
            validator=StringListValidator(
                [common.SUBALG_LOGGING_OFF, common.SUBALG_LOGGING_ON]),
            direction=Direction.Input,
            doc='Enable or disable subalgorithms to ' + 'print in the logs.')
        self.declareProperty(
            ITableWorkspaceProperty(name=common.PROP_EPP_WS,
                                    defaultValue='',
                                    direction=Direction.Input,
                                    optional=PropertyMode.Mandatory),
            doc='Table workspace containing results from the FindEPP algorithm.'
        )
        self.declareProperty(
            name=common.PROP_DWF_CORRECTION,
            defaultValue=common.DWF_ON,
            validator=StringListValidator([common.DWF_ON, common.DWF_OFF]),
            direction=Direction.Input,
            doc=
            'Enable or disable the correction for the Debye-Waller factor for '
            + common.PROP_OUTPUT_WS + '.')
        self.declareProperty(
            name=common.PROP_TEMPERATURE,
            defaultValue=Property.EMPTY_DBL,
            validator=positiveFloat,
            direction=Direction.Input,
            doc='Experimental temperature (Vanadium ' +
            'reduction type only) for the Debye-Waller correction, in Kelvins.'
        )
        self.setPropertySettings(
            common.PROP_TEMPERATURE,
            EnabledWhenProperty(common.PROP_DWF_CORRECTION,
                                PropertyCriterion.IsDefault))
Ejemplo n.º 7
0
	def PyInit(self):
		self.declareProperty(name='Analyser', defaultValue='silicon', validator=StringListValidator(['silicon']), doc = 'Analyser crystal')
		self.declareProperty(name='Reflection', defaultValue='111', validator=StringListValidator(['111']), doc = 'Analyser reflection')
		self.declareProperty(name='RunName', defaultValue='', validator=StringMandatoryValidator(), doc = 'Run name (after <Instr>_)')
		self.declareProperty(name='Map', defaultValue='default', validator=StringListValidator(['default','user']), doc = 'Use detector map')
		self.declareProperty(name='Mirror', defaultValue=False, doc = 'Mirror mode')
		self.declareProperty(name='Verbose', defaultValue=True, doc = 'Switch Verbose Off/On')
		self.declareProperty(name='Save', defaultValue=False, doc = 'Switch Save result to nxs file Off/On')
		self.declareProperty(name='Plot', defaultValue=False, doc = 'Plot options')
Ejemplo n.º 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')
    def PyInit(self):
        """Initialize the input and output properties of the algorithm."""
        threeNonnegativeInts = CompositeValidator()
        threeNonnegativeInts.add(IntArrayLengthValidator(3))
        nonnegativeInts = IntArrayBoundedValidator()
        nonnegativeInts.setLower(0)
        threeNonnegativeInts.add(nonnegativeInts)

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

        # Properties.
        self.declareProperty(
            MatrixWorkspaceProperty(name=common.PROP_INPUT_WS,
                                    defaultValue='',
                                    validator=inputWorkspaceValidator,
                                    direction=Direction.Input),
            doc='A workspace to which to apply the corrections.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='The corrected workspace.')
        self.declareProperty(name=common.PROP_CLEANUP_MODE,
                             defaultValue=utils.Cleanup.ON,
                             validator=StringListValidator(
                                 [utils.Cleanup.ON, utils.Cleanup.OFF]),
                             direction=Direction.Input,
                             doc='What to do with intermediate workspaces.')
        self.declareProperty(
            name=common.PROP_SUBALG_LOGGING,
            defaultValue=common.SUBALG_LOGGING_OFF,
            validator=StringListValidator(
                [common.SUBALG_LOGGING_OFF, common.SUBALG_LOGGING_ON]),
            direction=Direction.Input,
            doc='Enable or disable subalgorithms to print in the logs.')
        self.declareProperty(
            MatrixWorkspaceProperty(name=common.PROP_EC_WS,
                                    defaultValue='',
                                    validator=inputWorkspaceValidator,
                                    direction=Direction.Input,
                                    optional=PropertyMode.Optional),
            doc=
            'An empty container workspace for subtraction from the input workspace.'
        )
        self.declareProperty(
            name=common.PROP_EC_SCALING,
            defaultValue=1.0,
            validator=mustBePositive,
            direction=Direction.Input,
            doc=
            'A multiplier (transmission, if no self shielding is applied) for the empty container.'
        )
        self.declareProperty(
            MatrixWorkspaceProperty(
                name=common.PROP_SELF_SHIELDING_CORRECTION_WS,
                defaultValue='',
                direction=Direction.Input,
                optional=PropertyMode.Optional),
            doc='A workspace containing the self shielding correction factors.'
        )
Ejemplo n.º 11
0
    def declare_instrument_properties(
            self,
            default: str = "TOSCA",
            choices: Iterable = ALL_INSTRUMENTS,
            multiple_choice_settings: List[Tuple[str, str, str]] = [],
            freeform_settings: List[Tuple[str, str, str]] = []):
        """Declare properties related to instrument

        Args:
            default: default instrument
            choices: Iterable of available instruments for "Instrument" combo box
            multiple_choice_settings:
                List of field names, corresponding parameter and tooltip for additional instrument settings, e.g.::

                    [('Setting', 'settings', 'Setting choice for this instrument (e.g. monochromator)'), ...]

                This should correspond to a dict in abins.parameters.instruments[instrument]


            freeform_settings:
                List of field names, defaults and tooltips for additional instrument settings, e.g.::

                    [('IncidentEnergy', '4100', 'Incident energy in wavenumber'), ...]
            """

        self.declareProperty(
            name="Instrument",
            direction=Direction.Input,
            defaultValue=default,
            validator=StringListValidator(choices),
            doc="Name of an instrument for which analysis should be performed."
        )

        for property_name, parameter_name, doc in multiple_choice_settings:
            # Populate list of possible instrument settings
            valid_choices = ['']
            for instrument in choices:
                if ((instrument in abins.parameters.instruments)
                        and (parameter_name
                             in abins.parameters.instruments[instrument])):
                    valid_choices += list(
                        abins.parameters.instruments[instrument]
                        [parameter_name])
            valid_choices = sorted(list(set(valid_choices)))

            self.declareProperty(name=property_name,
                                 direction=Direction.Input,
                                 defaultValue="",
                                 validator=StringListValidator(valid_choices),
                                 doc=doc)

        for property_name, default, doc in freeform_settings:
            self.declareProperty(name=property_name,
                                 direction=Direction.Input,
                                 defaultValue=default,
                                 doc=doc)
Ejemplo n.º 12
0
def declare_rounding_property(o):
    '''
    Declares the properties needed for rounding.
    '''
    rounding = StringListValidator()
    rounding.addAllowedValue(ROUNDING_NONE)
    rounding.addAllowedValue(ROUNDING_TEN_TO_INT)
    o.declareProperty(name=PROP_NAME_ROUNDING_MODE,
                      defaultValue=ROUNDING_NONE, validator=rounding,
                      direction=Direction.Input, doc='Bin width rounding')
Ejemplo n.º 13
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')
 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     positiveFloat = FloatBoundedValidator(lower=0., exclusive=True)
     self.declareProperty(
         MatrixWorkspaceProperty(
             Prop.INPUT_WS,
             defaultValue='',
             direction=Direction.Input,
             validator=WorkspaceUnitValidator('Wavelength')),
         doc='A reflectivity workspace in wavelength to be converted to Q.')
     self.declareProperty(MatrixWorkspaceProperty(
         Prop.OUTPUT_WS, defaultValue='', direction=Direction.Output),
                          doc='The input workspace in momentum transfer.')
     self.declareProperty(Prop.SUBALG_LOGGING,
                          defaultValue=SubalgLogging.OFF,
                          validator=StringListValidator(
                              [SubalgLogging.OFF, SubalgLogging.ON]),
                          doc='Enable or disable child algorithm logging.')
     self.declareProperty(
         Prop.CLEANUP,
         defaultValue=common.WSCleanup.ON,
         validator=StringListValidator(
             [common.WSCleanup.ON, common.WSCleanup.OFF]),
         doc='Enable or disable intermediate workspace cleanup.')
     self.declareProperty(
         MatrixWorkspaceProperty(
             Prop.REFLECTED_WS,
             defaultValue='',
             direction=Direction.Input,
             validator=WorkspaceUnitValidator('Wavelength')),
         doc=
         'A non-summed reflected beam workspace, needed for Q resolution calculation.'
     )
     self.declareProperty(
         MatrixWorkspaceProperty(
             Prop.DIRECT_WS,
             defaultValue='',
             direction=Direction.Input,
             validator=WorkspaceUnitValidator('Wavelength')),
         doc=
         'A non-summed direct beam workspace, needed for Q resolution calculation.'
     )
     self.declareProperty(
         Prop.POLARIZED,
         defaultValue=False,
         doc=
         'True if input workspace has been corrected for polarization efficiencies.'
     )
     self.declareProperty(
         Prop.GROUPING_FRACTION,
         defaultValue=Property.EMPTY_DBL,
         validator=positiveFloat,
         doc=
         'If set, group the output by steps of this fraction multiplied by Q resolution'
     )
Ejemplo n.º 15
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.')
Ejemplo n.º 16
0
    def PyInit(self):

        # Input options
        self.declareProperty(FileProperty('Run', '',
                                          action=FileAction.Load,
                                          extensions=["nxs"]),
                             doc='File path of run.')

        self.declareProperty(MatrixWorkspaceProperty("CalibrationWorkspace", "",
                                                     optional=PropertyMode.Optional,
                                                     direction=Direction.Input),
                             doc="Workspace containing calibration intensities.")

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

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

        self.declareProperty(FileProperty('MapFile', '',
                                          action=FileAction.OptionalLoad,
                                          extensions=["xml"]),
                             doc='Filename of the map file to use. If left blank the default will be used.')

        self.declareProperty(name='MirrorMode', defaultValue=False,
                             doc='Whether to use mirror mode.')

        # Output workspace properties
        self.declareProperty(MatrixWorkspaceProperty("RawWorkspace", "",
                                                     direction=Direction.Output),
                             doc="Name for the output raw workspace created.")

        self.declareProperty(MatrixWorkspaceProperty("ReducedWorkspace", "",
                                                     direction=Direction.Output),
                             doc="Name for the output reduced workspace created. If mirror mode is used this will be the sum of both "
                             "the left and right hand workspaces.")

        self.declareProperty(MatrixWorkspaceProperty("LeftWorkspace", "",
                                                     optional=PropertyMode.Optional,
                                                     direction=Direction.Output),
                             doc="Name for the left workspace if mirror mode is used.")

        self.declareProperty(MatrixWorkspaceProperty("RightWorkspace", "",
                                                     optional=PropertyMode.Optional,
                                                     direction=Direction.Output),
                             doc="Name for the right workspace if mirror mode is used.")

        # Output options
        self.declareProperty(name='Save', defaultValue=False,
                             doc='Switch Save result to nxs file Off/On.')
        self.declareProperty(name='Plot', defaultValue=False,
                             doc='Whether to plot the output workspace.')
Ejemplo n.º 17
0
    def declare_common_properties(self) -> None:
        """Declare properties common to Abins 1D and 2D versions"""
        self.declareProperty(FileProperty("VibrationalOrPhononFile", "",
                                          action=FileAction.Load,
                                          direction=Direction.Input,
                                          extensions=AB_INITIO_FILE_EXTENSIONS),
                             doc="File with the data from a vibrational or phonon calculation.")

        self.declareProperty(name="AbInitioProgram",
                             direction=Direction.Input,
                             defaultValue="CASTEP",
                             validator=StringListValidator(["CASTEP", "CRYSTAL", "DMOL3", "GAUSSIAN", "VASP"]),
                             doc="An ab initio program which was used for vibrational or phonon calculation.")

        self.declareProperty(WorkspaceProperty("OutputWorkspace", '', Direction.Output),
                             doc="Name to give the output workspace.")

        self.declareProperty(name="TemperatureInKelvin",
                             direction=Direction.Input,
                             defaultValue=10.0,
                             doc="Temperature in K for which dynamical structure factor S should be calculated.")

        self.declareProperty(name="BinWidthInWavenumber", defaultValue=1.0, doc="Width of bins used during rebining.")

        self.declareProperty(name="SampleForm",
                             direction=Direction.Input,
                             defaultValue="Powder",
                             validator=StringListValidator(ALL_SAMPLE_FORMS),
                             doc="Form of the sample: Powder.")

        self.declareProperty(StringArrayProperty("Atoms", Direction.Input),
                             doc="List of atoms to use to calculate partial S."
                                 "If left blank, workspaces with S for all types of atoms will be calculated. "
                                 "Element symbols will be interpreted as a sum of all atoms of that element in the "
                                 "cell. 'atomN' or 'atom_N' (where N is a positive integer) will be interpreted as "
                                 "individual atoms, indexing from 1 following the order of the input data.")

        self.declareProperty(name="SumContributions", defaultValue=False,
                             doc="Sum the partial dynamical structure factors into a single workspace.")

        self.declareProperty(name="SaveAscii", defaultValue=False,
                             doc="Write workspaces to .ascii files after computing them.")

        self.declareProperty(name="ScaleByCrossSection", defaultValue='Incoherent',
                             validator=StringListValidator(['Total', 'Incoherent', 'Coherent']),
                             doc="Scale the partial dynamical structure factors by the scattering cross section.")

        # Abins is supposed to support excitations up to fourth-order. Order 3 and 4 are currently disabled while the
        # weighting is being investigated; these intensities were unreasonably large in hydrogenous test cases
        self.declareProperty(name="QuantumOrderEventsNumber", defaultValue='1',
                             validator=StringListValidator(['1', '2']),
                             doc="Number of quantum order effects included in the calculation "
                                 "(1 -> FUNDAMENTALS, 2-> first overtone + FUNDAMENTALS + 2nd order combinations")
Ejemplo n.º 18
0
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        self.declareProperty('SANSState', '',
                             doc='A JSON string which fulfills the SANSState contract.')

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

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

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

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

        # ----------
        # OUTPUT
        # ----------
        # SANSReductionCoreEventSlice has the same outputs as SANSReductionCore
        self._pyinit_output()
Ejemplo n.º 19
0
    def PyInit(self):
        self.declareProperty(name='Instrument', defaultValue='IRIS',
                             validator=StringListValidator(['IRIS', 'OSIRIS']),
                             doc='The name of the instrument.')
        self.declareProperty(name='Analyser', defaultValue='',
                             validator=StringListValidator(['graphite', 'mica', 'fmica']),
                             doc='The 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="FirstRun", defaultValue=-1,
                             validator=IntBoundedValidator(lower=0),
                             doc="First Sample run-number.")
        self.declareProperty(name='LastRun', defaultValue=-1,
                             validator=IntBoundedValidator(lower=0),
                             doc="Last Sample run-number.")
        self.declareProperty(name='NumberSamples', defaultValue=-1,
                             validator=IntBoundedValidator(lower=0),
                             doc="Increment for run-number.")

        self.declareProperty(IntArrayProperty(name='SpectraRange', values=[0, 1],
                                              validator=IntArrayLengthValidator(2)),
                             doc='Comma separated range of spectra numbers to use.')
        self.declareProperty(FloatArrayProperty(name='ElasticRange',
                                                validator=FloatArrayLengthValidator(2)),
                             doc='Energy range for the elastic component.')
        self.declareProperty(FloatArrayProperty(name='InelasticRange',
                                                validator=FloatArrayLengthValidator(2)),
                             doc='Energy range for the inelastic component.')
        self.declareProperty(FloatArrayProperty(name='TotalRange',
                                                validator=FloatArrayLengthValidator(2)),
                             doc='Energy range for the total energy component.')

        self.declareProperty(name='SampleEnvironmentLogName', defaultValue='Position',
                             doc='Name of the sample environment log entry')

        sample_environment_log_values = ['last_value', 'average']
        self.declareProperty('SampleEnvironmentLogValue', 'last_value',
                             StringListValidator(sample_environment_log_values),
                             doc='Value selection of the sample environment log entry')

        self.declareProperty(name='MSDFit', defaultValue=False,
                             doc='Perform an MSDFit. Do not use with GroupingMethod as "All"')

        self.declareProperty(name='WidthFit', defaultValue=False,
                             doc='Perform a 2 peak width Fit. Do not use with GroupingMethod as "All"')

        self.declareProperty(name='Plot', defaultValue=False,
                             doc='True to plot the output data.')
        self.declareProperty(name='Save', defaultValue=False,
                             doc='True to save the output data.')
Ejemplo n.º 20
0
    def PyInit(self):

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

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

        self.declareProperty(FileProperty('ROCCorrectionFile', '',
                                          action=FileAction.OptionalLoad, extensions=['nxs']),
                             doc='File containing the radial oscillating collimator (ROC) corrections.')

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

        thetaRangeValidator = FloatArrayOrderedPairsValidator()

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

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

        self.declareProperty(name='Observable',
                             defaultValue='sample.temperature',
                             doc='Scanning observable, a Sample Log entry.')

        self.declareProperty(name='SortObservableAxis',
                             defaultValue=False,
                             doc='Whether or not to sort the scanning observable axis.')

        self.declareProperty(name='ScanAxisBinWidth', defaultValue=0., validator=FloatBoundedValidator(lower=0.),
                             doc='Rebin the observable axis to this width. Default is to not rebin.')

        self.declareProperty(name='CropNegative2Theta', defaultValue=True,
                             doc='Whether or not to crop out the bins corresponding to negative scattering angle.')

        self.declareProperty(name='ZeroCountingCells', defaultValue='Interpolate',
                             validator=StringListValidator(['Crop','Interpolate','Leave']),
                             doc='Crop out the zero counting cells or interpolate the counts from the neighbours.')

        self.declareProperty(name='Unit',
                             defaultValue='ScatteringAngle',
                             validator=StringListValidator(['ScatteringAngle', 'MomentumTransfer', 'dSpacing']),
                             doc='The unit of the reduced diffractogram.')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace', '',
                                                     direction=Direction.Output),
                             doc='Output workspace containing the reduced data.')
Ejemplo n.º 21
0
    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))
        scalingFactor = FloatBoundedValidator(lower=0, upper=1)

        # Properties.
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input),
                             doc='Input workspace.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='The output of the algorithm.')
        self.declareProperty(name=common.PROP_CLEANUP_MODE,
                             defaultValue=common.CLEANUP_ON,
                             validator=StringListValidator(
                                 [common.CLEANUP_ON, common.CLEANUP_OFF]),
                             direction=Direction.Input,
                             doc='What to do with intermediate workspaces.')
        self.declareProperty(
            name=common.PROP_SUBALG_LOGGING,
            defaultValue=common.SUBALG_LOGGING_OFF,
            validator=StringListValidator(
                [common.SUBALG_LOGGING_OFF, common.SUBALG_LOGGING_ON]),
            direction=Direction.Input,
            doc='Enable or disable subalgorithms to ' + 'print in the logs.')
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_EC_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            direction=Direction.Input,
            optional=PropertyMode.Optional),
                             doc='Reduced empty container workspace.')
        self.declareProperty(name=common.PROP_EC_SCALING,
                             defaultValue=1.0,
                             validator=scalingFactor,
                             direction=Direction.Input,
                             doc='Scaling factor (transmission, if no self ' +
                             'shielding is applied) for empty container.')
        self.declareProperty(
            MatrixWorkspaceProperty(
                name=common.PROP_SELF_SHIELDING_CORRECTION_WS,
                defaultValue='',
                direction=Direction.Input,
                optional=PropertyMode.Optional),
            doc='A workspace containing self shielding correction factors.')
Ejemplo n.º 22
0
 def PyInit(self):
     self.declareProperty(
         name='InputType',
         defaultValue='File',
         validator=StringListValidator(['File', 'Workspace']),
         doc='Origin of data input - File (.nxs) or Workspace')
     self.declareProperty(name='Instrument',
                          defaultValue='iris',
                          validator=StringListValidator(
                              ['irs', 'iris', 'osi', 'osiris']),
                          doc='Instrument')
     self.declareProperty(name='Analyser',
                          defaultValue='graphite002',
                          validator=StringListValidator(
                              ['graphite002', 'graphite004']),
                          doc='Analyser & reflection')
     self.declareProperty(name='VanNumber',
                          defaultValue='',
                          validator=StringMandatoryValidator(),
                          doc='Sample run number')
     self.declareProperty(
         name='ResInputType',
         defaultValue='File',
         validator=StringListValidator(['File', 'Workspace']),
         doc='Origin of res input - File (_res.nxs) or Workspace')
     self.declareProperty(name='ResNumber',
                          defaultValue='',
                          validator=StringMandatoryValidator(),
                          doc='Resolution run number')
     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='VanBinning',
         defaultValue=1,
         doc='Binning value (integer) for sample. Default=1')
     self.declareProperty(name='Plot',
                          defaultValue='None',
                          validator=StringListValidator([
                              'None', 'Intensity', 'Stretch', 'Fit', 'All'
                          ]),
                          doc='Plot options')
     self.declareProperty(name='Verbose',
                          defaultValue=True,
                          doc='Switch Verbose Off/On')
     self.declareProperty(name='Save',
                          defaultValue=False,
                          doc='Switch Save result to nxs file Off/On')
Ejemplo n.º 23
0
 def PyInit(self):
     """
     Declare properties
     """
     self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", "",
                                                  direction=Direction.Input),
                          doc="Input workspace. The units are assumed to be distance")
     functions=["G(r)","GK(r)","g(r)"]
     self.declareProperty("From", 'G(r)', StringListValidator(functions),
                          "Function type in the input workspace")
     self.declareProperty("To", 'G(r)', StringListValidator(functions),
                          "Function type in the output workspace")
     self.declareProperty(WorkspaceProperty('OutputWorkspace', '',
                                            direction=Direction.Output),
                          doc='Output workspace')
Ejemplo n.º 24
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.')
Ejemplo n.º 25
0
    def PyInit(self):
        arrvalidator = StringArrayMandatoryValidator()
        lrg='Input'
        self.declareProperty(StringArrayProperty('Workspaces', values=[], validator=arrvalidator,\
            direction=Direction.Input), doc='list of input workspaces')
        self.declareProperty('LoadErrors', True, direction=Direction.Input,\
            doc='Do we load error data contained in the workspaces?')
        self.declareProperty(FloatArrayProperty('ParameterValues', values=[],\
            validator=FloatArrayMandatoryValidator(),direction=Direction.Input), doc='list of input parameter values')
        self.setPropertyGroup('Workspaces', lrg)
        self.setPropertyGroup('LoadErrors', lrg)
        self.setPropertyGroup('ParameterValues', lrg)

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

        lrg='Output'
        self.declareProperty(FloatArrayProperty('TargetParameters', values=[], ), doc="Parameters to interpolate the structure factor")
        self.declareProperty(StringArrayProperty('OutputWorkspaces', values=[], validator=arrvalidator),\
            doc='list of output workspaces to save the interpolated structure factors')
        self.setPropertyGroup('TargetParameters', lrg)
        self.setPropertyGroup('OutputWorkspaces', lrg)
        self.channelgroup = None
Ejemplo n.º 26
0
    def PyInit(self):
        self.declareProperty(
            FileProperty("Filename", "", FileAction.Load, ['.d_dat']),
            "Name of DNS experimental data file.")

        self.declareProperty(
            FileProperty("CoilCurrentsTable", "", FileAction.OptionalLoad,
                         ['.txt']),
            "Name of file containing table of coil currents and polarisations."
        )

        self.declareProperty(
            WorkspaceProperty("OutputWorkspace",
                              "",
                              direction=Direction.Output),
            doc="Name of the workspace to store the experimental data.")
        normalizations = ['duration', 'monitor', 'no']
        self.declareProperty("Normalization",
                             "duration",
                             StringListValidator(normalizations),
                             doc="Kind of data normalization.")

        self.declareProperty(
            name="ElasticChannel",
            defaultValue=0,
            validator=IntBoundedValidator(lower=0),
            doc=
            "Time channel number where elastic peak is observed. Only for TOF data."
        )
        return
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        # Workspace which is to be cropped
        self.declareProperty('SANSState', '',
                             doc='A JSON string which fulfills the SANSState contract.')

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

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

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

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

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

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

        allowed_detectors = StringListValidator([DetectorType.LAB.value,
                                                 DetectorType.HAB.value])
        self.declareProperty("Component", DetectorType.LAB.value,
                             validator=allowed_detectors, direction=Direction.Input,
                             doc="The component of the instrument which is to be reduced.")
Ejemplo n.º 28
0
 def PyInit(self):
     self.declareProperty(MultipleFileProperty(name="Filename", action=FileAction.OptionalLoad, extensions=[".nxs.h5"]), "Files to Load")
     self.declareProperty('IPTS', Property.EMPTY_INT, "IPTS number to load from")
     self.declareProperty(IntArrayProperty("RunNumbers", []), 'Run numbers to load')
     self.declareProperty("ApplyMask", True, "If True standard masking will be applied to the workspace")
     self.declareProperty("Grouping", 'None', StringListValidator(['None', '2x2', '4x4']), "Group pixels")
     self.declareProperty(WorkspaceProperty(name="OutputWorkspace", defaultValue="", direction=Direction.Output))
Ejemplo n.º 29
0
    def PyInit(self):
        # State
        self.declareProperty(
            PropertyManagerProperty('SANSState'),
            doc='A property manager which fulfills the SANSState contract.')

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

        # The component, i.e. HAB or LAB
        allowed_detectors = StringListValidator([
            DetectorType.to_string(DetectorType.LAB),
            DetectorType.to_string(DetectorType.HAB)
        ])
        self.declareProperty(
            "Component",
            DetectorType.to_string(DetectorType.LAB),
            validator=allowed_detectors,
            direction=Direction.Input,
            doc="The component of the instrument which is to be masked.")
Ejemplo n.º 30
0
 def PyInit(self):
     self.declareProperty(
         mantid.api.WorkspaceProperty(
             "Workspace",
             "",
             direction=Direction.InOut,
             optional=mantid.api.PropertyMode.Optional),
         "Input workspace (optional)")
     allowedInstrumentList = StringListValidator([''] +
                                                 self.INSTRUMENT_LIST)
     self.declareProperty("Instrument",
                          "",
                          validator=allowedInstrumentList,
                          doc="One of the following instruments: " +
                          ', '.join(self.INSTRUMENT_LIST))
     self.declareProperty(StringArrayProperty(name='Components', values=[]),
                          doc='Component names to mask')
     self.declareProperty(
         IntArrayProperty(name="Bank", values=[]),
         doc="Bank(s) to be masked. If empty, will apply to all banks")
     self.declareProperty(
         "Tube",
         "",
         doc="Tube(s) to be masked. If empty, will apply to all tubes")
     self.declareProperty(
         "Pixel",
         "",
         doc="Pixel(s) to be masked. If empty, will apply to all pixels")
     self.declareProperty(IntArrayProperty(name="MaskedDetectors",
                                           direction=Direction.Output),
                          doc="List of  masked detectors")
Ejemplo n.º 31
0
    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        # Workspace which is to be cropped
        self.declareProperty(MatrixWorkspaceProperty(
            "InputWorkspace",
            '',
            optional=PropertyMode.Mandatory,
            direction=Direction.Input),
                             doc='The input workspace')

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

        self.declareProperty(MatrixWorkspaceProperty(
            "OutputWorkspace",
            '',
            optional=PropertyMode.Mandatory,
            direction=Direction.Output),
                             doc='The cropped output workspace')
Ejemplo n.º 32
0
 def PyInit(self):
     validator = StringListValidator()
     validator.addAllowedValue(self._allowed)
     self.declareProperty("Input", "", validator)