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): self.declareProperty(ITableWorkspaceProperty('InputWorkspace', '', Direction.Input), doc='Input table workspace.') validator = IntArrayBoundedValidator() validator.setLower(0) self.declareProperty( IntArrayProperty('ColumnIndices', values=[], direction=Direction.Input, validator=validator), 'Comma separated list of column indices for which statistics will be separated') self.declareProperty(ITableWorkspaceProperty('OutputWorkspace', '', Direction.Output), doc='Output workspace containing column statistics.')
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.')
def PyInit(self): self.declareProperty(ITableWorkspaceProperty('InputWorkspace', '', Direction.Input), doc='Input table workspace.') validator = IntArrayBoundedValidator() validator.setLower(0) self.declareProperty( IntArrayProperty('ColumnIndices', values=[], direction=Direction.Input, validator=validator), 'Comma separated list of column indices for which statistics will be separated' ) self.declareProperty( ITableWorkspaceProperty('OutputWorkspace', '', Direction.Output), doc='Output workspace containing column statistics.')
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.')
def PyInit(self): validator = IntArrayBoundedValidator() validator.setLower(0) self.declareProperty(IntArrayProperty("RunNumbers", values=[0], direction=Direction.Input, validator=validator), "Run numbers to process, comma separated") self.declareProperty("LiveData", False, "Read live data - requires a saved run in the current IPTS " + "with the same Instrument configuration as the live run") mask = ["None", "Horizontal", "Vertical", "Masking Workspace", "Custom - xml masking file"] self.declareProperty("Masking", "None", StringListValidator(mask), "Mask to be applied to the data") self.declareProperty(WorkspaceProperty("MaskingWorkspace", "", Direction.Input, PropertyMode.Optional), "The workspace containing the mask.") self.declareProperty(FileProperty(name="MaskingFilename", defaultValue="", direction=Direction.Input, action=FileAction.OptionalLoad), doc="The file containing the xml mask.") self.declareProperty(name="Calibration", defaultValue="Convert Units", validator=StringListValidator( ['Convert Units', 'Calibration File', 'DetCal File']), direction=Direction.Input, doc="The type of conversion to d_spacing to be used.") self.declareProperty(FileProperty(name="CalibrationFilename", defaultValue="", extensions=['.h5', '.cal'], direction=Direction.Input, action=FileAction.OptionalLoad), doc="The calibration file to convert to d_spacing.") self.declareProperty(MultipleFileProperty(name='DetCalFilename', extensions=['.detcal'], action=FileAction.OptionalLoad), 'ISAW DetCal file') self.declareProperty(FloatArrayProperty("Binning", [0.5, -0.004, 7.0]), "Min, Step, and Max of d-space bins. Logarithmic binning is used if Step is negative.") nor_corr = ["None", "From Workspace", "From Processed Nexus", "Extracted from Data"] self.declareProperty("Normalization", "None", StringListValidator(nor_corr), "If needed what type of input to use as normalization, Extracted from " + "Data uses a background determination that is peak independent.This " + "implemantation can be tested in algorithm SNAP Peak Clipping Background") self.declareProperty(FileProperty(name="NormalizationFilename", defaultValue="", direction=Direction.Input, action=FileAction.OptionalLoad), doc="The file containing the processed nexus for normalization.") self.declareProperty(WorkspaceProperty("NormalizationWorkspace", "", Direction.Input, PropertyMode.Optional), "The workspace containing the normalization data.") self.declareProperty("PeakClippingWindowSize", 10, "Read live data - requires a saved run in the current " + "IPTS with the same Instrumnet configuration") self.declareProperty("SmoothingRange", 10, "Read live data - requires a saved run in the " + "current IPTS with the same Instrumnet configuration") grouping = ["All", "Column", "Banks", "Modules", "2_4 Grouping"] self.declareProperty("GroupDetectorsBy", "All", StringListValidator(grouping), "Detector groups to use for future focussing: " + "All detectors as one group, Groups (East,West for " + "SNAP), Columns for SNAP, detector banks") mode = ["Set-Up", "Production"] self.declareProperty("ProcessingMode", "Production", StringListValidator(mode), "Set-Up Mode is used for establishing correct parameters. Production " + "Mode only Normalized workspace is kept for each run.") self.declareProperty(name="OptionalPrefix", defaultValue="", direction=Direction.Input, doc="Optional Prefix to be added to workspaces and output filenames") self.declareProperty("SaveData", False, "Save data in the following formats: Ascii- " + "d-spacing ,Nexus Processed,GSAS and Fullprof") self.declareProperty(FileProperty(name="OutputDirectory", defaultValue="", action=FileAction.OptionalDirectory), doc='Default value is proposal shared directory')
def PyInit(self): """Initialize the algorithm's input and output properties.""" PROPGROUP_BEAM_STOP_DIAGNOSTICS = 'Beam Stop Diagnostics' PROPGROUP_BKG_DIAGNOSTICS = 'Background Diagnostics' PROPGROUP_PEAK_DIAGNOSTICS = 'Elastic Peak Diagnostics' PROPGROUP_USER_MASK = 'Additional Masking' greaterThanUnityFloat = FloatBoundedValidator(lower=1) inputWorkspaceValidator = CompositeValidator() inputWorkspaceValidator.add(InstrumentValidator()) inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF')) positiveFloat = FloatBoundedValidator(lower=0) positiveIntArray = IntArrayBoundedValidator() positiveIntArray.setLower(0) scalingFactor = FloatBoundedValidator(lower=0, upper=1) # Properties. self.declareProperty( MatrixWorkspaceProperty(name=common.PROP_INPUT_WS, defaultValue='', validator=inputWorkspaceValidator, direction=Direction.Input), doc= "A 'raw' workspace from DirectILLCollectData to calculate the diagnostics from." ) self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS, defaultValue='', direction=Direction.Output), doc='A diagnostics mask 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.Optional), doc='Table workspace containing results from the FindEPP algorithm.' ) self.declareProperty(name=common.PROP_ELASTIC_PEAK_DIAGNOSTICS, defaultValue=common.ELASTIC_PEAK_DIAGNOSTICS_AUTO, validator=StringListValidator([ common.ELASTIC_PEAK_DIAGNOSTICS_AUTO, common.ELASTIC_PEAK_DIAGNOSTICS_ON, common.ELASTIC_PEAK_DIAGNOSTICS_OFF ]), direction=Direction.Input, doc='Enable or disable elastic peak diagnostics.') self.setPropertyGroup(common.PROP_ELASTIC_PEAK_DIAGNOSTICS, PROPGROUP_PEAK_DIAGNOSTICS) self.declareProperty( name=common.PROP_ELASTIC_PEAK_SIGMA_MULTIPLIER, defaultValue=3.0, validator=positiveFloat, direction=Direction.Input, doc="Integration half width of the elastic peak in multiples " + " of 'Sigma' in the EPP table.") self.setPropertyGroup(common.PROP_ELASTIC_PEAK_SIGMA_MULTIPLIER, PROPGROUP_PEAK_DIAGNOSTICS) self.declareProperty(name=common.PROP_PEAK_DIAGNOSTICS_LOW_THRESHOLD, defaultValue=Property.EMPTY_DBL, validator=positiveFloat, direction=Direction.Input, doc='Multiplier for lower acceptance limit ' + 'used in elastic peak diagnostics.') self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_LOW_THRESHOLD, PROPGROUP_PEAK_DIAGNOSTICS) self.declareProperty(name=common.PROP_PEAK_DIAGNOSTICS_HIGH_THRESHOLD, defaultValue=Property.EMPTY_DBL, validator=greaterThanUnityFloat, direction=Direction.Input, doc='Multiplier for higher acceptance limit ' + 'used in elastic peak diagnostics.') self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_HIGH_THRESHOLD, PROPGROUP_PEAK_DIAGNOSTICS) self.declareProperty( name=common.PROP_PEAK_DIAGNOSTICS_SIGNIFICANCE_TEST, defaultValue=Property.EMPTY_DBL, validator=positiveFloat, direction=Direction.Input, doc= 'To fail the elastic peak diagnostics, the intensity must also exceed ' + 'this number of error bars with respect to the median intensity.') self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_SIGNIFICANCE_TEST, PROPGROUP_PEAK_DIAGNOSTICS) self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS, defaultValue=common.BKG_DIAGNOSTICS_AUTO, validator=StringListValidator([ common.BKG_DIAGNOSTICS_AUTO, common.BKG_DIAGNOSTICS_ON, common.BKG_DIAGNOSTICS_OFF ]), direction=Direction.Input, doc='Control the background diagnostics.') self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS, PROPGROUP_BKG_DIAGNOSTICS) self.declareProperty( name=common.PROP_BKG_SIGMA_MULTIPLIER, defaultValue=10.0, validator=positiveFloat, direction=Direction.Input, doc= "Width of the range excluded from background integration around " + "the elastic peaks in multiplies of 'Sigma' in the EPP table") self.setPropertyGroup(common.PROP_BKG_SIGMA_MULTIPLIER, PROPGROUP_BKG_DIAGNOSTICS) self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS_LOW_THRESHOLD, defaultValue=Property.EMPTY_DBL, validator=positiveFloat, direction=Direction.Input, doc='Multiplier for lower acceptance limit ' + 'used in noisy background diagnostics.') self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_LOW_THRESHOLD, PROPGROUP_BKG_DIAGNOSTICS) self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS_HIGH_THRESHOLD, defaultValue=Property.EMPTY_DBL, validator=greaterThanUnityFloat, direction=Direction.Input, doc='Multiplier for higher acceptance limit ' + 'used in noisy background diagnostics.') self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_HIGH_THRESHOLD, PROPGROUP_BKG_DIAGNOSTICS) self.declareProperty( name=common.PROP_BKG_DIAGNOSTICS_SIGNIFICANCE_TEST, defaultValue=Property.EMPTY_DBL, validator=positiveFloat, direction=Direction.Input, doc= 'To fail the background diagnostics, the background level must also exceed ' + 'this number of error bars with respect to the median level.') self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_SIGNIFICANCE_TEST, PROPGROUP_BKG_DIAGNOSTICS) self.declareProperty(name=common.PROP_BEAM_STOP_DIAGNOSTICS, defaultValue=common.BEAM_STOP_DIAGNOSTICS_AUTO, validator=StringListValidator([ common.BEAM_STOP_DIAGNOSTICS_AUTO, common.BEAM_STOP_DIAGNOSTICS_ON, common.BEAM_STOP_DIAGNOSTICS_OFF ]), direction=Direction.Input, doc='Control the beam stop diagnostics.') self.setPropertyGroup(common.PROP_BEAM_STOP_DIAGNOSTICS, PROPGROUP_BEAM_STOP_DIAGNOSTICS) self.declareProperty( name=common.PROP_BEAM_STOP_THRESHOLD, defaultValue=0.67, validator=scalingFactor, direction=Direction.Input, doc= 'Multiplier for the lower acceptance limit for beam stop diagnostics.' ) self.setPropertyGroup(common.PROP_BEAM_STOP_THRESHOLD, PROPGROUP_BEAM_STOP_DIAGNOSTICS) self.declareProperty( name=common.PROP_DEFAULT_MASK, defaultValue=common.DEFAULT_MASK_ON, validator=StringListValidator( [common.DEFAULT_MASK_ON, common.DEFAULT_MASK_OFF]), direction=Direction.Input, doc='Enable or disable instrument specific default mask.') self.declareProperty(IntArrayProperty(name=common.PROP_USER_MASK, values='', validator=positiveIntArray, direction=Direction.Input), doc='List of spectra to mask.') self.setPropertyGroup(common.PROP_USER_MASK, PROPGROUP_USER_MASK) self.declareProperty(StringArrayProperty( name=common.PROP_USER_MASK_COMPONENTS, values='', direction=Direction.Input), doc='List of instrument components to mask.') self.setPropertyGroup(common.PROP_USER_MASK_COMPONENTS, PROPGROUP_USER_MASK) # Rest of the output properties self.declareProperty( ITableWorkspaceProperty( name=common.PROP_OUTPUT_DIAGNOSTICS_REPORT_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output table workspace for detector diagnostics reporting.') self.setPropertyGroup(common.PROP_OUTPUT_DIAGNOSTICS_REPORT_WS, common.PROPGROUP_OPTIONAL_OUTPUT) self.declareProperty(name=common.PROP_OUTPUT_DIAGNOSTICS_REPORT, defaultValue='', direction=Direction.Output, doc='Diagnostics report as a string.') self.setPropertyGroup(common.PROP_OUTPUT_DIAGNOSTICS_REPORT, common.PROPGROUP_OPTIONAL_OUTPUT)
def PyInit(self): """Initialize the algorithm's input and output properties.""" PROPGROUP_FLAT_BKG = 'Flat Time-Independent Background' PROPGROUP_INCIDENT_ENERGY_CALIBRATION = 'Indicent Energy Calibration' PROPGROUP_MON_NORMALISATION = 'Neutron Flux Normalisation' # Validators. mandatoryPositiveInt = CompositeValidator() mandatoryPositiveInt.add(IntMandatoryValidator()) mandatoryPositiveInt.add(IntBoundedValidator(lower=0)) positiveFloat = FloatBoundedValidator(lower=0) positiveInt = IntBoundedValidator(lower=0) positiveIntArray = IntArrayBoundedValidator() positiveIntArray.setLower(0) inputWorkspaceValidator = CompositeValidator() inputWorkspaceValidator.add(InstrumentValidator()) inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF')) # Properties. self.declareProperty(MultipleFileProperty(name=common.PROP_INPUT_FILE, action=FileAction.OptionalLoad, extensions=['nxs']), doc='An input run number (or a list thereof) or a filename.') self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_INPUT_WS, defaultValue='', validator=inputWorkspaceValidator, optional=PropertyMode.Optional, direction=Direction.Input), doc='Input workspace if no run is given.') self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS, defaultValue='', direction=Direction.Output), doc='A flux normalized and background subtracted 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(name=common.PROP_EPP_METHOD, defaultValue=common.EPP_METHOD_AUTO, validator=StringListValidator([ common.EPP_METHOD_AUTO, common.EPP_METHOD_FIT, common.EPP_METHOD_CALCULATE]), direction=Direction.Input, doc='Method to create the EPP table for detectors (monitor is awlays fitted).') self.declareProperty(name=common.PROP_EPP_SIGMA, defaultValue=Property.EMPTY_DBL, validator=positiveFloat, direction=Direction.Input, doc='Nominal sigma for the EPP table when ' + common.PROP_EPP_METHOD + ' is set to ' + common.EPP_METHOD_CALCULATE + ' (default: 10 times the first bin width).') self.declareProperty(name=common.PROP_ELASTIC_CHANNEL_MODE, defaultValue=common.ELASTIC_CHANNEL_AUTO, validator=StringListValidator([ common.ELASTIC_CHANNEL_AUTO, common.ELASTIC_CHANNEL_SAMPLE_LOG, common.ELASTIC_CHANNEL_FIT]), direction=Direction.Input, doc='How to acquire the nominal elastic channel.') self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_ELASTIC_CHANNEL_WS, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='A single value workspace containing the nominal elastic channel index. Overrides ' + common.PROP_ELASTIC_CHANNEL_MODE + '.') self.declareProperty(name=common.PROP_MON_INDEX, defaultValue=Property.EMPTY_INT, validator=positiveInt, direction=Direction.Input, doc='Index of the incident monitor, if not specified in instrument parameters.') self.declareProperty(name=common.PROP_INCIDENT_ENERGY_CALIBRATION, defaultValue=common.INCIDENT_ENERGY_CALIBRATION_AUTO, validator=StringListValidator([ common.INCIDENT_ENERGY_CALIBRATION_AUTO, common.INCIDENT_ENERGY_CALIBRATION_ON, common.INCIDENT_ENERGY_CALIBRATION_OFF]), direction=Direction.Input, doc='Control the incident energy calibration.') self.setPropertyGroup(common.PROP_INCIDENT_ENERGY_CALIBRATION, PROPGROUP_INCIDENT_ENERGY_CALIBRATION) self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_INCIDENT_ENERGY_WS, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='A single-valued workspace holding a previously determined ' + 'incident energy.') self.setPropertyGroup(common.PROP_INCIDENT_ENERGY_WS, PROPGROUP_INCIDENT_ENERGY_CALIBRATION) self.declareProperty(name=common.PROP_FLAT_BKG, defaultValue=common.BKG_AUTO, validator=StringListValidator([ common.BKG_AUTO, common.BKG_ON, common.BKG_OFF]), direction=Direction.Input, doc='Control flat background subtraction.') self.setPropertyGroup(common.PROP_FLAT_BKG, PROPGROUP_FLAT_BKG) self.declareProperty(name=common.PROP_FLAT_BKG_SCALING, defaultValue=1.0, validator=positiveFloat, direction=Direction.Input, doc='Flat background multiplication factor.') self.setPropertyGroup(common.PROP_FLAT_BKG_SCALING, PROPGROUP_FLAT_BKG) self.declareProperty(name=common.PROP_FLAT_BKG_WINDOW, defaultValue=30, validator=mandatoryPositiveInt, direction=Direction.Input, doc='Running average window width (in bins) for flat background.') self.setPropertyGroup(common.PROP_FLAT_BKG_WINDOW, PROPGROUP_FLAT_BKG) self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_FLAT_BKG_WS, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='Workspace with previously determined flat background data.') self.setPropertyGroup(common.PROP_FLAT_BKG_WS, PROPGROUP_FLAT_BKG) self.declareProperty(name=common.PROP_NORMALISATION, defaultValue=common.NORM_METHOD_MON, validator=StringListValidator([ common.NORM_METHOD_MON, common.NORM_METHOD_TIME, common.NORM_METHOD_OFF]), direction=Direction.Input, doc='Normalisation method.') self.setPropertyGroup(common.PROP_NORMALISATION, PROPGROUP_MON_NORMALISATION) self.declareProperty(name=common.PROP_MON_PEAK_SIGMA_MULTIPLIER, defaultValue=3.0, validator=positiveFloat, direction=Direction.Input, doc="Width of the monitor peak in multiples " + " of 'Sigma' in monitor's EPP table.") self.setPropertyGroup(common.PROP_MON_PEAK_SIGMA_MULTIPLIER, PROPGROUP_MON_NORMALISATION) # Rest of the output properties. self.declareProperty(WorkspaceProperty( name=common.PROP_OUTPUT_RAW_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Non-normalized and non-background subtracted output workspace for DirectILLDiagnostics.') self.setPropertyGroup(common.PROP_OUTPUT_RAW_WS, common.PROPGROUP_OPTIONAL_OUTPUT) self.declareProperty(WorkspaceProperty( name=common.PROP_OUTPUT_ELASTIC_CHANNEL_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output workspace for elastic channel index.') self.setPropertyGroup(common.PROP_OUTPUT_ELASTIC_CHANNEL_WS, common.PROPGROUP_OPTIONAL_OUTPUT) self.declareProperty(ITableWorkspaceProperty( name=common.PROP_OUTPUT_DET_EPP_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output workspace for elastic peak positions.') self.setPropertyGroup(common.PROP_OUTPUT_DET_EPP_WS, common.PROPGROUP_OPTIONAL_OUTPUT) self.declareProperty(WorkspaceProperty( name=common.PROP_OUTPUT_INCIDENT_ENERGY_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output workspace for calibrated incident energy.') self.setPropertyGroup(common.PROP_OUTPUT_INCIDENT_ENERGY_WS, common.PROPGROUP_OPTIONAL_OUTPUT) self.declareProperty(WorkspaceProperty( name=common.PROP_OUTPUT_FLAT_BKG_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output workspace for flat background.') self.setPropertyGroup(common.PROP_OUTPUT_FLAT_BKG_WS, common.PROPGROUP_OPTIONAL_OUTPUT)
def PyInit(self): self.declareProperty( MultipleFileProperty('CalibrationRun', action=FileAction.Load, extensions=['nxs']), doc= 'File path of calibration runs (numors). Must be detector scans.') 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 ' 'is derived from the distribution of ratios.') self.declareProperty( name='DerivationMethod', defaultValue='SequentialSummedReference1D', validator=StringListValidator( ['SequentialSummedReference1D', 'GlobalSummedReference2D']), doc= 'Choose sequential for D20 (1D detector), global for D2B (2D detector).' ) self.declareProperty( name='InterpolateOverlappingAngles', defaultValue=False, doc= 'Whether to interpolate scattering angle values in overlapping regions (D20 only).' ) self.declareProperty( name='NormaliseTo', defaultValue='None', validator=StringListValidator(['None', 'Monitor', 'ROI']), doc= 'Normalise to monitor or ROI counts before deriving the calibration.' ) thetaRangeValidator = FloatArrayOrderedPairsValidator() self.declareProperty( FloatArrayProperty(name='ROI', values=[0, 100.], validator=thetaRangeValidator), doc= 'Scattering angle regions of interest for normalisation [degrees].' ) normaliseToROI = VisibleWhenProperty('NormaliseTo', PropertyCriterion.IsEqualTo, 'ROI') self.setPropertySettings('ROI', normaliseToROI) self.declareProperty( FloatArrayProperty(name='ExcludedRange', values=[], validator=thetaRangeValidator), doc='Scattering angle regions to exclude from the computation of ' 'relative calibration constants; for example, the beam stop [degrees]. ' ) pixelRangeValidator = CompositeValidator() greaterThanOne = IntArrayBoundedValidator(lower=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 (D20 only); ' '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 overlapping pixels.' ) self.declareProperty( MatrixWorkspaceProperty('OutputWorkspace', '', direction=Direction.Output), doc= 'Output workspace containing the calibration constants (inverse of efficiency) for each pixel.' ) self.declareProperty( name='NumberOfIterations', defaultValue=1, validator=IntBoundedValidator(lower=0, upper=10), doc= 'Number of iterations to perform (D2B only): 0 means auto; that is, the ' 'iterations will terminate after reaching some Chi2/NdoF.') maskCriterionValidator = CompositeValidator() arrayLengthTwo = FloatArrayLengthValidator() arrayLengthTwo.setLengthMax(2) orderedPairs = FloatArrayOrderedPairsValidator() maskCriterionValidator.add(arrayLengthTwo) maskCriterionValidator.add(orderedPairs) self.declareProperty( FloatArrayProperty(name='MaskCriterion', values=[], validator=maskCriterionValidator), doc='Efficiency constants outside this range will be set to zero.') self.declareProperty( name='UseCalibratedData', defaultValue=False, doc= 'Whether or not to use the calibrated data in the NeXus files (D2B only).' )
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.')
def PyInit(self): """Initialize the algorithm's input and output properties.""" PROPGROUP_BEAM_STOP_DIAGNOSTICS = 'Beam Stop Diagnostics' PROPGROUP_BKG_DIAGNOSTICS = 'Background Diagnostics' PROPGROUP_PEAK_DIAGNOSTICS = 'Elastic Peak Diagnostics' PROPGROUP_USER_MASK = 'Additional Masking' greaterThanUnityFloat = FloatBoundedValidator(lower=1) inputWorkspaceValidator = CompositeValidator() inputWorkspaceValidator.add(InstrumentValidator()) inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF')) positiveFloat = FloatBoundedValidator(lower=0) positiveIntArray = IntArrayBoundedValidator() positiveIntArray.setLower(0) scalingFactor = FloatBoundedValidator(lower=0, upper=1) # Properties. self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_INPUT_WS, defaultValue='', validator=inputWorkspaceValidator, direction=Direction.Input), doc="A 'raw' workspace from DirectILLCollectData to calculate the diagnostics from.") self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS, defaultValue='', direction=Direction.Output), doc='A diagnostics mask 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.Optional), doc='Table workspace containing results from the FindEPP algorithm.') self.declareProperty(name=common.PROP_ELASTIC_PEAK_DIAGNOSTICS, defaultValue=common.ELASTIC_PEAK_DIAGNOSTICS_AUTO, validator=StringListValidator([ common.ELASTIC_PEAK_DIAGNOSTICS_AUTO, common.ELASTIC_PEAK_DIAGNOSTICS_ON, common.ELASTIC_PEAK_DIAGNOSTICS_OFF]), direction=Direction.Input, doc='Enable or disable elastic peak diagnostics.') self.setPropertyGroup(common.PROP_ELASTIC_PEAK_DIAGNOSTICS, PROPGROUP_PEAK_DIAGNOSTICS) self.declareProperty(name=common.PROP_ELASTIC_PEAK_SIGMA_MULTIPLIER, defaultValue=3.0, validator=positiveFloat, direction=Direction.Input, doc="Integration width of the elastic peak in multiples " + " of 'Sigma' in the EPP table.") self.setPropertyGroup(common.PROP_ELASTIC_PEAK_SIGMA_MULTIPLIER, PROPGROUP_PEAK_DIAGNOSTICS) self.declareProperty(name=common.PROP_PEAK_DIAGNOSTICS_LOW_THRESHOLD, defaultValue=0.1, validator=scalingFactor, direction=Direction.Input, doc='Multiplier for lower acceptance limit ' + 'used in elastic peak diagnostics.') self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_LOW_THRESHOLD, PROPGROUP_PEAK_DIAGNOSTICS) self.declareProperty(name=common.PROP_PEAK_DIAGNOSTICS_HIGH_THRESHOLD, defaultValue=3.0, validator=greaterThanUnityFloat, direction=Direction.Input, doc='Multiplier for higher acceptance limit ' + 'used in elastic peak diagnostics.') self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_HIGH_THRESHOLD, PROPGROUP_PEAK_DIAGNOSTICS) self.declareProperty(name=common.PROP_PEAK_DIAGNOSTICS_SIGNIFICANCE_TEST, defaultValue=3.3, validator=positiveFloat, direction=Direction.Input, doc='To fail the elastic peak diagnostics, the intensity must also exceed ' + 'this number of error bars with respect to the median intensity.') self.setPropertyGroup(common.PROP_PEAK_DIAGNOSTICS_SIGNIFICANCE_TEST, PROPGROUP_PEAK_DIAGNOSTICS) self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS, defaultValue=common.BKG_DIAGNOSTICS_AUTO, validator=StringListValidator([ common.BKG_DIAGNOSTICS_AUTO, common.BKG_DIAGNOSTICS_ON, common.BKG_DIAGNOSTICS_OFF]), direction=Direction.Input, doc='Control the background diagnostics.') self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS, PROPGROUP_BKG_DIAGNOSTICS) self.declareProperty(name=common.PROP_BKG_SIGMA_MULTIPLIER, defaultValue=10.0, validator=positiveFloat, direction=Direction.Input, doc="Width of the range excluded from background integration around " + "the elastic peaks in multiplies of 'Sigma' in the EPP table") self.setPropertyGroup(common.PROP_BKG_SIGMA_MULTIPLIER, PROPGROUP_BKG_DIAGNOSTICS) self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS_LOW_THRESHOLD, defaultValue=0.1, validator=scalingFactor, direction=Direction.Input, doc='Multiplier for lower acceptance limit ' + 'used in noisy background diagnostics.') self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_LOW_THRESHOLD, PROPGROUP_BKG_DIAGNOSTICS) self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS_HIGH_THRESHOLD, defaultValue=3.3, validator=greaterThanUnityFloat, direction=Direction.Input, doc='Multiplier for higher acceptance limit ' + 'used in noisy background diagnostics.') self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_HIGH_THRESHOLD, PROPGROUP_BKG_DIAGNOSTICS) self.declareProperty(name=common.PROP_BKG_DIAGNOSTICS_SIGNIFICANCE_TEST, defaultValue=3.3, validator=positiveFloat, direction=Direction.Input, doc='To fail the background diagnostics, the background level must also exceed ' + 'this number of error bars with respect to the median level.') self.setPropertyGroup(common.PROP_BKG_DIAGNOSTICS_SIGNIFICANCE_TEST, PROPGROUP_BKG_DIAGNOSTICS) self.declareProperty(name=common.PROP_BEAM_STOP_DIAGNOSTICS, defaultValue=common.BEAM_STOP_DIAGNOSTICS_AUTO, validator=StringListValidator([ common.BEAM_STOP_DIAGNOSTICS_AUTO, common.BEAM_STOP_DIAGNOSTICS_ON, common.BEAM_STOP_DIAGNOSTICS_OFF]), direction=Direction.Input, doc='Control the beam stop diagnostics.') self.setPropertyGroup(common.PROP_BEAM_STOP_DIAGNOSTICS, PROPGROUP_BEAM_STOP_DIAGNOSTICS) self.declareProperty(name=common.PROP_BEAM_STOP_THRESHOLD, defaultValue=0.67, validator=scalingFactor, direction=Direction.Input, doc='Multiplier for the lower acceptance limit for beam stop diagnostics.') self.setPropertyGroup(common.PROP_BEAM_STOP_THRESHOLD, PROPGROUP_BEAM_STOP_DIAGNOSTICS) self.declareProperty(name=common.PROP_DEFAULT_MASK, defaultValue=common.DEFAULT_MASK_ON, validator=StringListValidator([ common.DEFAULT_MASK_ON, common.DEFAULT_MASK_OFF]), direction=Direction.Input, doc='Enable or disable instrument specific default mask.') self.declareProperty(IntArrayProperty(name=common.PROP_USER_MASK, values='', validator=positiveIntArray, direction=Direction.Input), doc='List of spectra to mask.') self.setPropertyGroup(common.PROP_USER_MASK, PROPGROUP_USER_MASK) self.declareProperty( StringArrayProperty(name=common.PROP_USER_MASK_COMPONENTS, values='', direction=Direction.Input), doc='List of instrument components to mask.') self.setPropertyGroup(common.PROP_USER_MASK_COMPONENTS, PROPGROUP_USER_MASK) # Rest of the output properties self.declareProperty(ITableWorkspaceProperty( name=common.PROP_OUTPUT_DIAGNOSTICS_REPORT_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output table workspace for detector diagnostics reporting.') self.setPropertyGroup(common.PROP_OUTPUT_DIAGNOSTICS_REPORT_WS, common.PROPGROUP_OPTIONAL_OUTPUT) self.declareProperty(name=common.PROP_OUTPUT_DIAGNOSTICS_REPORT, defaultValue='', direction=Direction.Output, doc='Diagnostics report as a string.') self.setPropertyGroup(common.PROP_OUTPUT_DIAGNOSTICS_REPORT, common.PROPGROUP_OPTIONAL_OUTPUT)
def PyInit(self): """Initialize the input and output properties of the algorithm.""" nonnegativeInt = IntBoundedValidator(lower=0) wsIndexRange = IntBoundedValidator(lower=0, upper=255) nonnegativeIntArray = IntArrayBoundedValidator(lower=0) maxTwoNonnegativeInts = CompositeValidator() maxTwoNonnegativeInts.add(IntArrayLengthValidator(lenmin=0, lenmax=2)) maxTwoNonnegativeInts.add(nonnegativeIntArray) self.declareProperty(MultipleFileProperty(Prop.RUN, extensions=['nxs']), doc='A list of input run numbers/files.') self.declareProperty(MatrixWorkspaceProperty(Prop.OUTPUT_WS, defaultValue='', direction=Direction.Output), doc='The preprocessed output workspace (unit wavelength), single histogram.') self.declareProperty('Measurement', 'DirectBeam', StringListValidator(['DirectBeam', 'ReflectedBeam']), 'Whether to process as direct or reflected beam.') self.declareProperty('AngleOption', 'SampleAngle', StringListValidator(['SampleAngle', 'DetectorAngle', 'UserAngle'])) self.setPropertySettings('AngleOption', EnabledWhenProperty('Measurement', PropertyCriterion.IsEqualTo, 'ReflectedBeam')) self.declareProperty(Prop.THETA, defaultValue=-1., doc='The bragg angle for reflected beam [Degree], used if angle option is UserAngle.') self.setPropertySettings(Prop.THETA, EnabledWhenProperty('AngleOption', PropertyCriterion.IsEqualTo, 'UserAngle')) self.declareProperty('DirectBeamDetectorAngle', -1., 'The detector angle value [Degree] for the corresponding direct beam, ' 'used if angle option is DetectorAngle') self.declareProperty('DirectBeamForegroundCentre', -1., 'Fractional pixel index for the direct beam, used if angle option is DetectorAngle.') self.setPropertySettings('DirectBeamDetectorAngle', EnabledWhenProperty('AngleOption', PropertyCriterion.IsEqualTo, 'DetectorAngle')) self.setPropertySettings('DirectBeamForegroundCentre', EnabledWhenProperty('AngleOption', PropertyCriterion.IsEqualTo, 'DetectorAngle')) 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(MatrixWorkspaceProperty(Prop.WATER_REFERENCE, defaultValue='', direction=Direction.Input, validator=WorkspaceUnitValidator("TOF"), optional=PropertyMode.Optional), doc='A (water) calibration workspace (unit TOF).') self.declareProperty(Prop.SLIT_NORM, defaultValue=SlitNorm.AUTO, validator=StringListValidator([SlitNorm.AUTO, SlitNorm.OFF, SlitNorm.ON]), doc='Enable or disable slit normalisation.') self.declareProperty(Prop.FLUX_NORM_METHOD, defaultValue=FluxNormMethod.TIME, validator=StringListValidator([FluxNormMethod.TIME, FluxNormMethod.MONITOR, FluxNormMethod.OFF]), doc='Neutron flux normalisation method.') self.declareProperty(IntArrayProperty(Prop.FOREGROUND_HALF_WIDTH, validator=maxTwoNonnegativeInts), doc='Number of foreground pixels at lower and higher angles from the centre pixel.') self.declareProperty(Prop.BKG_METHOD, defaultValue=BkgMethod.AVERAGE, validator=StringListValidator([BkgMethod.AVERAGE, BkgMethod.CONSTANT, BkgMethod.LINEAR, BkgMethod.OFF]), doc='Flat background calculation method for background subtraction.') self.declareProperty(Prop.LOW_BKG_OFFSET, defaultValue=7, validator=nonnegativeInt, doc='Distance of flat background region towards smaller detector angles from the ' + 'foreground centre, in pixels.') self.declareProperty(Prop.LOW_BKG_WIDTH, defaultValue=5, validator=nonnegativeInt, doc='Width of flat background region towards smaller detector angles from the ' + 'foreground centre, in pixels.') self.declareProperty(Prop.HIGH_BKG_OFFSET, defaultValue=7, validator=nonnegativeInt, doc='Distance of flat background region towards larger detector angles from the ' + 'foreground centre, in pixels.') self.declareProperty(Prop.HIGH_BKG_WIDTH, defaultValue=5, validator=nonnegativeInt, doc='Width of flat background region towards larger detector angles from the ' + 'foreground centre, in pixels.') self.declareProperty(Prop.START_WS_INDEX, validator=wsIndexRange, defaultValue=0, doc='Start workspace index used for peak fitting.') self.declareProperty(Prop.END_WS_INDEX, validator=wsIndexRange, defaultValue=255, doc='Last workspace index used for peak fitting.') self.declareProperty(Prop.XMIN, defaultValue=-1., doc='Minimum wavelength [Angstrom] used for peak fitting.') self.declareProperty(Prop.XMAX, defaultValue=-1., doc='Maximum wavelength [Angstrom] used for peak fitting.')
def PyInit(self): """Initialize the input and output properties of the algorithm.""" nonnegativeInt = IntBoundedValidator(lower=0) nonnegativeIntArray = IntArrayBoundedValidator() nonnegativeIntArray.setLower(0) nonnegativeFloatArray = FloatArrayBoundedValidator() nonnegativeFloatArray.setLower(0.) twoNonnegativeFloats = CompositeValidator() twoNonnegativeFloats.add(FloatArrayLengthValidator(length=2)) twoNonnegativeFloats.add(nonnegativeFloatArray) maxTwoNonnegativeInts = CompositeValidator() maxTwoNonnegativeInts.add(IntArrayLengthValidator(lenmin=0, lenmax=2)) maxTwoNonnegativeInts.add(nonnegativeIntArray) self.declareProperty(MultipleFileProperty(Prop.RUN, action=FileAction.OptionalLoad, extensions=['nxs']), doc='A list of input run numbers/files.') self.declareProperty(MatrixWorkspaceProperty(Prop.INPUT_WS, defaultValue='', direction=Direction.Input, validator=WorkspaceUnitValidator('TOF'), optional=PropertyMode.Optional), doc='An input workspace (units TOF) if no Run is specified.') self.declareProperty(ITableWorkspaceProperty(Prop.BEAM_POS_WS, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='A beam position table corresponding to InputWorkspace.') self.declareProperty(Prop.BEAM_ANGLE, defaultValue=Property.EMPTY_DBL, doc='A user-defined beam angle (unit degrees).') self.declareProperty(name=Prop.BEAM_CENTRE, defaultValue=Property.EMPTY_DBL, doc='A workspace index corresponding to the beam centre.') self.declareProperty(MatrixWorkspaceProperty(Prop.OUTPUT_WS, defaultValue='', direction=Direction.Output), doc='The preprocessed output workspace (unit wavelength), single histogram.') 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(ITableWorkspaceProperty(Prop.DIRECT_BEAM_POS_WS, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='A beam position table from a direct beam measurement.') self.declareProperty(MatrixWorkspaceProperty(Prop.WATER_REFERENCE, defaultValue='', direction=Direction.Input, validator=WorkspaceUnitValidator("TOF"), optional=PropertyMode.Optional), doc='A (water) calibration workspace (unit TOF).') self.declareProperty(Prop.SLIT_NORM, defaultValue=SlitNorm.OFF, validator=StringListValidator([SlitNorm.OFF, SlitNorm.ON]), doc='Enable or disable slit normalisation.') self.declareProperty(Prop.FLUX_NORM_METHOD, defaultValue=FluxNormMethod.TIME, validator=StringListValidator([FluxNormMethod.TIME, FluxNormMethod.MONITOR, FluxNormMethod.OFF]), doc='Neutron flux normalisation method.') self.declareProperty(IntArrayProperty(Prop.FOREGROUND_HALF_WIDTH, validator=maxTwoNonnegativeInts), doc='Number of foreground pixels at lower and higher angles from the centre pixel.') self.declareProperty(Prop.BKG_METHOD, defaultValue=BkgMethod.CONSTANT, validator=StringListValidator([BkgMethod.CONSTANT, BkgMethod.LINEAR, BkgMethod.OFF]), doc='Flat background calculation method for background subtraction.') self.declareProperty(Prop.LOW_BKG_OFFSET, defaultValue=7, validator=nonnegativeInt, doc='Distance of flat background region towards smaller detector angles from the foreground centre, ' + 'in pixels.') self.declareProperty(Prop.LOW_BKG_WIDTH, defaultValue=5, validator=nonnegativeInt, doc='Width of flat background region towards smaller detector angles from the foreground centre, in pixels.') self.declareProperty(Prop.HIGH_BKG_OFFSET, defaultValue=7, validator=nonnegativeInt, doc='Distance of flat background region towards larger detector angles from the foreground centre, in pixels.') self.declareProperty(Prop.HIGH_BKG_WIDTH, defaultValue=5, validator=nonnegativeInt, doc='Width of flat background region towards larger detector angles from the foreground centre, in pixels.') self.declareProperty(ITableWorkspaceProperty(Prop.OUTPUT_BEAM_POS_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output the beam position table.')
def PyInit(self): """Initialize the algorithm's input and output properties.""" PROPGROUP_FLAT_BKG = 'Flat Time-Independent Background' PROPGROUP_INCIDENT_ENERGY_CALIBRATION = 'Indicent Energy Calibration' PROPGROUP_MON_NORMALISATION = 'Neutron Flux Normalisation' # Validators. mandatoryPositiveInt = CompositeValidator() mandatoryPositiveInt.add(IntMandatoryValidator()) mandatoryPositiveInt.add(IntBoundedValidator(lower=0)) positiveFloat = FloatBoundedValidator(lower=0) positiveInt = IntBoundedValidator(lower=0) positiveIntArray = IntArrayBoundedValidator() positiveIntArray.setLower(0) inputWorkspaceValidator = CompositeValidator() inputWorkspaceValidator.add(InstrumentValidator()) inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF')) # Properties. self.declareProperty(MultipleFileProperty(name=common.PROP_INPUT_FILE, action=FileAction.OptionalLoad, extensions=['nxs']), doc='An input run number (or a list thereof) or a filename.') self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_INPUT_WS, defaultValue='', validator=inputWorkspaceValidator, optional=PropertyMode.Optional, direction=Direction.Input), doc='Input workspace if no run is given.') self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS, defaultValue='', direction=Direction.Output), doc='A flux normalized and background subtracted 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(name=common.PROP_EPP_METHOD, defaultValue=common.EPP_METHOD_AUTO, validator=StringListValidator([ common.EPP_METHOD_AUTO, common.EPP_METHOD_FIT, common.EPP_METHOD_CALCULATE]), direction=Direction.Input, doc='Method to create the EPP table for detectors (monitor is awlays fitted).') self.declareProperty(name=common.PROP_EPP_SIGMA, defaultValue=Property.EMPTY_DBL, validator=positiveFloat, direction=Direction.Input, doc='Nominal sigma for the EPP table when ' + common.PROP_EPP_METHOD + ' is set to ' + common.EPP_METHOD_CALCULATE + ' (default: 10 times the first bin width).') self.declareProperty(name=common.PROP_ELASTIC_CHANNEL_MODE, defaultValue=common.ELASTIC_CHANNEL_AUTO, validator=StringListValidator([ common.ELASTIC_CHANNEL_AUTO, common.ELASTIC_CHANNEL_SAMPLE_LOG, common.ELASTIC_CHANNEL_FIT]), direction=Direction.Input, doc='How to acquire the nominal elastic channel.') self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_ELASTIC_CHANNEL_WS, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='A single value workspace containing the nominal elastic channel index. Overrides ' + common.PROP_ELASTIC_CHANNEL_MODE + '.') self.declareProperty(name=common.PROP_MON_INDEX, defaultValue=Property.EMPTY_INT, validator=positiveInt, direction=Direction.Input, doc='Index of the incident monitor, if not specified in instrument parameters.') self.declareProperty(name=common.PROP_INCIDENT_ENERGY_CALIBRATION, defaultValue=common.INCIDENT_ENERGY_CALIBRATION_AUTO, validator=StringListValidator([ common.INCIDENT_ENERGY_CALIBRATION_AUTO, common.INCIDENT_ENERGY_CALIBRATION_ON, common.INCIDENT_ENERGY_CALIBRATION_OFF]), direction=Direction.Input, doc='Control the incident energy calibration.') self.setPropertyGroup(common.PROP_INCIDENT_ENERGY_CALIBRATION, PROPGROUP_INCIDENT_ENERGY_CALIBRATION) self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_INCIDENT_ENERGY_WS, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='A single-valued workspace holding a previously determined ' + 'incident energy.') self.setPropertyGroup(common.PROP_INCIDENT_ENERGY_WS, PROPGROUP_INCIDENT_ENERGY_CALIBRATION) self.declareProperty(name=common.PROP_FLAT_BKG, defaultValue=common.BKG_AUTO, validator=StringListValidator([ common.BKG_AUTO, common.BKG_ON, common.BKG_OFF]), direction=Direction.Input, doc='Control flat background subtraction.') self.setPropertyGroup(common.PROP_FLAT_BKG, PROPGROUP_FLAT_BKG) self.declareProperty(name=common.PROP_FLAT_BKG_SCALING, defaultValue=1.0, validator=positiveFloat, direction=Direction.Input, doc='Flat background multiplication factor.') self.setPropertyGroup(common.PROP_FLAT_BKG_SCALING, PROPGROUP_FLAT_BKG) self.declareProperty(name=common.PROP_FLAT_BKG_WINDOW, defaultValue=30, validator=mandatoryPositiveInt, direction=Direction.Input, doc='Running average window width (in bins) for flat background.') self.setPropertyGroup(common.PROP_FLAT_BKG_WINDOW, PROPGROUP_FLAT_BKG) self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_FLAT_BKG_WS, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='Workspace with previously determined flat background data.') self.setPropertyGroup(common.PROP_FLAT_BKG_WS, PROPGROUP_FLAT_BKG) self.declareProperty(name=common.PROP_NORMALISATION, defaultValue=common.NORM_METHOD_MON, validator=StringListValidator([ common.NORM_METHOD_MON, common.NORM_METHOD_TIME, common.NORM_METHOD_OFF]), direction=Direction.Input, doc='Normalisation method.') self.setPropertyGroup(common.PROP_NORMALISATION, PROPGROUP_MON_NORMALISATION) self.declareProperty(name=common.PROP_MON_PEAK_SIGMA_MULTIPLIER, defaultValue=3.0, validator=positiveFloat, direction=Direction.Input, doc="Width of the monitor peak in multiples " + " of 'Sigma' in monitor's EPP table.") self.setPropertyGroup(common.PROP_MON_PEAK_SIGMA_MULTIPLIER, PROPGROUP_MON_NORMALISATION) # Rest of the output properties. self.declareProperty(WorkspaceProperty( name=common.PROP_OUTPUT_RAW_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Non-normalized and non-background subtracted output workspace for DirectILLDiagnostics.') self.setPropertyGroup(common.PROP_OUTPUT_RAW_WS, common.PROPGROUP_OPTIONAL_OUTPUT) self.declareProperty(WorkspaceProperty( name=common.PROP_OUTPUT_ELASTIC_CHANNEL_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output workspace for elastic channel index.') self.setPropertyGroup(common.PROP_OUTPUT_ELASTIC_CHANNEL_WS, common.PROPGROUP_OPTIONAL_OUTPUT) self.declareProperty(ITableWorkspaceProperty( name=common.PROP_OUTPUT_DET_EPP_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output workspace for elastic peak positions.') self.setPropertyGroup(common.PROP_OUTPUT_DET_EPP_WS, common.PROPGROUP_OPTIONAL_OUTPUT) self.declareProperty(WorkspaceProperty( name=common.PROP_OUTPUT_INCIDENT_ENERGY_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output workspace for calibrated incident energy.') self.setPropertyGroup(common.PROP_OUTPUT_INCIDENT_ENERGY_WS, common.PROPGROUP_OPTIONAL_OUTPUT) self.declareProperty(WorkspaceProperty( name=common.PROP_OUTPUT_FLAT_BKG_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output workspace for flat background.') self.setPropertyGroup(common.PROP_OUTPUT_FLAT_BKG_WS, common.PROPGROUP_OPTIONAL_OUTPUT)
def PyInit(self): """Initialize the input and output properties of the algorithm.""" nonnegativeInt = IntBoundedValidator(lower=0) nonnegativeIntArray = IntArrayBoundedValidator() nonnegativeIntArray.setLower(0) nonnegativeFloatArray = FloatArrayBoundedValidator() nonnegativeFloatArray.setLower(0.) twoNonnegativeFloats = CompositeValidator() twoNonnegativeFloats.add(FloatArrayLengthValidator(length=2)) twoNonnegativeFloats.add(nonnegativeFloatArray) maxTwoNonnegativeInts = CompositeValidator() maxTwoNonnegativeInts.add(IntArrayLengthValidator(lenmin=0, lenmax=2)) maxTwoNonnegativeInts.add(nonnegativeIntArray) self.declareProperty(MultipleFileProperty( Prop.RUN, action=FileAction.OptionalLoad, extensions=['nxs']), doc='A list of input run numbers/files.') self.declareProperty( MatrixWorkspaceProperty(Prop.INPUT_WS, defaultValue='', direction=Direction.Input, validator=WorkspaceUnitValidator('TOF'), optional=PropertyMode.Optional), doc='An input workspace (units TOF) if no Run is specified.') self.declareProperty( ITableWorkspaceProperty(Prop.BEAM_POS_WS, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='A beam position table corresponding to InputWorkspace.') self.declareProperty(Prop.BEAM_ANGLE, defaultValue=Property.EMPTY_DBL, doc='A user-defined beam angle (unit degrees).') self.declareProperty( name=Prop.BEAM_CENTRE, defaultValue=Property.EMPTY_DBL, doc='A workspace index corresponding to the beam centre.') self.declareProperty( MatrixWorkspaceProperty(Prop.OUTPUT_WS, defaultValue='', direction=Direction.Output), doc= 'The preprocessed output workspace (unit wavelength), single histogram.' ) 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( ITableWorkspaceProperty(Prop.DIRECT_BEAM_POS_WS, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='A beam position table from a direct beam measurement.') self.declareProperty(MatrixWorkspaceProperty( Prop.WATER_REFERENCE, defaultValue='', direction=Direction.Input, validator=WorkspaceUnitValidator("TOF"), optional=PropertyMode.Optional), doc='A (water) calibration workspace (unit TOF).') self.declareProperty(Prop.SLIT_NORM, defaultValue=SlitNorm.OFF, validator=StringListValidator( [SlitNorm.OFF, SlitNorm.ON]), doc='Enable or disable slit normalisation.') self.declareProperty(Prop.FLUX_NORM_METHOD, defaultValue=FluxNormMethod.TIME, validator=StringListValidator([ FluxNormMethod.TIME, FluxNormMethod.MONITOR, FluxNormMethod.OFF ]), doc='Neutron flux normalisation method.') self.declareProperty( IntArrayProperty(Prop.FOREGROUND_HALF_WIDTH, validator=maxTwoNonnegativeInts), doc= 'Number of foreground pixels at lower and higher angles from the centre pixel.' ) self.declareProperty( Prop.BKG_METHOD, defaultValue=BkgMethod.CONSTANT, validator=StringListValidator( [BkgMethod.CONSTANT, BkgMethod.LINEAR, BkgMethod.OFF]), doc='Flat background calculation method for background subtraction.' ) self.declareProperty( Prop.LOW_BKG_OFFSET, defaultValue=7, validator=nonnegativeInt, doc= 'Distance of flat background region towards smaller detector angles from the foreground centre, ' + 'in pixels.') self.declareProperty( Prop.LOW_BKG_WIDTH, defaultValue=5, validator=nonnegativeInt, doc= 'Width of flat background region towards smaller detector angles from the foreground centre, in pixels.' ) self.declareProperty( Prop.HIGH_BKG_OFFSET, defaultValue=7, validator=nonnegativeInt, doc= 'Distance of flat background region towards larger detector angles from the foreground centre, in pixels.' ) self.declareProperty( Prop.HIGH_BKG_WIDTH, defaultValue=5, validator=nonnegativeInt, doc= 'Width of flat background region towards larger detector angles from the foreground centre, in pixels.' ) self.declareProperty(ITableWorkspaceProperty( Prop.OUTPUT_BEAM_POS_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output the beam position table.')
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) nonnegativeFloatArray = FloatArrayBoundedValidator() nonnegativeFloatArray.setLower(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=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=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.')
def PyInit(self): self.declareProperty(MultipleFileProperty('CalibrationRun', action=FileAction.Load, extensions=['nxs']), doc='File path of calibration runs (numors). Must be detector scans.') 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 ' 'is derived from the distribution of ratios.') self.declareProperty(name='DerivationMethod', defaultValue='SequentialSummedReference1D', validator=StringListValidator(['SequentialSummedReference1D', 'GlobalSummedReference2D']), doc='Choose sequential for D20 (1D detector), global for D2B (2D detector).') self.declareProperty(name='InterpolateOverlappingAngles', defaultValue=False, doc='Whether to interpolate scattering angle values in overlapping regions (D20 only).') self.declareProperty(name='NormaliseTo', defaultValue='None', validator=StringListValidator(['None', 'Monitor', 'ROI']), doc='Normalise to monitor or ROI counts before deriving the calibration.') thetaRangeValidator = FloatArrayOrderedPairsValidator() self.declareProperty(FloatArrayProperty(name='ROI', values=[0,100.], validator=thetaRangeValidator), doc='Scattering angle regions of interest for normalisation [degrees].') normaliseToROI = VisibleWhenProperty('NormaliseTo', PropertyCriterion.IsEqualTo, 'ROI') self.setPropertySettings('ROI', normaliseToROI) self.declareProperty(FloatArrayProperty(name='ExcludedRange', values=[], validator=thetaRangeValidator), doc='Scattering angle regions to exclude from the computation of ' 'relative calibration constants; for example, the beam stop [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 (D20 only); ' '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 overlapping pixels.') self.declareProperty(MatrixWorkspaceProperty('OutputWorkspace', '', direction=Direction.Output), doc='Output workspace containing the calibration constants (inverse of efficiency) for each pixel.') self.declareProperty(name='NumberOfIterations', defaultValue=1, validator=IntBoundedValidator(lower=0, upper=10), doc='Number of iterations to perform (D2B only): 0 means auto; that is, the ' 'iterations will terminate after reaching some Chi2/NdoF.') maskCriterionValidator = CompositeValidator() arrayLengthTwo = FloatArrayLengthValidator() arrayLengthTwo.setLengthMax(2) orderedPairs = FloatArrayOrderedPairsValidator() maskCriterionValidator.add(arrayLengthTwo) maskCriterionValidator.add(orderedPairs) self.declareProperty(FloatArrayProperty(name='MaskCriterion', values=[], validator=maskCriterionValidator), doc='Efficiency constants outside this range will be set to zero.') self.declareProperty(name='UseCalibratedData', defaultValue=False, doc='Whether or not to use the calibrated data in the NeXus files (D2B only).')
def PyInit(self): """Initialize the input and output properties of the algorithm.""" nonnegativeInt = IntBoundedValidator(lower=0) wsIndexRange = IntBoundedValidator(lower=0, upper=255) nonnegativeIntArray = IntArrayBoundedValidator(lower=0) maxTwoNonnegativeInts = CompositeValidator() maxTwoNonnegativeInts.add(IntArrayLengthValidator(lenmin=0, lenmax=2)) maxTwoNonnegativeInts.add(nonnegativeIntArray) self.declareProperty(MultipleFileProperty( Prop.RUN, action=FileAction.OptionalLoad, extensions=['nxs']), doc='A list of input run numbers/files.') self.declareProperty( MatrixWorkspaceProperty(Prop.INPUT_WS, defaultValue='', direction=Direction.Input, validator=WorkspaceUnitValidator('TOF'), optional=PropertyMode.Optional), doc='An input workspace (units TOF) if no Run is specified.') self.declareProperty( MatrixWorkspaceProperty(Prop.OUTPUT_WS, defaultValue='', direction=Direction.Output), doc= 'The preprocessed output workspace (unit wavelength), single histogram.' ) self.declareProperty( Prop.TWO_THETA, defaultValue=Property.EMPTY_DBL, doc='A user-defined scattering angle 2 theta (unit degrees).') self.declareProperty( name=Prop.LINE_POSITION, defaultValue=Property.EMPTY_DBL, doc= 'A workspace index corresponding to the beam centre between 0.0 and 255.0.' ) self.declareProperty(MatrixWorkspaceProperty( Prop.DIRECT_LINE_WORKSPACE, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='A pre-processed direct beam 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(MatrixWorkspaceProperty( Prop.WATER_REFERENCE, defaultValue='', direction=Direction.Input, validator=WorkspaceUnitValidator("TOF"), optional=PropertyMode.Optional), doc='A (water) calibration workspace (unit TOF).') self.declareProperty(Prop.SLIT_NORM, defaultValue=SlitNorm.OFF, validator=StringListValidator( [SlitNorm.OFF, SlitNorm.ON]), doc='Enable or disable slit normalisation.') self.declareProperty(Prop.FLUX_NORM_METHOD, defaultValue=FluxNormMethod.TIME, validator=StringListValidator([ FluxNormMethod.TIME, FluxNormMethod.MONITOR, FluxNormMethod.OFF ]), doc='Neutron flux normalisation method.') self.declareProperty( IntArrayProperty(Prop.FOREGROUND_HALF_WIDTH, validator=maxTwoNonnegativeInts), doc= 'Number of foreground pixels at lower and higher angles from the centre pixel.' ) self.declareProperty( Prop.BKG_METHOD, defaultValue=BkgMethod.CONSTANT, validator=StringListValidator( [BkgMethod.CONSTANT, BkgMethod.LINEAR, BkgMethod.OFF]), doc='Flat background calculation method for background subtraction.' ) self.declareProperty( Prop.LOW_BKG_OFFSET, defaultValue=7, validator=nonnegativeInt, doc= 'Distance of flat background region towards smaller detector angles from the ' + 'foreground centre, in pixels.') self.declareProperty( Prop.LOW_BKG_WIDTH, defaultValue=5, validator=nonnegativeInt, doc= 'Width of flat background region towards smaller detector angles from the ' + 'foreground centre, in pixels.') self.declareProperty( Prop.HIGH_BKG_OFFSET, defaultValue=7, validator=nonnegativeInt, doc= 'Distance of flat background region towards larger detector angles from the ' + 'foreground centre, in pixels.') self.declareProperty( Prop.HIGH_BKG_WIDTH, defaultValue=5, validator=nonnegativeInt, doc= 'Width of flat background region towards larger detector angles from the ' + 'foreground centre, in pixels.') self.declareProperty( Prop.START_WS_INDEX, validator=wsIndexRange, defaultValue=0, doc='Start workspace index used for peak fitting.') self.declareProperty(Prop.END_WS_INDEX, validator=wsIndexRange, defaultValue=255, doc='Last workspace index used for peak fitting.') self.declareProperty( Prop.XMIN, defaultValue=Property.EMPTY_DBL, doc='Minimum x value (unit Angstrom) used for peak fitting.') self.declareProperty( Prop.XMAX, defaultValue=Property.EMPTY_DBL, doc='Maximum x value (unit Angstrom) used for peak fitting.')
def PyInit(self): """Initialize the input and output properties of the algorithm.""" nonnegativeInts = IntArrayBoundedValidator() nonnegativeInts.setLower(0) maxTwoNonnegativeInts = CompositeValidator() maxTwoNonnegativeInts.add(IntArrayLengthValidator(lenmin=0, lenmax=2)) maxTwoNonnegativeInts.add(nonnegativeInts) nonnegativeFloatArray = FloatArrayBoundedValidator() nonnegativeFloatArray.setLower(0.) stringArrayValidator = StringArrayLengthValidator() stringArrayValidator.setLengthMin(1) #======================== Main Properties ======================== self.declareProperty( PropertyNames.POLARIZATION_OPTION, 'NonPolarized', StringListValidator(['NonPolarized', 'Polarized']), 'Indicate whether measurements are polarized') is_polarized = EnabledWhenProperty(PropertyNames.POLARIZATION_OPTION, PropertyCriterion.IsEqualTo, 'Polarized') is_not_polarized = EnabledWhenProperty( PropertyNames.POLARIZATION_OPTION, PropertyCriterion.IsEqualTo, 'NonPolarized') polarized = 'Inputs for polarized measurements' self.declareProperty(MultipleFileProperty( PropertyNames.RB, action=FileAction.OptionalLoad, extensions=['nxs']), doc='A list of reflected run numbers/files.') self.setPropertySettings(PropertyNames.RB, is_not_polarized) self.declareProperty( MultipleFileProperty(PropertyNames.RB00, action=FileAction.OptionalLoad, extensions=['nxs']), doc='A list of reflected run numbers/files for 00.') self.setPropertySettings(PropertyNames.RB00, is_polarized) self.setPropertyGroup(PropertyNames.RB00, polarized) self.declareProperty( MultipleFileProperty(PropertyNames.RB01, action=FileAction.OptionalLoad, extensions=['nxs']), doc='A list of reflected run numbers/files for 01.') self.setPropertySettings(PropertyNames.RB01, is_polarized) self.setPropertyGroup(PropertyNames.RB01, polarized) self.declareProperty( MultipleFileProperty(PropertyNames.RB10, action=FileAction.OptionalLoad, extensions=['nxs']), doc='A list of reflected run numbers/files for 10.') self.setPropertySettings(PropertyNames.RB10, is_polarized) self.setPropertyGroup(PropertyNames.RB10, polarized) self.declareProperty( MultipleFileProperty(PropertyNames.RB11, action=FileAction.OptionalLoad, extensions=['nxs']), doc='A list of reflected run numbers/files for 11.') self.setPropertySettings(PropertyNames.RB11, is_polarized) self.setPropertyGroup(PropertyNames.RB11, polarized) self.declareProperty( FileProperty(PropertyNames.EFFICIENCY_FILE, defaultValue='', action=FileAction.OptionalLoad), doc='A file containing the polarization efficiency factors.') self.setPropertySettings(PropertyNames.EFFICIENCY_FILE, is_polarized) self.setPropertyGroup(PropertyNames.EFFICIENCY_FILE, polarized) self.declareProperty(MultipleFileProperty(PropertyNames.DB, action=FileAction.Load, extensions=['nxs']), doc='A list of direct run numbers/files.') self.declareProperty(WorkspaceGroupProperty( Prop.OUTPUT_WS, defaultValue='', direction=Direction.Output), doc='The output workspace group.') self.declareProperty( PropertyNames.BKG_METHOD_DIRECT, defaultValue=BkgMethod.CONSTANT, validator=StringListValidator( [BkgMethod.CONSTANT, BkgMethod.LINEAR, BkgMethod.OFF]), doc='Flat background calculation method for background subtraction.' ) self.declareProperty( PropertyNames.BKG_METHOD, defaultValue=BkgMethod.CONSTANT, validator=StringListValidator( [BkgMethod.CONSTANT, BkgMethod.LINEAR, BkgMethod.OFF]), doc='Flat background calculation method for background subtraction.' ) self.copyProperties('ReflectometryILLPreprocess', [ Prop.SUBALG_LOGGING, Prop.CLEANUP, Prop.WATER_REFERENCE, Prop.SLIT_NORM, Prop.FLUX_NORM_METHOD ]) self.declareProperty(PropertyNames.SCALE_FACTOR, defaultValue=1.0, doc='Scale factor.') self.declareProperty( PropertyNames.USE_MANUAL_SCALE_FACTORS, defaultValue=False, doc='Choose to apply manual scale factors for stitching.') self.declareProperty( FloatArrayProperty(PropertyNames.MANUAL_SCALE_FACTORS, values=[]), doc= 'A list of manual scale factors for stitching (number of anlge configurations minus 1)' ) self.setPropertySettings( PropertyNames.MANUAL_SCALE_FACTORS, EnabledWhenProperty(PropertyNames.USE_MANUAL_SCALE_FACTORS, PropertyCriterion.IsNotDefault)) self.declareProperty( PropertyNames.CACHE_DIRECT_BEAM, defaultValue=False, doc= 'Cache the processed direct beam in ADS for ready use with further reflected beams;' 'saves important execution time, however assumes that the direct beam processing ' 'configuration must be invariant for different reflected beams.') # ======================== Common Properties ======================== commonProp = 'Preprocessing common properties: provide a list or a single value' self.declareProperty(StringArrayProperty( PropertyNames.ANGLE_OPTION, values=[PropertyNames.DAN], validator=stringArrayValidator, direction=Direction.Input, ), doc='Angle option used for detector positioning') self.declareProperty(FloatArrayProperty(PropertyNames.THETA, values=[-1.]), doc='A user-defined angle theta in degree') self.declareProperty(StringArrayProperty( PropertyNames.SUM_TYPE, values=[PropertyNames.INCOHERENT], validator=stringArrayValidator, direction=Direction.Input, ), doc='Type of summation to perform') self.declareProperty(FloatArrayProperty( PropertyNames.WAVELENGTH_LOWER, values=[0.], validator=nonnegativeFloatArray), doc='The lower wavelength bound (Angstrom)') self.declareProperty(FloatArrayProperty( PropertyNames.WAVELENGTH_UPPER, values=[35.], validator=nonnegativeFloatArray), doc='The upper wavelength bound (Angstrom)') self.declareProperty( FloatArrayProperty( PropertyNames.GROUPING_FRACTION, values=[0.5], validator=nonnegativeFloatArray, ), doc= 'If set, group the output by steps of this fraction multiplied by Q resolution' ) self.setPropertyGroup(PropertyNames.ANGLE_OPTION, commonProp) self.setPropertyGroup(PropertyNames.THETA, commonProp) self.setPropertyGroup(PropertyNames.SUM_TYPE, commonProp) self.setPropertyGroup(PropertyNames.WAVELENGTH_LOWER, commonProp) self.setPropertyGroup(PropertyNames.WAVELENGTH_UPPER, commonProp) self.setPropertyGroup(PropertyNames.GROUPING_FRACTION, commonProp) # ======================== Direct Run Properties ======================== preProcessDirect = 'Preprocessing for direct runs: provide a list or a single value' self.declareProperty( IntArrayProperty(PropertyNames.LOW_FRG_HALF_WIDTH_DIRECT, values=[0], validator=nonnegativeInts), doc= 'Number of foreground pixels at lower angles from the centre pixel.' ) self.setPropertyGroup(PropertyNames.LOW_FRG_HALF_WIDTH_DIRECT, preProcessDirect) self.declareProperty( IntArrayProperty( PropertyNames.LOW_BKG_OFFSET_DIRECT, values=[7], validator=nonnegativeInts, ), doc= 'Distance of flat background region towards smaller detector angles from the ' + 'foreground centre, in pixels') self.setPropertyGroup(PropertyNames.LOW_BKG_OFFSET_DIRECT, preProcessDirect) self.declareProperty( IntArrayProperty( PropertyNames.LOW_BKG_WIDTH_DIRECT, values=[5], validator=nonnegativeInts, ), doc= 'Width of flat background region towards smaller detector angles from the ' + 'foreground centre, in pixels') self.setPropertyGroup(PropertyNames.LOW_BKG_WIDTH_DIRECT, preProcessDirect) self.declareProperty( IntArrayProperty(PropertyNames.HIGH_FRG_HALF_WIDTH_DIRECT, values=[0], validator=nonnegativeInts), doc= 'Number of foreground pixels at higher angles from the centre pixel.' ) self.setPropertyGroup(PropertyNames.HIGH_FRG_HALF_WIDTH_DIRECT, preProcessDirect) self.declareProperty( IntArrayProperty( PropertyNames.HIGH_BKG_OFFSET_DIRECT, values=[7], validator=nonnegativeInts, ), doc= 'Distance of flat background region towards larger detector angles from the ' + 'foreground centre, in pixels') self.setPropertyGroup(PropertyNames.HIGH_BKG_OFFSET_DIRECT, preProcessDirect) self.declareProperty( IntArrayProperty( PropertyNames.HIGH_BKG_WIDTH_DIRECT, values=[5], validator=nonnegativeInts, ), doc= 'Width of flat background region towards larger detector angles from the ' + 'foreground centre, in pixels') self.setPropertyGroup(PropertyNames.HIGH_BKG_WIDTH_DIRECT, preProcessDirect) self.declareProperty(IntArrayProperty( PropertyNames.START_WS_INDEX_DIRECT, values=[0], validator=nonnegativeInts, ), doc='Start histogram index used for peak fitting') self.setPropertyGroup(PropertyNames.START_WS_INDEX_DIRECT, preProcessDirect) self.declareProperty(IntArrayProperty( PropertyNames.END_WS_INDEX_DIRECT, values=[255], validator=nonnegativeInts, ), doc='Last histogram index used for peak fitting') self.setPropertyGroup(PropertyNames.END_WS_INDEX_DIRECT, preProcessDirect) self.declareProperty( PropertyNames.XMIN_DIRECT, defaultValue=-1., doc='Minimum x value (unit wavelength) used for peak fitting.') self.setPropertyGroup(PropertyNames.XMIN_DIRECT, preProcessDirect) self.declareProperty( PropertyNames.XMAX_DIRECT, defaultValue=-1., doc='Maximum x value (unit wavelength) used for peak fitting.') self.setPropertyGroup(PropertyNames.XMAX_DIRECT, preProcessDirect) # ======================== Preprocessing For Reflected Runs ======================== preProcessReflected = 'Preprocessing for reflected runs: provide a list or a single value' self.declareProperty( IntArrayProperty( PropertyNames.LOW_FRG_HALF_WIDTH, values=[0], validator=nonnegativeInts, ), doc= 'Number of foreground pixels at lower angles from the centre pixel.' ) self.setPropertyGroup(PropertyNames.LOW_FRG_HALF_WIDTH, preProcessReflected) self.declareProperty( IntArrayProperty( PropertyNames.LOW_BKG_OFFSET, values=[7], validator=nonnegativeInts, ), doc= 'Distance of flat background region towards smaller detector angles from the ' + 'foreground centre, in pixels.') self.setPropertyGroup(PropertyNames.LOW_BKG_OFFSET, preProcessReflected) self.declareProperty( IntArrayProperty( PropertyNames.LOW_BKG_WIDTH, values=[5], validator=nonnegativeInts, ), doc= 'Width of flat background region towards smaller detector angles from the ' + 'foreground centre, in pixels') self.setPropertyGroup(PropertyNames.LOW_BKG_WIDTH, preProcessReflected) self.declareProperty( IntArrayProperty( PropertyNames.HIGH_FRG_HALF_WIDTH, values=[0], validator=nonnegativeInts, ), doc= 'Number of foreground pixels at higher angles from the centre pixel.' ) self.setPropertyGroup(PropertyNames.HIGH_FRG_HALF_WIDTH, preProcessReflected) self.declareProperty( IntArrayProperty( PropertyNames.HIGH_BKG_OFFSET, values=[7], validator=nonnegativeInts, ), doc= 'Distance of flat background region towards larger detector angles from the ' + 'foreground centre, in pixels') self.setPropertyGroup(PropertyNames.HIGH_BKG_OFFSET, preProcessReflected) self.declareProperty( IntArrayProperty( PropertyNames.HIGH_BKG_WIDTH, values=[5], validator=nonnegativeInts, ), doc= 'Width of flat background region towards larger detector angles from the ' + 'foreground centre, in pixels.') self.setPropertyGroup(PropertyNames.HIGH_BKG_WIDTH, preProcessReflected) self.declareProperty(IntArrayProperty( PropertyNames.START_WS_INDEX, values=[0], validator=nonnegativeInts, ), doc='Start histogram index used for peak fitting') self.setPropertyGroup(PropertyNames.START_WS_INDEX, preProcessReflected) self.declareProperty(IntArrayProperty( PropertyNames.END_WS_INDEX, values=[255], validator=nonnegativeInts, ), doc='Last histogram index used for peak fitting') self.setPropertyGroup(PropertyNames.END_WS_INDEX, preProcessReflected) self.declareProperty( FloatArrayProperty(PropertyNames.XMIN, values=[-1.]), doc='Minimum x value (unit wavelength) used for peak fitting') self.setPropertyGroup(PropertyNames.XMIN, preProcessReflected) self.declareProperty( FloatArrayProperty(PropertyNames.XMAX, values=[-1.]), doc='Maximum x value (unit wavelength) used for peak fitting') self.setPropertyGroup(PropertyNames.XMAX, preProcessReflected)
def PyInit(self): validator = IntArrayBoundedValidator() validator.setLower(0) self.declareProperty( IntArrayProperty("RunNumbers", values=[0], direction=Direction.Input, validator=validator), "Run numbers to process, comma separated") self.declareProperty( "LiveData", False, "Read live data - requires a saved run in the current IPTS " + "with the same Instrument configuration as the live run") mask = [ "None", "Horizontal", "Vertical", "Masking Workspace", "Custom - xml masking file" ] self.declareProperty("Masking", "None", StringListValidator(mask), "Mask to be applied to the data") self.declareProperty( WorkspaceProperty("MaskingWorkspace", "", Direction.Input, PropertyMode.Optional), "The workspace containing the mask.") self.declareProperty(FileProperty(name="MaskingFilename", defaultValue="", direction=Direction.Input, action=FileAction.OptionalLoad), doc="The file containing the xml mask.") self.declareProperty( name="Calibration", defaultValue="Convert Units", validator=StringListValidator( ['Convert Units', 'Calibration File', 'DetCal File']), direction=Direction.Input, doc="The type of conversion to d_spacing to be used.") self.declareProperty( FileProperty(name="CalibrationFilename", defaultValue="", direction=Direction.Input, action=FileAction.OptionalLoad), doc="The calibration file to convert to d_spacing.") self.declareProperty( MultipleFileProperty(name='DetCalFilename', extensions=['.detcal'], action=FileAction.OptionalLoad), 'ISAW DetCal file') self.declareProperty( FloatArrayProperty("Binning", [0.5, -0.004, 7.0]), "Min, Step, and Max of d-space bins. Logarithmic binning is used if Step is negative." ) nor_corr = [ "None", "From Workspace", "From Processed Nexus", "Extracted from Data" ] self.declareProperty( "Normalization", "None", StringListValidator(nor_corr), "If needed what type of input to use as normalization, Extracted from " + "Data uses a background determination that is peak independent.This " + "implemantation can be tested in algorithm SNAP Peak Clipping Background" ) self.declareProperty( FileProperty(name="NormalizationFilename", defaultValue="", direction=Direction.Input, action=FileAction.OptionalLoad), doc="The file containing the processed nexus for normalization.") self.declareProperty( WorkspaceProperty("NormalizationWorkspace", "", Direction.Input, PropertyMode.Optional), "The workspace containing the normalization data.") self.declareProperty( "PeakClippingWindowSize", 10, "Read live data - requires a saved run in the current " + "IPTS with the same Instrumnet configuration") self.declareProperty( "SmoothingRange", 10, "Read live data - requires a saved run in the " + "current IPTS with the same Instrumnet configuration") grouping = ["All", "Column", "Banks", "Modules", "2_4 Grouping"] self.declareProperty( "GroupDetectorsBy", "All", StringListValidator(grouping), "Detector groups to use for future focussing: " + "All detectors as one group, Groups (East,West for " + "SNAP), Columns for SNAP, detector banks") mode = ["Set-Up", "Production"] self.declareProperty( "ProcessingMode", "Production", StringListValidator(mode), "Set-Up Mode is used for establishing correct parameters. Production " + "Mode only Normalized workspace is kept for each run.") self.declareProperty( name="OptionalPrefix", defaultValue="", direction=Direction.Input, doc="Optional Prefix to be added to workspaces and output filenames" ) self.declareProperty( "SaveData", False, "Save data in the following formats: Ascii- " + "d-spacing ,Nexus Processed,GSAS and Fullprof") self.declareProperty(FileProperty(name="OutputDirectory", defaultValue="", action=FileAction.OptionalDirectory), doc='Default value is proposal shared directory')
def PyInit(self): validator = IntArrayBoundedValidator(lower=0) self.declareProperty( IntArrayProperty("RunNumbers", values=[0], direction=Direction.Input, validator=validator), "Run numbers to process, comma separated") self.declareProperty( 'Background', Property.EMPTY_INT, doc='Background to subtract from each individual run') mask = [ "None", "Horizontal", "Vertical", "Masking Workspace", "Custom - xml masking file" ] self.declareProperty("Masking", "None", StringListValidator(mask), "Mask to be applied to the data") self.declareProperty( WorkspaceProperty("MaskingWorkspace", "", Direction.Input, PropertyMode.Optional), "The workspace containing the mask.") self.declareProperty(FileProperty(name="MaskingFilename", defaultValue="", direction=Direction.Input, action=FileAction.OptionalLoad), doc="The file containing the xml mask.") self.declareProperty( name="Calibration", defaultValue="Convert Units", validator=StringListValidator( ['Convert Units', 'Calibration File', 'DetCal File']), direction=Direction.Input, doc="The type of conversion to d_spacing to be used.") self.declareProperty( FileProperty(name="CalibrationFilename", defaultValue="", extensions=['.h5', '.cal'], direction=Direction.Input, action=FileAction.OptionalLoad), doc="The calibration file to convert to d_spacing.") self.declareProperty( MultipleFileProperty(name='DetCalFilename', extensions=['.detcal'], action=FileAction.OptionalLoad), 'ISAW DetCal file') self.declareProperty( FloatArrayProperty("Binning", [0.5, -0.004, 7.0]), "Min, Step, and Max of d-space bins. Logarithmic binning is used if Step is negative." ) nor_corr = [ "None", "From Workspace", "From Processed Nexus", "Extracted from Data" ] self.declareProperty( "Normalization", nor_corr[0], StringListValidator(nor_corr), "If needed what type of input to use as normalization, Extracted from " + "Data uses a background determination that is peak independent.This " + "implemantation can be tested in algorithm SNAP Peak Clipping Background" ) self.declareProperty( FileProperty(name="NormalizationFilename", defaultValue="", direction=Direction.Input, action=FileAction.OptionalLoad), doc="The file containing the processed nexus for normalization.") self.declareProperty( WorkspaceProperty("NormalizationWorkspace", "", Direction.Input, PropertyMode.Optional), "The workspace containing the normalization data.") validator_peak_clipping = IntBoundedValidator(lower=4, upper=15) self.declareProperty( name="PeakClippingWindowSize", defaultValue=10, validator=validator_peak_clipping, doc= "Read live data - requires a saved run in the current IPTS with the same " "instrument configuration") validator_smoothing_range = IntBoundedValidator(lower=1, upper=20) self.declareProperty( name="SmoothingRange", defaultValue=10, validator=validator_smoothing_range, doc= "Read live data - requires a saved run in the current IPTS with the same " "instrument configuration") grouping = ["All", "Column", "Banks", "Modules", "2_4 Grouping"] self.declareProperty( "GroupDetectorsBy", grouping[0], StringListValidator(grouping), "Detector groups to use for future focussing: " + "All detectors as one group, Groups (East,West for " + "SNAP), Columns for SNAP, detector banks") self.declareProperty( "MaxChunkSize", 16., "Specify maximum Gbytes of file to read in one chunk. Zero reads the whole file at once." ) mode = ["Set-Up", "Production"] self.declareProperty( "ProcessingMode", mode[1], StringListValidator(mode), "Set-Up Mode is used for establishing correct parameters. Production " + "Mode only Normalized workspace is kept for each run.") final_units = ['dSpacing', 'MomentumTransfer', 'Wavelength'] self.declareProperty( "FinalUnits", final_units[0], StringListValidator(final_units), "Units to convert the data to at the end of processing") self.declareProperty( name="OptionalPrefix", defaultValue="", direction=Direction.Input, doc="Optional Prefix to be added to workspaces and output filenames" ) self.declareProperty( "SaveData", False, "Save data in the following formats: Ascii- " + "d-spacing ,Nexus Processed,GSAS and Fullprof") self.declareProperty(FileProperty(name="OutputDirectory", defaultValue="", action=FileAction.OptionalDirectory), doc='Default value is proposal shared directory') # # Section for the Autoreduction Configurator # self.declareProperty( name='EnableConfigurator', defaultValue=False, direction=Direction.Input, doc= 'Do not reduce, just save the configuration file for autoreduction' ) config_enabled = EnabledWhenProperty('EnableConfigurator', PropertyCriterion.IsNotDefault) self.declareProperty( FileProperty(name='ConfigSaveDir', defaultValue='', action=FileAction.OptionalDirectory), doc= 'Default directory is /SNS/IPTS-XXXX/shared/config where XXXX is the' 'IPTS number of the first input run number') self.setPropertySettings('ConfigSaveDir', config_enabled) property_names = ['EnableConfigurator', 'ConfigSaveDir'] [ self.setPropertyGroup(name, 'Autoreduction Configurator') for name in property_names ]