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.'
        )
Пример #3
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='A workspace to be integrated.')
        self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                               defaultValue='',
                                               direction=Direction.Output),
                             doc='The integrated workspace.')
        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='Vanadium temperature in Kelvin for Debye-Waller correction, '
            + 'overrides the default value from the sample logs.')
        self.setPropertySettings(
            common.PROP_TEMPERATURE,
            EnabledWhenProperty(common.PROP_DWF_CORRECTION,
                                PropertyCriterion.IsDefault))
Пример #4
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)
Пример #5
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'
     )
Пример #7
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.')
Пример #8
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.')
Пример #9
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")
Пример #10
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()
Пример #11
0
    def PyInit(self):
        self.declareProperty(StringArrayProperty('InputWorkspace', direction=Direction.Input, validator=ADSValidator()),
                             doc="Input MD workspace (in Q-space) to use for peak finding")
        cell_type = StringListValidator()
        cell_type.addAllowedValue("Cubic")
        cell_type.addAllowedValue("Hexagonal")
        cell_type.addAllowedValue("Rhombohedral")
        cell_type.addAllowedValue("Tetragonal")
        cell_type.addAllowedValue("Orthorhombic")
        cell_type.addAllowedValue("Monoclinic")
        cell_type.addAllowedValue("Triclinic")
        self.declareProperty("CellType", "", cell_type, doc="Cell type to use for UB refining")

        centering_type = StringListValidator()
        centering_type.addAllowedValue("F")
        centering_type.addAllowedValue("I")
        centering_type.addAllowedValue("C")
        centering_type.addAllowedValue("P")
        centering_type.addAllowedValue("R")
        self.declareProperty("Centering", "P", centering_type, doc="Centering to use for selecting cells")

        # Some of the options to pass through to FindPeaksMD (options like CalculateGoniometerForCW, FlipX, etc are
        # assumed to be True)
        self.declareProperty("MaxPeaks", 1000, doc="Maximum number of peaks to find.")
        self.declareProperty("PeakDistanceThreshold", 0.25, doc="Threshold distance for rejecting peaks that are found "
                                                                "to be too close from each other")
        # Having this number too low will likely cause FindUBUsingFFT to fail since not enough peaks will be found
        self.declareProperty("DensityThresholdFactor", 2000.0,
                             doc="Scaling factor which the overall signal density will be multiplied by to determine "
                                 "a threshold for determining peaks.")

        self.declareProperty("Wavelength", FloatPropertyWithValue.EMPTY_DBL,
                             doc="Wavelength value to use only if one was not found in the sample log")

        # Lattice parameter validators from same as FindUBUsingLatticeParameters
        self.declareProperty("UseLattice", False, direction=Direction.Input,
                             doc="Whether to refine UB matrix based on given lattice parameters")

        self.declareProperty("LatticeA", FloatPropertyWithValue.EMPTY_DBL, doc="The a value of the lattice")
        self.declareProperty("LatticeB", FloatPropertyWithValue.EMPTY_DBL, doc="The b value of the lattice")
        self.declareProperty("LatticeC", FloatPropertyWithValue.EMPTY_DBL, doc="The c value of the lattice")
        self.declareProperty("LatticeAlpha", FloatPropertyWithValue.EMPTY_DBL, doc="The alpha value of the lattice")
        self.declareProperty("LatticeBeta", FloatPropertyWithValue.EMPTY_DBL, doc="The beta value of the lattice")
        self.declareProperty("LatticeGamma", FloatPropertyWithValue.EMPTY_DBL, doc="The gamma value of the lattice")

        self.declareProperty(WorkspaceProperty("OutputWorkspace", defaultValue="", direction=Direction.Output,
                                               optional=PropertyMode.Mandatory), doc="Output peaks workspace")

        lattice_params = ["LatticeA", "LatticeB", "LatticeC", "LatticeAlpha", "LatticeBeta", "LatticeGamma"]
        for param in lattice_params:
            self.setPropertyGroup(param, "Lattice Settings")
            self.setPropertySettings(param, EnabledWhenProperty("UseLattice", PropertyCriterion.IsNotDefault))
Пример #12
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.')
    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.')
Пример #14
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.')
Пример #15
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')
    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.to_string(RangeStepType.Log),
            RangeStepType.to_string(RangeStepType.Lin)
        ])
        self.declareProperty('WavelengthStepType',
                             RangeStepType.to_string(RangeStepType.Lin),
                             validator=allowed_step_types,
                             direction=Direction.Input,
                             doc='The step type for rebinning.')

        # Rebin type
        allowed_rebin_methods = StringListValidator([
            RebinType.to_string(RebinType.Rebin),
            RebinType.to_string(RebinType.InterpolatingRebin)
        ])
        self.declareProperty(
            "RebinMode",
            RebinType.to_string(RebinType.Rebin),
            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.')
Пример #17
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')
Пример #18
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.')
Пример #19
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
    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.")
Пример #21
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))
Пример #22
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.")
Пример #23
0
    def PyInit(self):
        self.declareProperty(MatrixWorkspaceProperty(
            'SampleWorkspace',
            '',
            optional=PropertyMode.Mandatory,
            direction=Direction.Input),
                             doc="Name for the sample workspace.")

        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='Minimizer',
                             defaultValue='Levenberg-Marquardt',
                             validator=StringListValidator(
                                 ['Levenberg-Marquardt', 'FABADA']),
                             doc='Type of minimizer')

        self.declareProperty(name='MaxIterations',
                             defaultValue=500,
                             doc='Max iterations. Default=500')

        self.declareProperty(name='OutputName',
                             defaultValue='',
                             doc='Output workspace base name')
Пример #24
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')
Пример #25
0
    def PyInit(self):
        """Initilize the algorithms properties"""

        self.declareProperty(IPeaksWorkspaceProperty("InputWorkspace", '',
                                                     Direction.Input),
                             doc="The name of the peaks worksapce to save")

        self.declareProperty(
            FileProperty("Filename",
                         "",
                         action=FileAction.Save,
                         direction=Direction.Input),
            doc="File with the data from a phonon calculation.")

        self.declareProperty(name="Format",
                             direction=Direction.Input,
                             defaultValue="Fullprof",
                             validator=StringListValidator(
                                 dir(ReflectionFormat)),
                             doc="The output format to export reflections to")

        self.declareProperty(
            name="SplitFiles",
            defaultValue=False,
            direction=Direction.Input,
            doc="If True save separate files with only the peaks associated"
            "with a single modulation vector in a single file. Only "
            "applies to JANA format.")
Пример #26
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")
Пример #27
0
    def PyInit(self):
        self.declareProperty(
            mantid.api.WorkspaceProperty('InputWorkspace', '',
                                         mantid.kernel.Direction.Input),
            'Workspace to plot')
        self.declareProperty(mantid.api.FileProperty(
            'OutputFilename',
            '',
            action=mantid.api.FileAction.OptionalSave,
            extensions=['.png']),
                             doc='Name of the image file to savefile.')
        if have_plotly:
            outputTypes = ['image', 'plotly', 'plotly-full']
        else:
            outputTypes = ['image']
        self.declareProperty('OutputType', 'image',
                             StringListValidator(outputTypes),
                             'Method for rendering plot')
        self.declareProperty(
            'XLabel', '',
            'Label on the X axis. If empty, it will be taken from workspace')
        self.declareProperty(
            'YLabel', '',
            'Label on the Y axis. If empty, it will be taken from workspace')
        self.declareProperty(
            StringArrayProperty('SpectraNames', [], direction=Direction.Input),
            'Override with custom names for spectra')
        self.declareProperty('Result', '', Direction.Output)

        self.declareProperty(
            'PopCanvas', False,
            'If true, a Matplotlib canvas will be popped out '
            ', which contains the saved plot.')
Пример #28
0
    def PyInit(self):
        self.declareProperty(
            MatrixWorkspaceProperty('HABWorkspace', '', optional=PropertyMode.Mandatory, direction=Direction.Input),
            doc='High angle bank workspace in Q')

        self.declareProperty(
            MatrixWorkspaceProperty('LABWorkspace', '', optional=PropertyMode.Mandatory, direction=Direction.Input),
            doc='Low angle bank workspace in Q')

        allowedModes = StringListValidator(list(self._make_mode_map().keys()))

        self.declareProperty('Mode', 'None', validator=allowedModes, direction=Direction.Input,
                             doc='What to fit. Free parameter(s).')

        self.declareProperty('ScaleFactor', defaultValue=Property.EMPTY_DBL, direction=Direction.Input,
                             doc='Optional scaling factor')

        self.declareProperty('ShiftFactor', defaultValue=Property.EMPTY_DBL, direction=Direction.Input,
                             doc='Optional shift factor')

        self.declareProperty('FitMin', defaultValue=0.0, direction=Direction.Input,
                             doc='Optional minimum q for fit')

        self.declareProperty('FitMax', defaultValue=1000.0, direction=Direction.Input,
                             doc='Optional maximum q for fit')

        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')
Пример #29
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
Пример #30
0
    def PyInit(self):
        instruments = ['BSS', 'SNAP', 'REF_M', 'CNCS', 'EQSANS', 'VULCAN',
                       'VENUS', 'MANDI', 'TOPAZ', 'ARCS']
        self.declareProperty('Instrument', '',
                             StringListValidator(instruments),
                             'Empty uses default instrument')

        runValidator = IntBoundedValidator()
        runValidator.setLower(1)
        self.declareProperty('RunNumber', Property.EMPTY_INT, runValidator,
                             doc='Live run number to use (Optional, Default=most recent)')

        self.declareProperty(WorkspaceProperty('OutputWorkspace', '',
                                               direction=Direction.Output))

        self.declareProperty('NormalizeByCurrent', True, 'Normalize by current')

        self.declareProperty('LoadLogs', True,
                             'Attempt to load logs from an existing file')

        self.declareProperty(FileProperty('LogFilename', '',
                                          direction=Direction.Input,
                                          action=FileAction.OptionalLoad,
                                          extensions=['_event.nxs']),
                             doc='File containing logs to use (Optional)')
        self.setPropertySettings('LogFilename',
                                 EnabledWhenProperty('LoadLogs',
                                                     PropertyCriterion.IsDefault))