当前位置: 首页>>代码示例>>Python>>正文


Python kernel.CompositeValidator类代码示例

本文整理汇总了Python中mantid.kernel.CompositeValidator的典型用法代码示例。如果您正苦于以下问题:Python CompositeValidator类的具体用法?Python CompositeValidator怎么用?Python CompositeValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CompositeValidator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: PyInit

    def PyInit(self):
        # State
        self.declareProperty(PropertyManagerProperty('SANSState'),
                             doc='A property manager which fulfills the SANSState contract.')
        # Input workspaces
        workspace_validator = CompositeValidator()
        workspace_validator.add(WorkspaceUnitValidator("Wavelength"))

        self.declareProperty(MatrixWorkspaceProperty("TransmissionWorkspace", '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The calculated transmission workspace in wavelength units.')
        self.declareProperty(MatrixWorkspaceProperty("NormalizeToMonitorWorkspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The monitor normalization workspace in wavelength units.')
        allowed_detector_types = StringListValidator([DetectorType.to_string(DetectorType.HAB),
                                                      DetectorType.to_string(DetectorType.LAB)])
        self.declareProperty("Component", DetectorType.to_string(DetectorType.LAB),
                             validator=allowed_detector_types, direction=Direction.Input,
                             doc="The component of the instrument which is currently being investigated.")

        # Output workspace
        self.declareProperty(MatrixWorkspaceProperty("OutputWorkspaceWavelengthAdjustment", '',
                                                     direction=Direction.Output),
                             doc='A wavelength adjustment output workspace.')
        self.declareProperty(MatrixWorkspaceProperty("OutputWorkspacePixelAdjustment", '',
                                                     direction=Direction.Output),
                             doc='A pixel adjustment output workspace.')
开发者ID:mantidproject,项目名称:mantid,代码行数:29,代码来源:SANSCreateWavelengthAndPixelAdjustment.py

示例2: PyInit

 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.')
开发者ID:samueljackson92,项目名称:mantid,代码行数:25,代码来源:ReflectometryILLPolarizationCor.py

示例3: PyInit

 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     mandatoryInputRuns = CompositeValidator()
     mandatoryInputRuns.add(StringArrayMandatoryValidator())
     lenValidator = StringArrayLengthValidator()
     lenValidator.setLengthMin(1)
     mandatoryInputRuns.add(lenValidator)
     self.declareProperty(StringArrayProperty(Prop.RUNS,
                                              values=[],
                                              validator=mandatoryInputRuns),
                          doc='A list of run numbers or workspace names for the input runs. '
                          'Multiple runs will be summed before reduction.')
     self.declareProperty(StringArrayProperty(Prop.FIRST_TRANS_RUNS,
                                              values=[]),
                          doc='A list of run numbers or workspace names for the first transmission run. '
                          'Multiple runs will be summed before reduction.')
     self.declareProperty(StringArrayProperty(Prop.SECOND_TRANS_RUNS,
                                              values=[]),
                          doc='A list of run numbers or workspace names for the second transmission run. '
                          'Multiple runs will be summed before reduction.')
     self._declareSliceAlgorithmProperties()
     self._declareReductionAlgorithmProperties()
     self.declareProperty(WorkspaceProperty(Prop.OUTPUT_WS, '',
                                            optional=PropertyMode.Optional,
                                            direction=Direction.Output),
                          doc='The output workspace, or workspace group if sliced.')
     self.declareProperty(WorkspaceProperty(Prop.OUTPUT_WS_BINNED, '',
                                            optional=PropertyMode.Optional,
                                            direction=Direction.Output),
                          doc='The binned output workspace, or workspace group if sliced.')
     self.declareProperty(WorkspaceProperty(Prop.OUTPUT_WS_LAM, '',
                                            optional=PropertyMode.Optional,
                                            direction=Direction.Output),
                          doc='The output workspace in wavelength, or workspace group if sliced.')
开发者ID:mantidproject,项目名称:mantid,代码行数:34,代码来源:ReflectometryISISLoadAndProcess.py

示例4: test_creation_with_add_succeeds_correctly_in_algorithm

 def test_creation_with_add_succeeds_correctly_in_algorithm(self):
     """
         Tests that a composite validator created with the add
         method validates correctly
     """
     validation = CompositeValidator()
     validation.add(FloatBoundedValidator(lower=5))
     validation.add(FloatBoundedValidator(upper=10))
     self._do_validation_test(validation)
开发者ID:BigShows,项目名称:mantid,代码行数:9,代码来源:CompositeValidatorTest.py

示例5: PyInit

    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))
开发者ID:DanNixon,项目名称:mantid,代码行数:53,代码来源:DirectILLIntegrateVanadium.py

示例6: PyInit

    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='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=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='An empty container workspace for subtraction from the input workspace.')
        self.declareProperty(name=common.PROP_EC_SCALING,
                             defaultValue=1.0,
                             validator=scalingFactor,
                             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.')
开发者ID:stuartcampbell,项目名称:mantid,代码行数:52,代码来源:DirectILLApplySelfShielding.py

示例7: PyInit

 def PyInit(self):
     """ Declare properties
     """
     validator = CompositeValidator()
     validator.add(WorkspaceUnitValidator("TOF"))
     validator.add(InstrumentValidator())
     self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", "", direction=Direction.Input, validator=validator),
                          doc="Input workspace.")
     self.declareProperty(ITableWorkspaceProperty("EPPTable", "", direction=Direction.Input),
                          doc="Input EPP table. May be produced by FindEPP algorithm.")
     self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", "", direction=Direction.Output),
                          doc="Name of the workspace that will contain the results")
     return
开发者ID:mcvine,项目名称:mantid,代码行数:13,代码来源:CorrectTOF.py

示例8: PyInit

    def PyInit(self):
        """Declare properties
        """
        wsValidators = CompositeValidator()
        # X axis must be a NumericAxis in energy transfer units.
        wsValidators.add(WorkspaceUnitValidator("DeltaE"))
        # Workspace must have an Instrument
        wsValidators.add(InstrumentValidator())

        self.declareProperty(MatrixWorkspaceProperty(name="InputWorkspace", defaultValue="", direction=Direction.Input,
                             validator=wsValidators), doc="Workspace name for input")
        self.declareProperty(FileProperty(name="Filename", defaultValue="", action=FileAction.Save, extensions=""),
                             doc="The name to use when writing the file")
开发者ID:DanNixon,项目名称:mantid,代码行数:13,代码来源:SaveYDA.py

示例9: PyInit

    def PyInit(self):
        # ----------
        # INPUT
        # ----------
        # State
        self.declareProperty(PropertyManagerProperty('SANSState'),
                             doc='A property manager which fulfills the SANSState contract.')

        # Main workspace
        workspace_validator = CompositeValidator()
        workspace_validator.add(WorkspaceUnitValidator("Wavelength"))
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The main input workspace.')

        # Adjustment workspaces
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspaceWavelengthAdjustment", '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The workspace which contains only wavelength-specific adjustments, ie which affects '
                                 'all spectra equally.')
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspacePixelAdjustment", '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input),
                             doc='The workspace which contains only pixel-specific adjustments, ie which affects '
                                 'all bins within a spectrum equally.')
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspaceWavelengthAndPixelAdjustment", '',
                                                     optional=PropertyMode.Optional, direction=Direction.Input,
                                                     validator=workspace_validator),
                             doc='The workspace which contains wavelength- and pixel-specific adjustments.')

        self.declareProperty('OutputParts', defaultValue=False,
                             direction=Direction.Input,
                             doc='Set to true to output two additional workspaces which will have the names '
                                 'OutputWorkspace_sumOfCounts OutputWorkspace_sumOfNormFactors. The division '
                                 'of _sumOfCounts and _sumOfNormFactors equals the workspace returned by the '
                                 'property OutputWorkspace (default is false).')

        # ----------
        # Output
        # ----------
        self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Output),
                             doc="The reduced workspace")
开发者ID:mantidproject,项目名称:mantid,代码行数:44,代码来源:SANSConvertToQ.py

示例10: PyInit

 def PyInit(self):
     validators = CompositeValidator()
     validators.add(HistogramValidator(True))
     validators.add(CommonBinsValidator())
     self.declareProperty(MatrixWorkspaceProperty(name='InputWorkspace', defaultValue='', direction=Direction.Input, validator=validators),
                          doc='Input MatrixWorkspace containing the reduced inelastic neutron spectrum in (Q,E) space.')
     self.declareProperty(name='Temperature', defaultValue=300., validator=FloatBoundedValidator(lower=0),
                          doc='Sample temperature in Kelvin.')
     self.declareProperty(name='MeanSquareDisplacement', defaultValue=0., validator=FloatBoundedValidator(lower=0),
                          doc='Average mean square displacement in Angstrom^2.')
     self.declareProperty(name='QSumRange', defaultValue='0,Qmax',
                          doc='Range in Q (in Angstroms^-1) to sum data over.')
     self.declareProperty(name='EnergyBinning', defaultValue='0,Emax/50,Emax*0.9',
                          doc='Energy binning parameters [Emin, Estep, Emax] in meV.')
     self.declareProperty(name='Wavenumbers', defaultValue=False,
                          doc='Should the output be in Wavenumbers (cm^-1)?')
     self.declareProperty(name='StatesPerEnergy', defaultValue=False,
                          doc='Should the output be in states per unit energy rather than mb/sr/fu/energy?\n'+
                          '(Only for pure elements, need to set the sample material information)')
     self.declareProperty(MatrixWorkspaceProperty(name='OutputWorkspace', defaultValue='', direction=Direction.Output),
                          doc='Output workspace name.')
开发者ID:mducle,项目名称:mantid,代码行数:21,代码来源:ComputeIncoherentDOS.py

示例11: PyInit

    def PyInit(self):
        """ Declare properties
        """
        validator = CompositeValidator()
        validator.add(WorkspaceUnitValidator("TOF"))
        validator.add(InstrumentValidator())

        self.declareProperty(
            MatrixWorkspaceProperty("InputWorkspace", "", direction=Direction.Input, validator=validator),
            doc="Input Sample workspace",
        )
        # Optional but required if tof_elastic must be taken from fitted Vanadium or sample data
        self.declareProperty(
            ITableWorkspaceProperty("EPPTable", "", direction=Direction.Input, optional=PropertyMode.Optional),
            "Input EPP table (optional). May be produced by FindEPP algorithm.",
        )
        self.declareProperty(
            WorkspaceProperty("OutputWorkspace", "", direction=Direction.Output),
            "Name of the workspace that will contain the result",
        )

        return
开发者ID:tyronerees,项目名称:mantid,代码行数:22,代码来源:TOFTOFConvertTofToDeltaE.py

示例12: PyInit

    def PyInit(self):
        self.declareProperty(FileProperty('CalibrationRun', '', action=FileAction.Load, extensions=['nxs']),
                             doc='File path of calibration run. Must be a detector scan.')

        self.declareProperty(FileProperty('CalibrationFile', '', action=FileAction.OptionalLoad, extensions=['nxs']),
                             doc='Optional file containing previous calibration constants.')

        self.declareProperty(name='CalibrationMethod',
                             defaultValue='Median',
                             validator=StringListValidator(['Median', 'Mean', 'MostLikelyMean']),
                             doc='The method of how the calibration constant of a '
                                 'pixel relative to the neighbouring one is derived.')

        self.declareProperty(name='InterpolateOverlappingAngles', defaultValue=False,
                             doc='Wheter to interpolate 2theta values for overlapping regions between neighbouring cells.')

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

        thetaRangeValidator = FloatArrayOrderedPairsValidator()

        self.declareProperty(FloatArrayProperty(name='ROI', values=[0,100.], 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(FloatArrayProperty(name='ExcludedRange', values=[], validator=thetaRangeValidator),
                             doc='2theta regions to exclude from the computation of relative calibration constants '
                                 '[in scattering angle in degrees]. ')

        pixelRangeValidator = CompositeValidator()
        greaterThanOne = IntArrayBoundedValidator()
        greaterThanOne.setLower(1)
        lengthTwo = IntArrayLengthValidator()
        lengthTwo.setLength(2)
        orderedPairsValidator = IntArrayOrderedPairsValidator()
        pixelRangeValidator.add(greaterThanOne)
        pixelRangeValidator.add(lengthTwo)
        pixelRangeValidator.add(orderedPairsValidator)

        self.declareProperty(IntArrayProperty(name='PixelRange', values=[1,3072], validator=pixelRangeValidator),
                             doc='Range of the pixel numbers to compute the calibration factors for. '
                                 'For the other pixels outside the range, the factor will be set to 1.')

        self.declareProperty(MatrixWorkspaceProperty('OutputResponseWorkspace', '',
                                                     optional=PropertyMode.Optional, direction=Direction.Output),
                             doc='Output workspace containing the summed diffraction patterns of all the pixels.')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace', '',
                                                     direction=Direction.Output),
                             doc='Output workspace containing the detector efficiencies for each pixel.')
开发者ID:DanNixon,项目名称:mantid,代码行数:54,代码来源:PowderDiffILLDetEffCorr.py

示例13: PyInit

    def PyInit(self):
        validator = CompositeValidator()
        validator.add(WorkspaceUnitValidator('Wavelength'))
        validator.add(HistogramValidator())
        validator.add(InstrumentValidator())

        self.declareProperty(MatrixWorkspaceProperty('InputWorkspace', defaultValue='',
                                                     validator = validator,
                                                     direction = Direction.Input),
                             doc='The input workspace in wavelength')

        self.declareProperty('BeamRadius', 0.1, FloatBoundedValidator(lower=0.), 'The radius of the beam [m]')

        self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace',
                                                     defaultValue='',
                                                     direction = Direction.Output),
                             doc='The output workspace')
开发者ID:mantidproject,项目名称:mantid,代码行数:17,代码来源:CalculateFlux.py

示例14: PyInit

    def PyInit(self):
        """Initialize the algorithm's input and output properties."""
        PROPGROUP_SIMULATION_INSTRUMENT = 'Simulation Instrument Settings'
        greaterThanOneInt = IntBoundedValidator(lower=2)
        greaterThanTwoInt = IntBoundedValidator(lower=3)
        inputWorkspaceValidator = CompositeValidator()
        inputWorkspaceValidator.add(InstrumentValidator())
        inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF'))

        # Properties.
        self.declareProperty(MatrixWorkspaceProperty(
            name=common.PROP_INPUT_WS,
            defaultValue='',
            validator=inputWorkspaceValidator,
            optional=PropertyMode.Optional,
            direction=Direction.Input),
            doc='A workspace for which to simulate the self shielding.')
        self.declareProperty(MatrixWorkspaceProperty(name=common.PROP_OUTPUT_WS,
                                                     defaultValue='',
                                                     direction=Direction.Output),
                             doc='A workspace containing the self shielding correction factors.')
        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(name=common.PROP_SIMULATION_INSTRUMENT,
                             defaultValue=common.SIMULATION_INSTRUMEN_SPARSE,
                             validator=StringListValidator([
                                 common.SIMULATION_INSTRUMEN_SPARSE,
                                 common.SIMULATION_INSTRUMENT_FULL]),
                             direction=Direction.Input,
                             doc='Select if the simulation should be performed on full or approximated instrument.')
        self.setPropertyGroup(common.PROP_SIMULATION_INSTRUMENT, PROPGROUP_SIMULATION_INSTRUMENT)
        self.declareProperty(name=common.PROP_SPARSE_INSTRUMENT_ROWS,
                             defaultValue=5,
                             validator=greaterThanTwoInt,
                             direction=Direction.Input,
                             doc='Number of detector rows in sparse simulation instrument.')
        self.setPropertyGroup(common.PROP_SPARSE_INSTRUMENT_ROWS, PROPGROUP_SIMULATION_INSTRUMENT)
        self.setPropertySettings(common.PROP_SPARSE_INSTRUMENT_ROWS, EnabledWhenProperty(common.PROP_SIMULATION_INSTRUMENT,
                                 PropertyCriterion.IsEqualTo, common.SIMULATION_INSTRUMEN_SPARSE))
        self.declareProperty(name=common.PROP_SPARSE_INSTRUMENT_COLUMNS,
                             defaultValue=20,
                             validator=greaterThanOneInt,
                             direction=Direction.Input,
                             doc='Number of detector columns in sparse simulation instrument.')
        self.setPropertyGroup(common.PROP_SPARSE_INSTRUMENT_COLUMNS, PROPGROUP_SIMULATION_INSTRUMENT)
        self.setPropertySettings(common.PROP_SPARSE_INSTRUMENT_COLUMNS, EnabledWhenProperty(common.PROP_SIMULATION_INSTRUMENT,
                                 PropertyCriterion.IsEqualTo, common.SIMULATION_INSTRUMEN_SPARSE))
        self.declareProperty(name=common.PROP_NUMBER_OF_SIMULATION_WAVELENGTHS,
                             defaultValue=Property.EMPTY_INT,
                             validator=greaterThanTwoInt,
                             direction=Direction.Input,
                             doc='Number of wavelength points where the simulation is performed (default: all).')
开发者ID:DanNixon,项目名称:mantid,代码行数:65,代码来源:DirectILLSelfShielding.py

示例15: PyInit

 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     threeNonnegativeInts = CompositeValidator()
     threeNonnegativeInts.add(IntArrayLengthValidator(3))
     nonnegativeInts = IntArrayBoundedValidator(lower=0)
     threeNonnegativeInts.add(nonnegativeInts)
     nonnegativeFloatArray = FloatArrayBoundedValidator(lower=0.)
     inWavelength = WorkspaceUnitValidator('Wavelength')
     self.declareProperty(
         MatrixWorkspaceProperty(
             Prop.INPUT_WS,
             defaultValue='',
             direction=Direction.Input,
             validator=inWavelength),
         doc='A reflected beam workspace (units wavelength).')
     self.declareProperty(
         MatrixWorkspaceProperty(
             Prop.OUTPUT_WS,
             defaultValue='',
             direction=Direction.Output),
         doc='The summed foreground workspace.')
     self.declareProperty(
         Prop.SUBALG_LOGGING,
         defaultValue=SubalgLogging.OFF,
         validator=StringListValidator([SubalgLogging.OFF, SubalgLogging.ON]),
         doc='Enable or disable child algorithm logging.')
     self.declareProperty(
         Prop.CLEANUP,
         defaultValue=utils.Cleanup.ON,
         validator=StringListValidator([utils.Cleanup.ON, utils.Cleanup.OFF]),
         doc='Enable or disable intermediate workspace cleanup.')
     self.declareProperty(
         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=inWavelength),
         doc='Summed direct beam workspace (units wavelength).')
     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.')
     self.declareProperty(
         MatrixWorkspaceProperty(
             Prop.DIRECT_WS,
             defaultValue='',
             direction=Direction.Input,
             optional=PropertyMode.Optional,
             validator=inWavelength),
         doc='The (not summed) direct beam workspace (units wavelength).')
     self.declareProperty(
         FloatArrayProperty(
             Prop.WAVELENGTH_RANGE,
             values=[0.],
             validator=nonnegativeFloatArray),
         doc='The wavelength bounds.')
开发者ID:mantidproject,项目名称:mantid,代码行数:64,代码来源:ReflectometryILLSumForeground.py


注:本文中的mantid.kernel.CompositeValidator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。