示例#1
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
示例#2
0
    def PyInit(self):
        self.declareProperty(FileProperty(name='Run',
                                          defaultValue='',
                                          action=FileAction.Load),
                             doc='Comma separated list of input files')

        self.declareProperty(name='MirrorMode',
                             defaultValue=False,
                             doc='Data uses mirror mode')

        self.declareProperty(FileProperty(name='MapFile',
                                          defaultValue='',
                                          action=FileAction.OptionalLoad,
                                          extensions=['xml']),
                             doc='Comma separated list of input files')

        self.declareProperty(FloatArrayProperty(
            name='PeakRange',
            values=[0.0, 100.0],
            validator=FloatArrayMandatoryValidator()),
                             doc='Peak range in energy transfer')

        self.declareProperty(name='ScaleFactor',
                             defaultValue=1.0,
                             doc='Intensity scaling factor')

        self.declareProperty(WorkspaceProperty('OutputWorkspace',
                                               '',
                                               direction=Direction.Output),
                             doc='Output workspace for calibration data')
示例#3
0
    def PyInit(self):
        self.declareProperty(FileProperty(name="Filename",
                                          defaultValue="",
                                          action=FileAction.Load,
                                          extensions=["raw"]),
                             doc="Data file produced by egraph.")

        self.declareProperty(
            FileProperty(name="InstrumentXML",
                         defaultValue="",
                         action=FileAction.OptionalLoad,
                         extensions=["xml"]),
            doc=
            "Instrument definition file. If no file is specified, the default idf is used."
        )

        self.declareProperty(
            'AngleOverride',
            -255.0,
            doc="Rotation angle (degrees) of the EXED magnet."
            "\nThis should be read from the data file!\n"
            "Only change the value if the file has an incomplete header!")

        self.declareProperty(
            MatrixWorkspaceProperty(name="OutputWorkspace",
                                    defaultValue="",
                                    direction=Direction.Output),
            doc="Mantid workspace containing the measured data.")

        self.declareProperty(
            WorkspaceProperty(name="OutputMonitorWorkspace",
                              defaultValue="",
                              direction=Direction.Output,
                              optional=PropertyMode.Optional),
            doc="Workspace containing the measured monitor spectra.")
示例#4
0
    def PyInit(self):

        self.declareProperty(
            FileProperty('Directory', '', action=FileAction.Directory),
            doc='Path to directory containing data files for logging.')

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

        self.declareProperty(
            "NumorRange", [0, 0],
            direction=Direction.Input,
            validator=IntArrayBoundedValidator(lower=0),
            doc=
            'Numor range or a list of numors to be analysed in the directory.')

        facilities = StringListValidator(list(config.getFacilityNames()))
        self.declareProperty(name='Facility',
                             defaultValue='ILL',
                             validator=facilities,
                             direction=Direction.Input,
                             doc='Facility the data belongs to.')

        self.declareProperty(
            'Instrument',
            '',
            validator=StringMandatoryValidator(),
            direction=Direction.Input,
            doc='Instrument the data has been collected with.')

        self.declareProperty(FileProperty('OutputFile',
                                          '',
                                          extensions=".csv",
                                          action=FileAction.OptionalSave),
                             doc='Comma-separated output file.')

        self.declareProperty(
            'OptionalHeaders',
            '',
            doc=
            'Names of optional metadata to be included in the logbook. Entries need to be specified'
            'in the instrument IPF.')

        self.declareProperty(
            'CustomEntries',
            '',
            doc=
            'Custom NeXus paths for additional metadata to be included in the logbook.'
        )

        self.declareProperty('CustomHeaders',
                             '',
                             doc='Names of those additional custom entries.')
示例#5
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.')
    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.')
 def PyInit(self):
     """Initialize the input and output properties of the algorithm."""
     mandatoryInputWorkspaces = CompositeValidator()
     mandatoryInputWorkspaces.add(StringArrayMandatoryValidator())
     mandatoryInputWorkspaces.add(StringArrayLengthValidator(1, 4))
     self.declareProperty(
         StringArrayProperty(Prop.INPUT_WS,
                             values=[],
                             validator=mandatoryInputWorkspaces),
         doc='A set of polarized workspaces, in wavelength.')
     self.declareProperty(
         WorkspaceGroupProperty(Prop.OUTPUT_WS,
                                defaultValue='',
                                direction=Direction.Output),
         doc='A group of polarization efficiency corrected workspaces.')
     self.declareProperty(Prop.SUBALG_LOGGING,
                          defaultValue=SubalgLogging.OFF,
                          validator=StringListValidator(
                              [SubalgLogging.OFF, SubalgLogging.ON]),
                          doc='Enable or disable child algorithm logging.')
     self.declareProperty(
         Prop.CLEANUP,
         defaultValue=utils.Cleanup.ON,
         validator=StringListValidator(
             [utils.Cleanup.ON, utils.Cleanup.OFF]),
         doc='Enable or disable intermediate workspace cleanup.')
     self.declareProperty(
         FileProperty(Prop.EFFICIENCY_FILE,
                      defaultValue='',
                      action=FileAction.Load),
         doc='A file containing the polarization efficiency factors.')
示例#8
0
    def PyInit(self) -> None:
        from abins.constants import ONE_DIMENSIONAL_INSTRUMENTS
        # Declare properties for all Abins Algorithms
        self.declare_common_properties()

        # Declare properties specific to 1D
        self.declareProperty(name="Autoconvolution", defaultValue=False,
                             doc="Estimate higher quantum orders by convolution with fundamental spectrum.")

        self.declareProperty(FileProperty("ExperimentalFile", "",
                                          action=FileAction.OptionalLoad,
                                          direction=Direction.Input,
                                          extensions=["raw", "dat"]),
                             doc="File with the experimental inelastic spectrum to compare.")

        self.declareProperty(name="Scale", defaultValue=1.0,
                             doc='Scale the intensity by the given factor. Default is no scaling.')

        self.declareProperty(name="EnergyUnits",
                             defaultValue="cm-1",
                             direction=Direction.Input,
                             validator=StringListValidator(["cm-1", "meV"]),
                             doc="Energy units for output workspace and experimental file")

        # Declare Instrument-related properties
        self.declare_instrument_properties(
            default="TOSCA", choices=ONE_DIMENSIONAL_INSTRUMENTS,
            multiple_choice_settings=[('Setting', 'settings',
                                       'Setting choice for this instrument (e.g. monochromator)')],
                )
示例#9
0
    def PyInit(self):
        """ Declare properties
        """
        self.declareProperty(
            MatrixWorkspaceProperty("InputWorkspace", "", Direction.Input),
            "Focused diffraction workspace to be exported to GSAS file. ")

        self.declareProperty(
            ITableWorkspaceProperty('BinningTable', '', Direction.Input,
                                    PropertyMode.Optional),
            'Table workspace containing binning parameters. If not specified, then no re-binning'
            'is required')

        self.declareProperty(
            MatrixWorkspaceProperty("OutputWorkspace", "", Direction.Output),
            "Name of rebinned matrix workspace. ")

        self.declareProperty(
            FileProperty("GSSFilename", "", FileAction.Save, ['.gda']),
            "Name of the output GSAS file. ")

        self.declareProperty("IPTS", mantid.kernel.Property.EMPTY_INT,
                             "IPTS number")

        self.declareProperty(
            "GSSParmFileName", "",
            "GSAS parameter file name for this GSAS data file.")

        return
示例#10
0
    def PyInit(self):
        """ Mantid required
        """

        self.declareProperty(FileProperty(name="Directory",defaultValue="",action=FileAction.Directory))

        self.declareProperty(ITableWorkspaceProperty("PoldiAnalysis", "PoldiAnalysis", direction=Direction.Output), "Poldi analysis main worksheet")
示例#11
0
 def test_constructor_with_name_and_default_and_action_and_exts_list(self):
     prop = FileProperty("LoadProperty", "", FileAction.Load, ['.nxs', '.raw'])
     self.assertNotEquals("", prop.isValid)
     self.assertEquals(Direction.Input, prop.direction)
     allowed = prop.allowedValues
     self.assertTrue('.nxs' in allowed)
     self.assertTrue('.raw' in allowed)
示例#12
0
 def PyInit(self):
     self.declareProperty(WorkspaceProperty('InputWorkspace',
                                            '',
                                            direction=Direction.Input),
                          doc='Raw workspace.')
     self.declareProperty(WorkspaceProperty('OutputWorkspace',
                                            '',
                                            direction=Direction.Output),
                          doc='Focused corrected workspace.')
     self.declareProperty(
         FileProperty("CalFileName",
                      "",
                      direction=Direction.Input,
                      action=FileAction.Load),
         doc='File path for the instrument calibration file.')
     self.declareProperty(name='SampleGeometry',
                          defaultValue={},
                          doc='Geometry of the sample material.')
     self.declareProperty(name='SampleMaterial',
                          defaultValue={},
                          doc='Chemical formula for the sample material.')
     self.declareProperty(
         name='CrystalDensity',
         defaultValue=0.0,
         doc='The crystalographic density of the material.')
示例#13
0
    def PyInit(self):
        """ Declare properties
        """
        self.declareProperty(
            WorkspaceProperty("Workspace", "", Direction.Input),
            "The workspace to export masks from.")

        self.declareProperty(
            FileProperty(name="Filename",
                         defaultValue="",
                         action=FileAction.OptionalSave,
                         extensions=[".msk"],
                         direction=Direction.Input),
            doc="The name or full path to the file to save mask to."
            " If empty, the name of the input workspace and default save directory are used."
        )
        self.declareProperty(
            "ExportMaskOnly", False,
            "If true, algorithm will not save mask in a file"
            "and only returns the list containing numbers of masked spectra.",
            Direction.Input)
        self.declareProperty(IntArrayProperty(name="SpectraMasks",
                                              direction=Direction.Output),
                             doc="List of the masked  spectra numbers.")
        return
示例#14
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.")
        return
示例#15
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))
示例#16
0
 def PyInit(self):
     self.declareProperty(MultipleFileProperty(name="Filename", action=FileAction.OptionalLoad,
                                               extensions=[".dat"]), "Data files to load")
     condition = EnabledWhenProperty("Filename", PropertyCriterion.IsDefault)
     self.declareProperty('IPTS', Property.EMPTY_INT, "IPTS number to load from")
     self.setPropertySettings("IPTS", condition)
     self.declareProperty('Exp', Property.EMPTY_INT, "Experiment number to load from")
     self.setPropertySettings("Exp", condition)
     self.declareProperty(IntArrayProperty("ScanNumbers", []), 'Scan numbers to load')
     self.setPropertySettings("ScanNumbers", condition)
     self.declareProperty(FileProperty(name="Vanadium", defaultValue="", action=FileAction.OptionalLoad, extensions=[".dat", ".txt"]),
                          doc="Vanadium file, can be either the vanadium scan file or the reduced vcorr file. "
                          "If not provided the vcorr file adjacent to the data file will be used")
     self.declareProperty('Normalise', True, "If False vanadium normalisation will not be performed")
     self.declareProperty(IntArrayProperty("ExcludeDetectors", []),
                          doc="Detectors to exclude. If not provided the HB2A_exp???__exclude_detectors.txt adjacent "
                          "to the data file will be used if it exist")
     self.declareProperty('DefX', '',
                          "By default the def_x (x-axis) from the file will be used, it can be overridden by setting it here")
     self.declareProperty('IndividualDetectors', False,
                          "If True the workspace will include each anode as a separate spectrum, useful for debugging issues")
     condition = EnabledWhenProperty("IndividualDetectors", PropertyCriterion.IsDefault)
     self.declareProperty('BinData', True, "Data will be binned using BinWidth. If False then all data will be unbinned")
     self.setPropertySettings("BinData", condition)
     positiveFloat = FloatBoundedValidator(lower=0., exclusive=True)
     self.declareProperty('BinWidth', 0.05, positiveFloat, "Bin size of the output workspace")
     self.setPropertySettings("BinWidth", condition)
     self.declareProperty('Scale', 1.0, positiveFloat, "The output will be scaled by this value")
     self.declareProperty(WorkspaceProperty("OutputWorkspace", "",
                                            optional=PropertyMode.Mandatory,
                                            direction=Direction.Output),
                          "Output Workspace")
示例#17
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.")
示例#18
0
    def PyInit(self):
        group = "Input"
        self.declareProperty(FileProperty(name="Filename",
                                          defaultValue="", action=FileAction.OptionalLoad,
                                          extensions=["_event.nxs", ".nxs.h5"]),
                             "Event file")
        self.copyProperties('AlignAndFocusPowderFromFiles', 'MaxChunkSize')
        self.declareProperty("FilterBadPulses", 95.,
                             doc="Filter out events measured while proton " +
                             "charge is more than 5% below average")

        self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", "",
                                                     direction=Direction.Input,
                                                     optional=PropertyMode.Optional),
                             doc="Handle to reduced workspace")
        self.setPropertyGroup("Filename", group)
        self.setPropertyGroup("MaxChunkSize", group)
        self.setPropertyGroup("FilterBadPulses", group)
        self.setPropertyGroup("InputWorkspace", group)

        group = "Output"
        self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", "",
                                                     direction=Direction.Output),
                             doc="Handle to reduced workspace")
        self.copyProperties('AlignAndFocusPowderFromFiles', 'CacheDir')
        self.declareProperty(FileProperty(name="PDFgetNFile", defaultValue="", action=FileAction.Save,
                                          extensions=[".getn"]), "Output filename")
        self.setPropertyGroup("OutputWorkspace", group)
        self.setPropertyGroup("PDFgetNFile", group)

        self.declareProperty(FileProperty(name="CalibrationFile",
                                          defaultValue="", action=FileAction.OptionalLoad,
                                          extensions=[".h5", ".hd5", ".hdf", ".cal"]))
        self.declareProperty(FileProperty(name="CharacterizationRunsFile", defaultValue="",
                                          action=FileAction.OptionalLoad,
                                          extensions=["txt"]),
                             "File with characterization runs denoted")
        self.copyProperties('AlignAndFocusPowderFromFiles',
                            ['FrequencyLogNames', 'WaveLengthLogNames', 'RemovePromptPulseWidth',
                             'CropWavelengthMin', 'CropWavelengthMax'])

        self.declareProperty(FloatArrayProperty("Binning", values=[0., 0., 0.],
                                                direction=Direction.Input),
                             "Positive is linear bins, negative is logorithmic")
        self.declareProperty("ResampleX", 0,
                             "Number of bins in x-axis. Non-zero value overrides \"Params\" property. " +
                             "Negative value means logorithmic binning.")
示例#19
0
    def PyInit(self):
        # Input workspace/data info (filename or IPTS+RunNumber)
        # Priority: Filename > IPTS + RunNumber
        self.declareProperty(
            MultipleFileProperty(name="Filename",
                                 action=FileAction.OptionalLoad,
                                 extensions=[".nxs.h5"]), "Files to load")
        self.declareProperty('IPTS', Property.EMPTY_INT,
                             "IPTS number to load from")
        self.declareProperty(IntArrayProperty("RunNumbers", []),
                             'Run numbers to load')

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

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

        # Output workspace/data info
        self.declareProperty(
            WorkspaceProperty("OutputWorkspace",
                              "",
                              optional=PropertyMode.Mandatory,
                              direction=Direction.Output), "Output Workspace")
示例#20
0
    def PyInit(self):
        #
        # Properties
        #
        self.declareProperty('RunNumbers', '', 'Sample run numbers')

        self.declareProperty(
            FloatArrayProperty(
                'MomentumTransferBins',
                [0.1, 0.0025, 2.5],  # invers A
                direction=Direction.Input),
            'Momentum transfer binning scheme')

        self.declareProperty(WorkspaceProperty('OutputWorkspace',
                                               '',
                                               optional=PropertyMode.Mandatory,
                                               direction=Direction.Output),
                             doc='Output reduced workspace')
        #
        # Common Properties
        #
        required_title = 'Required Properties'

        self.declareProperty(FileProperty(name='MaskFile',
                                          defaultValue=self._mask_file,
                                          action=FileAction.OptionalLoad,
                                          extensions=['.xml']),
                             doc='See documentation for latest mask files.')

        self.declareProperty(
            'MonitorNormalization', True,
            'Normalization with wavelength-dependent '
            'monitor counts')
        for a_property in ('MaskFile', 'MonitorNormalization'):
            self.setPropertyGroup(a_property, required_title)
        #
        # Background for the sample runs
        #
        background_title = 'Background runs'
        self.declareProperty('BackgroundRuns', '', 'Background run numbers')
        self.setPropertyGroup('BackgroundRuns', background_title)
        self.declareProperty("BackgroundScale",
                             1.0,
                             doc='The background will be scaled by this ' +
                             'number before being subtracted.')
        self.setPropertyGroup('BackgroundScale', background_title)
        self.declareProperty(WorkspaceProperty('OutputBackground',
                                               '',
                                               optional=PropertyMode.Optional,
                                               direction=Direction.Output),
                             doc='Reduced workspace for background runs')
        self.setPropertyGroup('OutputBackground', background_title)
        #
        # Vanadium
        #
        vanadium_title = 'Vanadium runs'
        self.declareProperty('VanadiumRuns', '', 'Vanadium run numbers')
        self.setPropertyGroup('VanadiumRuns', vanadium_title)
示例#21
0
    def PyInit(self):

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.declareProperty(name='AlignTubes', defaultValue=True,
                             doc='Align the tubes vertically and horizontally according to IPF.')
示例#22
0
 def PyInit(self):
     self.declareProperty(
         FileProperty(name="InputFile",
                      defaultValue="",
                      action=FileAction.Load,
                      extensions=["hdf"]))
     self.declareProperty(
         WorkspaceProperty(name="OutputWorkspace",
                           defaultValue="",
                           direction=Direction.Output))
示例#23
0
 def PyInit(self):
     #global dictsearch
     instruments=["AMOR","BOA","DMC","FOCUS","HRPT","MARSI","MARSE","POLDI",
                  "RITA-2","SANS","SANS2","TRICS"]
     self.declareProperty("Instrument","AMOR",
                          StringListValidator(instruments),
                          "Choose Instrument",direction=Direction.Input)
     self.declareProperty(FileProperty(name="Filename",defaultValue="",
                                       action=FileAction.Load, extensions=[".h5",".hdf"]))
     self.declareProperty(WorkspaceProperty("OutputWorkspace","",direction=Direction.Output))
示例#24
0
 def PyInit(self):
     self.declareProperty(
         FileProperty(
             name='InputFile',
             defaultValue='',
             action=FileAction.Load,
             extensions=['dcs01', 'mdcs01', 'mint01', 'mdor01', 'mgor01']))
     self.declareProperty(
         WorkspaceProperty(name='OutputWorkspace',
                           defaultValue='',
                           direction=Direction.Output))
示例#25
0
    def PyInit(self):
        self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", '',
                                                     optional=PropertyMode.Mandatory, direction=Direction.Input),
                             doc='The workspace which is to be saved.'
                                 ' This workspace needs to be the result of a SANS reduction,'
                                 ' i.e. it can only be 1D or 2D if the second axis is numeric.')

        self.declareProperty(FileProperty("Filename", '', action=FileAction.Save,
                                          extensions=[]),
                             doc="The name of the file which needs to be stored. Note that "
                                 "the actual file type is selected below.")

        self.declareProperty(MatrixWorkspaceProperty("Transmission", defaultValue='',
                                                     optional=PropertyMode.Optional, direction=Direction.Input),
                             doc='The sample transmission workspace. Optional.')
        self.declareProperty(MatrixWorkspaceProperty("TransmissionCan", defaultValue='',
                                                     optional=PropertyMode.Optional, direction=Direction.Input),
                             doc='The can transmission workspace. Optional.')

        self.declareProperty("Nexus", False, direction=Direction.Input,
                             doc="Save as nexus format. "
                                 "Note that if file formats of the same type, e.g. .xml are chosen, then the "
                                 "file format is appended to the file name.")
        self.declareProperty("CanSAS", False, direction=Direction.Input,
                             doc="Save as CanSAS xml format."
                                 "Note that if file formats of the same type, e.g. .xml are chosen, then the "
                                 "file format is appended to the file name.")
        self.declareProperty("NXcanSAS", False, direction=Direction.Input,
                             doc="Save as NXcanSAS format."
                                 "Note that if file formats of the same type, e.g. .xml are chosen, then the "
                                 "file format is appended to the file name.")
        self.declareProperty("NistQxy", False, direction=Direction.Input,
                             doc="Save as Nist Qxy format."
                                 "Note that if file formats of the same type, e.g. .xml are chosen, then the "
                                 "file format is appended to the file name.")
        self.declareProperty("RKH", False, direction=Direction.Input,
                             doc="Save as RKH format."
                                 "Note that if file formats of the same type, e.g. .xml are chosen, then the "
                                 "file format is appended to the file name.")
        self.declareProperty("CSV", False, direction=Direction.Input,
                             doc="Save as CSV format."
                                 "Note that if file formats of the same type, e.g. .xml are chosen, then the "
                                 "file format is appended to the file name.")

        self.setPropertyGroup("Nexus", 'FileFormats')
        self.setPropertyGroup("CanSAS", 'FileFormats')
        self.setPropertyGroup("NXCanSAS", 'FileFormats')
        self.setPropertyGroup("NistQxy", 'FileFormats')
        self.setPropertyGroup("RKH", 'FileFormats')
        self.setPropertyGroup("CSV", 'FileFormats')

        self.declareProperty("UseZeroErrorFree", True, direction=Direction.Input,
                             doc="This allows the user to artificially inflate zero error values.")
示例#26
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")
示例#27
0
    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")
示例#28
0
 def PyInit(self):
     self.declareProperty(FileProperty(
         name='InputFile',
         defaultValue='',
         action=FileAction.Load,
         extensions=[".dcs01", ".mdsc01", ".mint01", ".mdor01", ".mgor01"]),
                          doc="Gudrun output file to be loaded.")
     self.declareProperty(
         WorkspaceProperty(name='OutputWorkspace',
                           defaultValue='',
                           direction=Direction.Output,
                           optional=PropertyMode.Optional),
         doc="If No OutputWorkspace is provided, then the workpsace name "
         "will be obtained from the meta data in the input file.")
示例#29
0
    def PyInit(self):
        """ Declare properties
        """
        self.declareProperty(FileProperty("Filename","", FileAction.Load, ['.hkl', '.prf', '.dat']),
                             "Name of [http://www.ill.eu/sites/fullprof/ Fullprof] .hkl or .prf file.")

        #self.declareProperty("Bank", 1, "Bank ID for output if there are more than one bank in .irf file.")

        self.declareProperty(ITableWorkspaceProperty("PeakParameterWorkspace", "", Direction.Output),
                             "Name of table workspace containing peak parameters from .hkl file.")

        self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", "", Direction.Output),
                             "Name of data workspace containing the diffraction pattern in .prf file. ")

        return
示例#30
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.')