def PyInit(self): """Initialize the algorithm's input and output properties.""" PROPGROUP_SIMULATION_INSTRUMENT = 'Simulation Instrument Settings' greaterThanOneInt = IntBoundedValidator(lower=2) greaterThanTwoInt = IntBoundedValidator(lower=3) inputWorkspaceValidator = CompositeValidator() inputWorkspaceValidator.add(InstrumentValidator()) inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF')) # Properties. self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_INPUT_WS, defaultValue='', validator=inputWorkspaceValidator, optional=PropertyMode.Optional, direction=Direction.Input), doc='Input workspace.') self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_OUTPUT_WS, defaultValue='', direction=Direction.Output), doc='The output corrections 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_SIMULATION_INSTRUMENT, defaultValue=common.SIMULATION_INSTRUMEN_SPARSE, validator=StringListValidator([ common.SIMULATION_INSTRUMEN_SPARSE, common.SIMULATION_INSTRUMENT_FULL ]), direction=Direction.Input, doc= 'Select if the simulation should be performed on full or approximated instrument.' ) self.setPropertyGroup(common.PROP_SIMULATION_INSTRUMENT, PROPGROUP_SIMULATION_INSTRUMENT) self.declareProperty( name=common.PROP_SPARSE_INSTRUMENT_ROWS, defaultValue=5, validator=greaterThanTwoInt, direction=Direction.Input, doc='Number of detector rows in sparse simulation instrument.') self.setPropertyGroup(common.PROP_SPARSE_INSTRUMENT_ROWS, PROPGROUP_SIMULATION_INSTRUMENT) self.setPropertySettings( common.PROP_SPARSE_INSTRUMENT_ROWS, EnabledWhenProperty(common.PROP_SIMULATION_INSTRUMENT, PropertyCriterion.IsEqualTo, common.SIMULATION_INSTRUMEN_SPARSE)) self.declareProperty( name=common.PROP_SPARSE_INSTRUMENT_COLUMNS, defaultValue=20, validator=greaterThanOneInt, direction=Direction.Input, doc='Number of detector columns in sparse simulation instrument.') self.setPropertyGroup(common.PROP_SPARSE_INSTRUMENT_COLUMNS, PROPGROUP_SIMULATION_INSTRUMENT) self.setPropertySettings( common.PROP_SPARSE_INSTRUMENT_COLUMNS, EnabledWhenProperty(common.PROP_SIMULATION_INSTRUMENT, PropertyCriterion.IsEqualTo, common.SIMULATION_INSTRUMEN_SPARSE)) self.declareProperty( name=common.PROP_NUMBER_OF_SIMULATION_WAVELENGTHS, defaultValue=Property.EMPTY_INT, validator=greaterThanTwoInt, direction=Direction.Input, doc= 'Number of wavelength points where the simulation is performed (default: all).' )
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(lower=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=utils.Cleanup.ON, validator=StringListValidator( [utils.Cleanup.ON, utils.Cleanup.OFF]), direction=Direction.Input, doc='What to do with intermediate workspaces.') self.declareProperty( name=common.PROP_SUBALG_LOGGING, defaultValue=common.SUBALG_LOGGING_OFF, validator=StringListValidator( [common.SUBALG_LOGGING_OFF, common.SUBALG_LOGGING_ON]), direction=Direction.Input, doc='Enable or disable subalgorithms to ' + 'print in the logs.') self.declareProperty( 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_REBINNING = 'Rebinning for SofQW' inputWorkspaceValidator = CompositeValidator() inputWorkspaceValidator.add(InstrumentValidator()) inputWorkspaceValidator.add(WorkspaceUnitValidator('TOF')) validRebinParams = RebinParamsValidator(AllowEmpty=True) # Properties. self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_INPUT_WS, defaultValue='', validator=inputWorkspaceValidator, direction=Direction.Input), doc='A workspace to reduce.') self.declareProperty(WorkspaceProperty(name=common.PROP_OUTPUT_WS, defaultValue='', direction=Direction.Output), doc='The reduced S(Q, DeltaE) workspace.') self.declareProperty(name=common.PROP_CLEANUP_MODE, defaultValue=common.CLEANUP_ON, validator=StringListValidator( [common.CLEANUP_ON, common.CLEANUP_OFF]), direction=Direction.Input, doc='What to do with intermediate workspaces.') self.declareProperty( name=common.PROP_SUBALG_LOGGING, defaultValue=common.SUBALG_LOGGING_OFF, validator=StringListValidator( [common.SUBALG_LOGGING_OFF, common.SUBALG_LOGGING_ON]), direction=Direction.Input, doc='Enable or disable subalgorithms to ' + 'print in the logs.') self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_VANA_WS, defaultValue='', validator=inputWorkspaceValidator, direction=Direction.Input, optional=PropertyMode.Optional), doc='An integrated vanadium workspace.') self.declareProperty( name=common.PROP_ABSOLUTE_UNITS, defaultValue=common.ABSOLUTE_UNITS_OFF, validator=StringListValidator( [common.ABSOLUTE_UNITS_OFF, common.ABSOLUTE_UNITS_ON]), direction=Direction.Input, doc='Enable or disable normalisation to absolute units.') self.declareProperty(MatrixWorkspaceProperty( name=common.PROP_DIAGNOSTICS_WS, defaultValue='', direction=Direction.Input, optional=PropertyMode.Optional), doc='Detector diagnostics workspace for masking.') self.declareProperty(FloatArrayProperty( name=common.PROP_REBINNING_PARAMS_W, validator=validRebinParams), doc='Manual energy rebinning parameters.') self.setPropertyGroup(common.PROP_REBINNING_PARAMS_W, PROPGROUP_REBINNING) self.declareProperty( name=common.PROP_REBINNING_W, defaultValue='', doc= 'Energy rebinning when mixing manual and automatic binning parameters.' ) self.declareProperty(FloatArrayProperty( name=common.PROP_BINNING_PARAMS_Q, validator=validRebinParams), doc='Manual q rebinning parameters.') self.setPropertyGroup(common.PROP_BINNING_PARAMS_Q, PROPGROUP_REBINNING) self.declareProperty( name=common.PROP_TRANSPOSE_SAMPLE_OUTPUT, defaultValue=common.TRANSPOSING_ON, validator=StringListValidator( [common.TRANSPOSING_ON, common.TRANSPOSING_OFF]), direction=Direction.Input, doc='Enable or disable ' + common.PROP_OUTPUT_WS + ' transposing.') self.declareProperty( WorkspaceProperty(name=common.PROP_OUTPUT_THETA_W_WS, defaultValue='', direction=Direction.Output, optional=PropertyMode.Optional), doc='Output workspace for reduced S(theta, DeltaE).') self.setPropertyGroup(common.PROP_OUTPUT_THETA_W_WS, 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): # # Reference and input data self.declareProperty(ITableWorkspaceProperty( "PeakCentersTofTable", "", optional=PropertyMode.Mandatory, direction=Direction.Input), doc="Table of found peak centers, in TOF units") self.declareProperty( FloatArrayProperty("PeakPositions", values=[], direction=Direction.Input), doc= "Comma separated list of reference peak center d-spacings, sorted by increasing value." ) properties = ["PeakCentersTofTable", "PeakPositions"] [ self.setPropertyGroup(name, 'Reference and Input Data') for name in properties ] # # Output Tables self.declareProperty( "AdjustmentsTable", "", direction=Direction.Input, doc= "Name of output table containing optimized locations and orientations for each component" ) self.declareProperty( "DisplacementsTable", "", direction=Direction.Input, doc= "Name of output table containing changes in position and euler angles for each bank component" ) properties = ["AdjustmentsTable", "DisplacementsTable"] [self.setPropertyGroup(name, 'Output Tables') for name in properties] # # Selection of the instrument and mask self.declareProperty(MatrixWorkspaceProperty( "MaskWorkspace", "", optional=PropertyMode.Optional, direction=Direction.Input), doc="Mask workspace") self.declareProperty(FileProperty(name="InstrumentFilename", defaultValue="", action=FileAction.OptionalLoad, extensions=[".xml"]), doc="Instrument filename") self.declareProperty( WorkspaceProperty("InputWorkspace", "", validator=InstrumentValidator(), optional=PropertyMode.Optional, direction=Direction.Input), doc="Workspace containing the instrument to be calibrated") self.declareProperty( WorkspaceProperty("OutputWorkspace", "", optional=PropertyMode.Mandatory, direction=Direction.Output), doc='Workspace containing the calibrated instrument') properties = [ 'MaskWorkspace', "InstrumentFilename", "InputWorkspace", "OutputWorkspace" ] [ self.setPropertyGroup(name, 'Instrument Options') for name in properties ] # # Components self.declareProperty( name="FitSourcePosition", defaultValue=False, doc= "Fit the source position, changes L1 (source to sample) distance. " "Uses entire instrument. Occurs before Components are Aligned.") self.declareProperty( name="FitSamplePosition", defaultValue=False, doc= "Fit the sample position, changes L1 (source to sample) and L2 (sample to detector) distance." "Uses entire instrument. Occurs before Components are Aligned.") self.declareProperty( StringArrayProperty("ComponentList", direction=Direction.Input), doc="Comma separated list on instrument components to refine.") properties = [ "FitSourcePosition", "FitSamplePosition", "ComponentList" ] [ self.setPropertyGroup(name, 'Declaration of Components') for name in properties ] # # Translation Properties # X position self.declareProperty( name="Xposition", defaultValue=False, doc="Refine Xposition of source and/or sample and/or components") condition = EnabledWhenProperty("Xposition", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinXposition", defaultValue=-0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Minimum relative X bound (m)") self.setPropertySettings("MinXposition", condition) self.declareProperty(name="MaxXposition", defaultValue=0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Maximum relative X bound (m)") self.setPropertySettings("MaxXposition", condition) self.declareProperty( name="Yposition", defaultValue=False, doc="Refine Yposition of source and/or sample and/or components") condition = EnabledWhenProperty("Yposition", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinYposition", defaultValue=-0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Minimum relative Y bound (m)") self.setPropertySettings("MinYposition", condition) self.declareProperty(name="MaxYposition", defaultValue=0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Maximum relative Y bound (m)") self.setPropertySettings("MaxYposition", condition) # Z position self.declareProperty( name="Zposition", defaultValue=False, doc="Refine Zposition of source and/or sample and/or components") condition = EnabledWhenProperty("Zposition", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinZposition", defaultValue=-0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Minimum relative Z bound (m)") self.setPropertySettings("MinZposition", condition) self.declareProperty(name="MaxZposition", defaultValue=0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Maximum relative Z bound (m)") self.setPropertySettings("MaxZposition", condition) properties = [ "Xposition", "MinXposition", "MaxXposition", "Yposition", "MinYposition", "MaxYposition", "Zposition", "MinZposition", "MaxZposition" ] [self.setPropertyGroup(name, "Translation") for name in properties] # # Rotation Properties eulerConventions = [ "ZXZ", "XYX", "YZY", "ZYZ", "XZX", "YXY", "XYZ", "YZX", "ZXY", "XZY", "ZYX", "YXZ" ] self.declareProperty( name="EulerConvention", defaultValue="YZX", validator=StringListValidator(eulerConventions), doc= "Euler angles convention used when calculating and displaying angles," "eg XYZ corresponding to alpha beta gamma.") # alpha rotation self.declareProperty( name="AlphaRotation", defaultValue=False, doc="Refine rotation around first axis, alpha, for the components") condition = EnabledWhenProperty("AlphaRotation", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinAlphaRotation", defaultValue=-10.0, validator=FloatBoundedValidator(-90, 90), doc="Minimum relative alpha rotation (deg)") self.setPropertySettings("MinAlphaRotation", condition) self.declareProperty(name="MaxAlphaRotation", defaultValue=10.0, validator=FloatBoundedValidator(-90, 90), doc="Maximum relative alpha rotation (deg)") self.setPropertySettings("MaxAlphaRotation", condition) # beta rotation self.declareProperty( name="BetaRotation", defaultValue=False, doc="Refine rotation around seconds axis, beta, for the components" ) condition = EnabledWhenProperty("BetaRotation", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinBetaRotation", defaultValue=-10.0, validator=FloatBoundedValidator(-90, 90), doc="Minimum relative beta rotation (deg)") self.setPropertySettings("MinBetaRotation", condition) self.declareProperty(name="MaxBetaRotation", defaultValue=10.0, validator=FloatBoundedValidator(-90, 90), doc="Maximum relative beta rotation (deg)") self.setPropertySettings("MaxBetaRotation", condition) # gamma rotation self.declareProperty( name="GammaRotation", defaultValue=False, doc="Refine rotation around third axis, gamma, for the components") condition = EnabledWhenProperty("GammaRotation", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinGammaRotation", defaultValue=-10.0, validator=FloatBoundedValidator(-90, 90), doc="Minimum relative gamma rotation (deg)") self.setPropertySettings("MinGammaRotation", condition) self.declareProperty(name="MaxGammaRotation", defaultValue=10.0, validator=FloatBoundedValidator(-90, 90), doc="Maximum relative gamma rotation (deg)") self.setPropertySettings("MaxGammaRotation", condition) properties = [ "EulerConvention", "AlphaRotation", "MinAlphaRotation", "MaxAlphaRotation", "BetaRotation", "MinBetaRotation", "MaxBetaRotation", "GammaRotation", "MinGammaRotation", "MaxGammaRotation" ] [self.setPropertyGroup(name, "Rotation") for name in properties] # # Minimization Properties self.declareProperty(name='Minimizer', defaultValue='L-BFGS-B', direction=Direction.Input, validator=StringListValidator( ['L-BFGS-B', 'differential_evolution']), doc='Minimizer to Use') self.declareProperty( name='MaxIterations', defaultValue=100, direction=Direction.Input, doc= 'Maximum number of iterations for minimizer differential_evolution' ) properties = ['Minimizer', 'MaxIterations'] [self.setPropertyGroup(name, "Minimization") for name in properties]
def PyInit(self): self.declareProperty(ITableWorkspaceProperty( "CalibrationTable", "", optional=PropertyMode.Mandatory, direction=Direction.Input), doc="Calibration table, currently only uses difc") self.declareProperty(MatrixWorkspaceProperty( "MaskWorkspace", "", optional=PropertyMode.Optional, direction=Direction.Input), doc="Mask workspace") self.declareProperty(FileProperty(name="InstrumentFilename", defaultValue="", action=FileAction.OptionalLoad, extensions=[".xml"]), doc="Instrument filename") self.declareProperty( WorkspaceProperty("Workspace", "", validator=InstrumentValidator(), optional=PropertyMode.Optional, direction=Direction.Input), doc="Workspace containing the instrument to be calibrated.") # Source self.declareProperty( name="FitSourcePosition", defaultValue=False, doc= "Fit the source position, changes L1 (source to sample) distance." "Uses entire instrument. Occurs before Components are Aligned.") # Sample self.declareProperty( name="FitSamplePosition", defaultValue=False, doc= "Fit the sample position, changes L1 (source to sample) and L2 (sample to detector) distance." "Uses entire instrument. Occurs before Components are Aligned.") # List of components self.declareProperty( StringArrayProperty("ComponentList", direction=Direction.Input), doc="Comma separated list on instrument components to refine.") # X position self.declareProperty(name="Xposition", defaultValue=False, doc="Refine Xposition") condition = EnabledWhenProperty("Xposition", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinXposition", defaultValue=-0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Minimum relative X bound (m)") self.setPropertySettings("MinXposition", condition) self.declareProperty(name="MaxXposition", defaultValue=0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Maximum relative X bound (m)") self.setPropertySettings("MaxXposition", condition) # Y position self.declareProperty(name="Yposition", defaultValue=False, doc="Refine Yposition") condition = EnabledWhenProperty("Yposition", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinYposition", defaultValue=-0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Minimum relative Y bound (m)") self.setPropertySettings("MinYposition", condition) self.declareProperty(name="MaxYposition", defaultValue=0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Maximum relative Y bound (m)") self.setPropertySettings("MaxYposition", condition) # Z position self.declareProperty(name="Zposition", defaultValue=False, doc="Refine Zposition") condition = EnabledWhenProperty("Zposition", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinZposition", defaultValue=-0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Minimum relative Z bound (m)") self.setPropertySettings("MinZposition", condition) self.declareProperty(name="MaxZposition", defaultValue=0.1, validator=FloatBoundedValidator(-10.0, 10.0), doc="Maximum relative Z bound (m)") self.setPropertySettings("MaxZposition", condition) # euler angles convention eulerConventions = [ "ZXZ", "XYX", "YZY", "ZYZ", "XZX", "YXY", "XYZ", "YZX", "ZXY", "XZY", "ZYX", "YXZ" ] self.declareProperty( name="EulerConvention", defaultValue="YZX", validator=StringListValidator(eulerConventions), doc= "Euler angles convention used when calculating and displaying angles," "eg XYZ corresponding to alpha beta gamma.") # alpha rotation self.declareProperty(name="AlphaRotation", defaultValue=False, doc="Refine rotation around first axis, alpha") condition = EnabledWhenProperty("AlphaRotation", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinAlphaRotation", defaultValue=-10.0, validator=FloatBoundedValidator(-90, 90), doc="Minimum relative alpha rotation (deg)") self.setPropertySettings("MinAlphaRotation", condition) self.declareProperty(name="MaxAlphaRotation", defaultValue=10.0, validator=FloatBoundedValidator(-90, 90), doc="Maximum relative alpha rotation (deg)") self.setPropertySettings("MaxAlphaRotation", condition) # beta rotation self.declareProperty(name="BetaRotation", defaultValue=False, doc="Refine rotation around seconds axis, beta") condition = EnabledWhenProperty("BetaRotation", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinBetaRotation", defaultValue=-10.0, validator=FloatBoundedValidator(-90, 90), doc="Minimum relative beta rotation (deg)") self.setPropertySettings("MinBetaRotation", condition) self.declareProperty(name="MaxBetaRotation", defaultValue=10.0, validator=FloatBoundedValidator(-90, 90), doc="Maximum relative beta rotation (deg)") self.setPropertySettings("MaxBetaRotation", condition) # gamma rotation self.declareProperty(name="GammaRotation", defaultValue=False, doc="Refine rotation around third axis, gamma") condition = EnabledWhenProperty("GammaRotation", PropertyCriterion.IsNotDefault) self.declareProperty(name="MinGammaRotation", defaultValue=-10.0, validator=FloatBoundedValidator(-90, 90), doc="Minimum relative gamma rotation (deg)") self.setPropertySettings("MinGammaRotation", condition) self.declareProperty(name="MaxGammaRotation", defaultValue=10.0, validator=FloatBoundedValidator(-90, 90), doc="Maximum relative gamma rotation (deg)") self.setPropertySettings("MaxGammaRotation", condition) # Translation self.setPropertyGroup("Xposition", "Translation") self.setPropertyGroup("MinXposition", "Translation") self.setPropertyGroup("MaxXposition", "Translation") self.setPropertyGroup("Yposition", "Translation") self.setPropertyGroup("MinYposition", "Translation") self.setPropertyGroup("MaxYposition", "Translation") self.setPropertyGroup("Zposition", "Translation") self.setPropertyGroup("MinZposition", "Translation") self.setPropertyGroup("MaxZposition", "Translation") # Rotation self.setPropertyGroup("EulerConvention", "Rotation") self.setPropertyGroup("AlphaRotation", "Rotation") self.setPropertyGroup("MinAlphaRotation", "Rotation") self.setPropertyGroup("MaxAlphaRotation", "Rotation") self.setPropertyGroup("BetaRotation", "Rotation") self.setPropertyGroup("MinBetaRotation", "Rotation") self.setPropertyGroup("MaxBetaRotation", "Rotation") self.setPropertyGroup("GammaRotation", "Rotation") self.setPropertyGroup("MinGammaRotation", "Rotation") self.setPropertyGroup("MaxGammaRotation", "Rotation")
def PyInit(self): ws_validator = InstrumentValidator() self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '', validator=ws_validator, direction=Direction.Input), doc="Name for the input Sample workspace.") self.declareProperty(name='SampleChemicalFormula', defaultValue='', doc='Sample chemical formula') self.declareProperty(name='SampleCoherentXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='The coherent cross-section for the sample material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty(name='SampleIncoherentXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='The incoherent cross-section for the sample material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty(name='SampleAttenuationXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='The absorption cross-section for the sample material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty(name='SampleDensityType', defaultValue='Mass Density', validator=StringListValidator(['Mass Density', 'Number Density']), doc='Use of Mass density or Number density for the sample.') self.declareProperty(name='SampleNumberDensityUnit', defaultValue='Atoms', validator=StringListValidator(['Atoms', 'Formula Units']), doc='Choose which units SampleDensity refers to. Allowed values: [Atoms, Formula Units]') self.declareProperty(name='SampleDensity', defaultValue=0.1, doc='The value for the sample Mass density (g/cm^3) or Number density (1/Angstrom^3).') self.declareProperty(name='SampleInnerRadius', defaultValue=0.05, validator=FloatBoundedValidator(0.0), doc='Sample inner radius') self.declareProperty(name='SampleOuterRadius', defaultValue=0.1, validator=FloatBoundedValidator(0.0), doc='Sample outer radius') self.declareProperty(MatrixWorkspaceProperty('CanWorkspace', '', optional=PropertyMode.Optional, validator=ws_validator, direction=Direction.Input), doc="Name for the input Can workspace.") self.declareProperty(name='CanChemicalFormula', defaultValue='', doc='Can chemical formula') self.declareProperty(name='CanCoherentXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='The coherent cross-section for the can material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty(name='CanIncoherentXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='The incoherent cross-section for the can material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty(name='CanAttenuationXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='The absorption cross-section for the can material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty(name='CanDensityType', defaultValue='Mass Density', validator=StringListValidator(['Mass Density', 'Number Density']), doc='Use of Mass density or Number density for the can.') self.declareProperty(name='CanNumberDensityUnit', defaultValue='Atoms', validator=StringListValidator(['Atoms', 'Formula Units']), doc='Choose which units CanDensity refers to. Allowed values: [Atoms, Formula Units]') self.declareProperty(name='CanDensity', defaultValue=0.1, doc='The value for the can Mass density (g/cm^3) or Number density (1/Angstrom^3).') self.declareProperty(name='CanOuterRadius', defaultValue=0.15, validator=FloatBoundedValidator(0.0), doc='Can outer radius') self.declareProperty(name='BeamHeight', defaultValue=3.0, validator=FloatBoundedValidator(0.0), doc='Beam height') self.declareProperty(name='BeamWidth', defaultValue=2.0, validator=FloatBoundedValidator(0.0), doc='Beam width') self.declareProperty(name='StepSize', defaultValue=0.002, validator=FloatBoundedValidator(0.0), doc='Step size') self.declareProperty(name='Interpolate', defaultValue=True, doc='Interpolate the correction workspaces to match the sample workspace') self.declareProperty(name='NumberWavelengths', defaultValue=10, validator=IntBoundedValidator(1), doc='Number of wavelengths for calculation') self.declareProperty(name='Emode', defaultValue='Elastic', validator=StringListValidator(['Elastic', 'Indirect', 'Direct', 'Efixed']), doc='Energy transfer mode.') self.declareProperty(name='Efixed', defaultValue=0., doc='Analyser energy (mev). By default will be read from the instrument parameters. ' 'Specify manually to override. This is used in energy transfer modes other than Elastic.') self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '', direction=Direction.Output), doc='The output corrections workspace group')
def PyInit(self): ws_validator = InstrumentValidator() self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '', direction=Direction.Input, validator=ws_validator), doc='Name for the input sample workspace') self.declareProperty(name='SampleChemicalFormula', defaultValue='', doc='Sample chemical formula') self.declareProperty( name='SampleCoherentXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc= 'The coherent cross-section for the sample material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty( name='SampleIncoherentXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc= 'The incoherent cross-section for the sample material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty( name='SampleAttenuationXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc= 'The absorption cross-section for the sample material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty( name='SampleDensityType', defaultValue='Mass Density', validator=StringListValidator(['Mass Density', 'Number Density']), doc='Use of Mass density or Number density for the sample.') self.declareProperty( name='SampleNumberDensityUnit', defaultValue='Atoms', validator=StringListValidator(['Atoms', 'Formula Units']), doc='Choose which units SampleDensity refers to. Allowed values: ' '[Atoms, Formula Units]') self.declareProperty( name='SampleDensity', defaultValue=0.1, doc= 'The value for the sample Mass density (g/cm^3) or Number density (1/Angstrom^3).' ) self.declareProperty(name='SampleThickness', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='Sample thickness in cm') self.declareProperty( name='SampleAngle', defaultValue=0.0, doc='Angle between incident beam and normal to flat plate surface') self.declareProperty(MatrixWorkspaceProperty( 'CanWorkspace', '', direction=Direction.Input, optional=PropertyMode.Optional, validator=ws_validator), doc="Name for the input container workspace") self.declareProperty(name='CanChemicalFormula', defaultValue='', doc='Container chemical formula') self.declareProperty( name='CanCoherentXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc= 'The coherent cross-section for the can material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty( name='CanIncoherentXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc= 'The incoherent cross-section for the can material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty( name='CanAttenuationXSection', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc= 'The absorption cross-section for the can material in barns. To be used instead of ' 'Chemical Formula.') self.declareProperty( name='CanDensityType', defaultValue='Mass Density', validator=StringListValidator(['Mass Density', 'Number Density']), doc='Use of Mass density or Number density for the can.') self.declareProperty( name='CanNumberDensityUnit', defaultValue='Atoms', validator=StringListValidator(['Atoms', 'Formula Units']), doc= 'Choose which units CanDensity refers to. Allowed values: [Atoms, Formula Units]' ) self.declareProperty( name='CanDensity', defaultValue=0.1, doc= 'The value for the can Mass density (g/cm^3) or Number density (1/Angstrom^3).' ) self.declareProperty(name='CanFrontThickness', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='Container front thickness in cm') self.declareProperty(name='CanBackThickness', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='Container back thickness in cm') self.declareProperty(name='NumberWavelengths', defaultValue=10, validator=IntBoundedValidator(1), doc='Number of wavelengths for calculation') self.declareProperty( name='Interpolate', defaultValue=True, doc= 'Interpolate the correction workspaces to match the sample workspace' ) self.declareProperty(name='Emode', defaultValue='Elastic', validator=StringListValidator( ['Elastic', 'Indirect', 'Direct', 'Efixed']), doc='Energy transfer mode.') self.declareProperty( name='Efixed', defaultValue=0., doc= 'Analyser energy (mev). By default will be read from the instrument parameters. ' 'Specify manually to override. This is used only in Efixed energy transfer mode.' ) self.declareProperty(WorkspaceGroupProperty( 'OutputWorkspace', '', direction=Direction.Output), doc='The output corrections workspace group')
def PyInit(self): ws_validator = CompositeValidator( [WorkspaceUnitValidator('Wavelength'), InstrumentValidator()]) self.declareProperty(MatrixWorkspaceProperty( 'SampleWorkspace', '', validator=ws_validator, direction=Direction.Input), doc="Name for the input Sample workspace.") self.declareProperty(name='SampleChemicalFormula', defaultValue='', validator=StringMandatoryValidator(), doc='Sample chemical formula') self.declareProperty(name='SampleNumberDensity', defaultValue=0.1, validator=FloatBoundedValidator(0.0), doc='Sample number density') self.declareProperty(name='SampleInnerRadius', defaultValue=0.05, validator=FloatBoundedValidator(0.0), doc='Sample inner radius') self.declareProperty(name='SampleOuterRadius', defaultValue=0.1, validator=FloatBoundedValidator(0.0), doc='Sample outer radius') self.declareProperty(MatrixWorkspaceProperty( 'CanWorkspace', '', optional=PropertyMode.Optional, validator=ws_validator, direction=Direction.Input), doc="Name for the input Can workspace.") self.declareProperty(name='CanChemicalFormula', defaultValue='', doc='Can chemical formula') self.declareProperty(name='CanNumberDensity', defaultValue=0.1, validator=FloatBoundedValidator(0.0), doc='Can number density') self.declareProperty(name='CanOuterRadius', defaultValue=0.15, validator=FloatBoundedValidator(0.0), doc='Can outer radius') self.declareProperty(name='BeamHeight', defaultValue=3.0, validator=FloatBoundedValidator(0.0), doc='Beam height') self.declareProperty(name='BeamWidth', defaultValue=2.0, validator=FloatBoundedValidator(0.0), doc='Beam width') self.declareProperty(name='StepSize', defaultValue=0.002, validator=FloatBoundedValidator(0.0), doc='Step size') self.declareProperty( name='Interpolate', defaultValue=True, doc= 'Interpolate the correction workspaces to match the sample workspace' ) self.declareProperty(name='NumberWavelengths', defaultValue=10, validator=IntBoundedValidator(1), doc='Number of wavelengths for calculation') self.declareProperty(name='Emode', defaultValue='Elastic', validator=StringListValidator( ['Elastic', 'Indirect']), doc='Emode: Elastic or Indirect') self.declareProperty(name='Efixed', defaultValue=1.0, doc='Analyser energy') self.declareProperty(WorkspaceGroupProperty( 'OutputWorkspace', '', direction=Direction.Output), doc='The output corrections workspace group')
def PyInit(self): ws_validator = InstrumentValidator() self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '', direction=Direction.Input, validator=ws_validator), doc='Name for the input sample workspace') self.declareProperty(name='SampleChemicalFormula', defaultValue='', validator=StringMandatoryValidator(), doc='Sample chemical formula') self.declareProperty(name='SampleDensityType', defaultValue='Mass Density', validator=StringListValidator( ['Mass Density', 'Number Density']), doc='Use of Mass density or Number density') self.declareProperty( name='SampleDensity', defaultValue=0.1, doc='Mass density (g/cm^3) or Number density (atoms/Angstrom^3)') self.declareProperty(name='SampleThickness', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='Sample thickness in cm') self.declareProperty( name='SampleAngle', defaultValue=0.0, doc='Angle between incident beam and normal to flat plate surface') self.declareProperty(MatrixWorkspaceProperty( 'CanWorkspace', '', direction=Direction.Input, optional=PropertyMode.Optional, validator=ws_validator), doc="Name for the input container workspace") self.declareProperty(name='CanChemicalFormula', defaultValue='', doc='Container chemical formula') self.declareProperty(name='CanDensityType', defaultValue='Mass Density', validator=StringListValidator( ['Mass Density', 'Number Density']), doc='Use of Mass density or Number density') self.declareProperty( name='CanDensity', defaultValue=0.1, doc='Mass density (g/cm^3) or Number density (atoms/Angstrom^3)') self.declareProperty(name='CanFrontThickness', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='Container front thickness in cm') self.declareProperty(name='CanBackThickness', defaultValue=0.0, validator=FloatBoundedValidator(0.0), doc='Container back thickness in cm') self.declareProperty(name='NumberWavelengths', defaultValue=10, validator=IntBoundedValidator(1), doc='Number of wavelengths for calculation') self.declareProperty( name='Interpolate', defaultValue=True, doc= 'Interpolate the correction workspaces to match the sample workspace' ) self.declareProperty(name='Emode', defaultValue='Elastic', validator=StringListValidator( ['Elastic', 'Indirect', 'Direct', 'Efixed']), doc='Energy transfer mode.') self.declareProperty( name='Efixed', defaultValue=0., doc= 'Analyser energy (mev). By default will be read from the instrument parameters. ' 'Specify manually to override. This is used only in Efixed energy transfer mode.' ) self.declareProperty(WorkspaceGroupProperty( 'OutputWorkspace', '', direction=Direction.Output), doc='The output corrections workspace group')
def PyInit(self): ws_validator = InstrumentValidator() self.declareProperty(MatrixWorkspaceProperty( 'SampleWorkspace', '', validator=ws_validator, direction=Direction.Input), doc="Name for the input Sample workspace.") self.declareProperty(name='SampleChemicalFormula', defaultValue='', validator=StringMandatoryValidator(), doc='Sample chemical formula') self.declareProperty(name='SampleDensityType', defaultValue='Mass Density', validator=StringListValidator( ['Mass Density', 'Number Density']), doc='Use of Mass density or Number density') self.declareProperty( name='SampleDensity', defaultValue=0.1, doc='Mass density (g/cm^3) or Number density (atoms/Angstrom^3)') self.declareProperty(name='SampleInnerRadius', defaultValue=0.05, validator=FloatBoundedValidator(0.0), doc='Sample inner radius') self.declareProperty(name='SampleOuterRadius', defaultValue=0.1, validator=FloatBoundedValidator(0.0), doc='Sample outer radius') self.declareProperty(MatrixWorkspaceProperty( 'CanWorkspace', '', optional=PropertyMode.Optional, validator=ws_validator, direction=Direction.Input), doc="Name for the input Can workspace.") self.declareProperty(name='CanChemicalFormula', defaultValue='', doc='Can chemical formula') self.declareProperty(name='CanDensityType', defaultValue='Mass Density', validator=StringListValidator( ['Mass Density', 'Number Density']), doc='Use of Mass density or Number density') self.declareProperty( name='CanDensity', defaultValue=0.1, doc='Mass density (g/cm^3) or Number density (atoms/Angstrom^3)') self.declareProperty(name='CanOuterRadius', defaultValue=0.15, validator=FloatBoundedValidator(0.0), doc='Can outer radius') self.declareProperty(name='BeamHeight', defaultValue=3.0, validator=FloatBoundedValidator(0.0), doc='Beam height') self.declareProperty(name='BeamWidth', defaultValue=2.0, validator=FloatBoundedValidator(0.0), doc='Beam width') self.declareProperty(name='StepSize', defaultValue=0.002, validator=FloatBoundedValidator(0.0), doc='Step size') self.declareProperty( name='Interpolate', defaultValue=True, doc= 'Interpolate the correction workspaces to match the sample workspace' ) self.declareProperty(name='NumberWavelengths', defaultValue=10, validator=IntBoundedValidator(1), doc='Number of wavelengths for calculation') self.declareProperty(name='Emode', defaultValue='Elastic', validator=StringListValidator( ['Elastic', 'Indirect', 'Direct', 'Efixed']), doc='Energy transfer mode.') self.declareProperty( name='Efixed', defaultValue=0., doc= 'Analyser energy (mev). By default will be read from the instrument parameters. ' 'Specify manually to override. This is used in energy transfer modes other than Elastic.' ) self.declareProperty(WorkspaceGroupProperty( 'OutputWorkspace', '', direction=Direction.Output), doc='The output corrections workspace group')