コード例 #1
0
 def PyInit(self):
     """
     Set the algorithm properties.
     """
     self.declareProperty(
         api.FileProperty(name="SnsRoiFile",
                          defaultValue="",
                          action=api.FileAction.Load,
                          extensions=EXTENSIONS),
         "SNS reduction ROI file to load.")
     allowedInstruments = kernel.StringListValidator(INSTRUMENTS)
     self.declareProperty("Instrument",
                          "",
                          validator=allowedInstruments,
                          doc="One of the supported instruments")
     self.declareProperty(
         "OutputFilePrefix", "",
         "Overrides the default filename for the output " +
         "file (Optional). Default is <inst_name>_Mask.")
     self.declareProperty(
         api.FileProperty(name="OutputDirectory",
                          defaultValue=config['defaultsave.directory'],
                          action=api.FileAction.Directory),
         "Directory to save mask file." +
         " Default is current Mantid save directory.")
コード例 #2
0
ファイル: DPDFreduction.py プロジェクト: luzpaz/mantid
    def PyInit(self):

        # Input parameters
        titleInputOptions = "Input"
        self.declareProperty('RunNumbers', '', 'Sample run numbers')
        self.setPropertyGroup("RunNumbers", titleInputOptions)
        self.declareProperty(
            api.FileProperty(name='Vanadium',
                             defaultValue='',
                             action=api.FileAction.OptionalLoad,
                             extensions=['.nxs']),
            'Preprocessed white-beam vanadium file.')
        self.setPropertyGroup("Vanadium", titleInputOptions)
        self.declareProperty('EmptyCanRunNumbers', '', 'Empty can run numbers')
        self.setPropertyGroup("EmptyCanRunNumbers", titleInputOptions)

        # Configuration parameters
        titleConfigurationOptions = "Configuration"

        e_validator = kapi.FloatArrayLengthValidator(1, 3)
        self.declareProperty(
            kapi.FloatArrayProperty('EnergyBins', [1.5],
                                    validator=e_validator),
            'Energy transfer binning scheme (in meV)')
        self.setPropertyGroup("EnergyBins", titleConfigurationOptions)

        q_validator = kapi.FloatArrayLengthValidator(0, 3)
        self.declareProperty(
            kapi.FloatArrayProperty('MomentumTransferBins',
                                    list(),
                                    validator=q_validator),
            'Momentum transfer binning scheme (in inverse Angstroms)')
        self.setPropertyGroup("MomentumTransferBins",
                              titleConfigurationOptions)

        self.declareProperty('NormalizeSlices',
                             False,
                             'Do we normalize each slice?',
                             direction=kapi.Direction.Input)
        self.setPropertyGroup("NormalizeSlices", titleConfigurationOptions)

        # Ouptut parameters
        titleOuptutOptions = "Output"
        self.declareProperty('CleanWorkspaces',
                             True,
                             'Do we clean intermediate steps?',
                             direction=kapi.Direction.Input)
        self.setPropertyGroup("CleanWorkspaces", titleOuptutOptions)
        self.declareProperty(
            api.MatrixWorkspaceProperty('OutputWorkspace', 'S_Q_E_sliced',
                                        kapi.Direction.Output),
            "Output workspace")
        self.setPropertyGroup("OutputWorkspace", titleOuptutOptions)