\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
| Name | Direction | Type | Default | Description | 
|---|---|---|---|---|
| SampleInputFile | Input | string | File containing the sample data to reduce. Allowed extensions: [‘_event.nxs’] | |
| SampleInputWorkspace | Input | MatrixWorkspace | Workspace to be reduced | |
| SampleInputMonitorWorkspace | Input | MatrixWorkspace | A monitor workspace associated with the input sample workspace. | |
| DetCalFilename | Input | string | A detector calibration file. | |
| RelocateDetectors | Input | boolean | False | Move detectors to position specified in cal file. | 
| IncidentEnergyGuess | Input | number | Optional | Set the value of the incident energy guess in meV. | 
| UseIncidentEnergyGuess | Input | boolean | False | Use the incident energy guess as the actual value (will not be calculated). | 
| TimeZeroGuess | Input | number | Optional | Set the value of time zero offset in microseconds. | 
| Monitor1SpecId | Input | number | Optional | Spectrum No for the first monitor to use in Ei calculation. | 
| Monitor2SpecId | Input | number | Optional | Spectrum No for the second monitor to use in Ei calculation. | 
| EnergyTransferRange | Input | dbl list | A comma separated list of first bin boundary, width, last bin boundary. Negative width value indicates logarithmic binning. | |
| SofPhiEIsDistribution | Input | boolean | True | The final S(Phi, E) data is made to be a distribution. | 
| HardMaskFile | Input | string | A file or workspace containing a hard mask. Allowed extensions: [‘.xml’] | |
| GroupingFile | Input | string | A file containing grouping (mapping) information. Allowed extensions: [‘.xml’] | |
| ShowIntermediateWorkspaces | Input | boolean | False | Flag to show the intermediate workspaces (diagnostic mask, integrated detector vanadium, integrated absolute units) from the reduction. | 
| IncidentBeamNormalisation | Input | string | None | Options for incident beam normalisation on data. Allowed values: [‘None’, ‘ByCurrent’, ‘ToMonitor’] | 
| MonitorIntRangeLow | Input | number | Optional | Set the lower bound for monitor integration. | 
| MonitorIntRangeHigh | Input | number | Optional | Set the upper bound for monitor integration. | 
| TimeIndepBackgroundSub | Input | boolean | False | If true, time-independent background will be calculated and removed. | 
| TibTofRangeStart | Input | number | Optional | Set the lower TOF bound for time-independent background subtraction. | 
| TibTofRangeEnd | Input | number | Optional | Set the upper TOF bound for time-independent background subtraction. | 
| CorrectKiKf | Input | boolean | True | Apply the ki/kf correction. | 
| DetectorVanadiumInputFile | Input | string | File containing the sample detector vanadium data to reduce. Allowed extensions: [‘_event.nxs’] | |
| DetectorVanadiumInputWorkspace | Input | MatrixWorkspace | Sample detector vanadium workspace to be reduced | |
| DetectorVanadiumInputMonitorWorkspace | Input | MatrixWorkspace | A monitor workspace associated with the input sample detector vanadium workspace. | |
| SaveProcessedDetVan | Input | boolean | False | Save the processed detector vanadium workspace | 
| SaveProcDetVanFilename | Input | string | Provide a filename for saving the processed detector vanadium. Allowed extensions: [‘.nxs’] | |
| UseProcessedDetVan | Input | boolean | False | If true, treat the detector vanadium as processed. This includes not running diagnostics on the processed data. | 
| UseBoundsForDetVan | Input | boolean | False | If true, integrate the detector vanadium over a given range. | 
| DetVanIntRangeLow | Input | number | Optional | Set the lower bound for integrating the detector vanadium. | 
| DetVanIntRangeHigh | Input | number | Optional | Set the upper bound for integrating the detector vanadium. | 
| DetVanIntRangeUnits | Input | string | Energy | Options for the units on the detector vanadium integration. Allowed values: [‘Energy’, ‘Wavelength’, ‘TOF’] | 
| HighCounts | Input | number | Optional | Mask detectors above this threshold. | 
| LowCounts | Input | number | Optional | Mask detectors below this threshold. | 
| LowOutlier | Input | number | Optional | Lower bound defining outliers as fraction of median value | 
| HighOutlier | Input | number | Optional | Upper bound defining outliers as fraction of median value | 
| MedianTestHigh | Input | number | Optional | Mask detectors above this threshold. | 
| MedianTestLow | Input | number | Optional | Mask detectors below this threshold. | 
| MedianTestLevelsUp | Input | number | 0 | Mask detectors below this threshold. | 
| MedianTestCorrectForSolidAngle | Input | boolean | False | Flag to correct for solid angle efficiency. | 
| ErrorBarCriterion | Input | number | Optional | Some selection criteria for the detector tests. | 
| DetectorVanadium2InputFile | Input | string | File containing detector vanadium data to compare against. Allowed extensions: [‘_event.nxs’] | |
| DetectorVanadium2InputWorkspace | Input | MatrixWorkspace | Detector vanadium workspace to compare against | |
| DetectorVanadium2InputMonitorWorkspace | Input | MatrixWorkspace | A monitor workspace associated with the input comparison detector vanadium workspace. | |
| DetVanRatioVariation | Input | number | Optional | Mask detectors if the time variation is above this threshold. | 
| BackgroundCheck | Input | boolean | False | If true, run a background check on detector vanadium. | 
| SamBkgMedianTestHigh | Input | number | Optional | Mask detectors above this threshold. | 
| SamBkgMedianTestLow | Input | number | Optional | Mask detectors below this threshold. | 
| SamBkgErrorBarCriterion | Input | number | Optional | Some selection criteria for the detector tests. | 
| BackgroundTofStart | Input | number | Optional | Start TOF for the background check. | 
| BackgroundTofEnd | Input | number | Optional | End TOF for the background check. | 
| RejectZeroBackground | Input | boolean | False | If true, check the background region for anomolies. | 
| PsdBleed | Input | boolean | False | If true, perform a PSD bleed test. | 
| MaxFramerate | Input | number | Optional | The maximum framerate to check. | 
| IgnoredPixels | Input | number | Optional | A list of pixels to ignore in the calculations. | 
| DoAbsoluteUnits | Input | boolean | False | If true, perform an absolute units normalisation. | 
| AbsUnitsSampleInputFile | Input | string | The sample (vanadium) file used in the absolute units normalisation. | |
| AbsUnitsSampleInputWorkspace | Input | MatrixWorkspace | The sample (vanadium) workspace for absolute units normalisation. | |
| AbsUnitsSampleInputMonitorWorkspace | Input | MatrixWorkspace | A monitor workspace associated with the input absolute units sample workspace. | |
| AbsUnitsGroupingFile | Input | string | Grouping file for absolute units normalisation. | |
| AbsUnitsDetectorVanadiumInputFile | Input | string | The detector vanadium file used in the absolute units normalisation. | |
| AbsUnitsDetectorVanadiumInputWorkspace | Input | MatrixWorkspace | The detector vanadium workspace for absolute units normalisation. | |
| AbsUnitsDetectorVanadiumInputMonitorWorkspace | Input | MatrixWorkspace | A monitor workspace associated with the input absolute units sample detector vanadium workspace. | |
| AbsUnitsIncidentEnergy | Input | number | Optional | The incident energy for the vanadium sample. | 
| AbsUnitsMinimumEnergy | Input | number | Optional | The minimum energy for the integration range. | 
| AbsUnitsMaximumEnergy | Input | number | Optional | The maximum energy for the integration range. | 
| VanadiumMass | Input | number | Optional | The mass of vanadium. | 
| SampleMass | Input | number | 1 | The mass of sample. | 
| SampleRmm | Input | number | 1 | The rmm of sample. | 
| AbsUnitsLowOutlier | Input | number | Optional | Lower bound defining outliers as fraction of median value | 
| AbsUnitsHighOutlier | Input | number | Optional | Upper bound defining outliers as fraction of median value | 
| AbsUnitsMedianTestHigh | Input | number | Optional | Mask detectors above this threshold. | 
| AbsUnitsMedianTestLow | Input | number | Optional | Mask detectors below this threshold. | 
| AbsUnitsErrorBarCriterion | Input | number | Optional | Some selection criteria for the detector tests. | 
| DoPowderDataConversion | Input | boolean | False | Flag to switch on converting DeltaE to SQW. | 
| PowderMomTransferRange | Input | dbl list | A comma separated list of first bin boundary, width, last bin boundary. Negative width value indicates logarithmic binning. | |
| SavePowderNexusFile | Input | boolean | True | Flag to use to save a processed NeXus file for powder data. | 
| SavePowderNexusFilename | Input | string | Provide a filename for saving the processed powder data. Allowed extensions: [‘.nxs’] | |
| OutputWorkspace | Output | MatrixWorkspace | Mandatory | Provide a name for the output workspace. | 
| ReductionProperties | Output | string | 
This is the top-level workflow algorithm for direct geometry spectrometer data reduction. This algorithm is responsible for gathering the necessary parameters and generating calls to other workflow or standard algorithms.
Example - Simplest SNS Script
config['default.facility'] = "SNS"
# SNS reduction does not require IncidentEnergyGuess since the NeXus
# files contain an EnergyRequest log.
ws = DgsReduction(SampleInputFile="CNCS_7860_event.nxs")
# More than one output from DgsReduction
# (E vs Phi Workspace, Name of Property Manager)
w = ws[0]
# Check the conversion
xaxis = w.getAxis(0).getUnit()
print("X axis = {} / {}".format(xaxis.caption(), xaxis.symbol()))
print("Energy mode = {}".format(w.getEMode()))
print("Workspace type = {}".format(w.id()))
Output:
X axis = Energy transfer / meV
Energy mode = Direct
Workspace type = Workspace2D
Example - Simplest ISIS Script
config['default.facility'] = "ISIS"
# ISIS reduction required IncidentEnergyGuess since RAW files don't
# have a corresponding log.
ws = DgsReduction(SampleInputFile="MAR11001.raw",
                  IncidentEnergyGuess=12)
# More than one output from DgsRedution
# (E vs Phi Workspace, Name of Property Manager)
w = ws[0]
# Check the conversion
xaxis = w.getAxis(0).getUnit()
print("X axis = {} / {}".format(xaxis.caption(), xaxis.symbol()))
print("Energy mode = {}".format(w.getEMode()))
print("Workspace type = {}".format(w.id()))
Output:
X axis = Energy transfer / meV
Energy mode = Direct
Workspace type = Workspace2D
Example - Get as Eventworkspace for SNS
The following shows that event data can be the result of the redcuction instead of histogram data.
config['default.facility'] = "SNS"
ws = DgsReduction(SampleInputFile="CNCS_7860_event.nxs",
                  IncidentBeamNormalisation="ByCurrent",
                  SofPhiEIsDistribution=False)
w = ws[0]
print("Workspace type = {}".format(w.id()))
print("Number of events = {}".format(w.getNumberEvents()))
Output:
Workspace type = EventWorkspace
Number of events = 78037
Example - Correct Data Before Reduction for SNS
The following is a contrived example to show that the data can be loaded and corrected and/or filtered before passing it to the algorithm. The key here is that the *InputWorkspace properties must be used. It also shows a couple of more properties being used.
config['default.facility'] = "SNS"
ws = Load("CNCS_7860_event.nxs", LoadMonitors=True)
monitor = ws[1]
valC3 = ws[0].getRun()['Phase3'].getStatistics().median
ws = FilterByLogValue(ws[0], LogName="Phase3", MinimumValue=valC3-0.3,
                      MaximumValue=valC3+0.3)
# Although CNCS doesn't use its monitors, this is how instruments that do need
# to call the algorithm.
ws = DgsReduction(SampleInputWorkspace=ws, SampleInputMonitorWorkspace=monitor,
                  IncidentBeamNormalisation="ByCurrent", SofPhiEIsDistribution=False)
w = ws[0]
print("Workspace type = {}".format(w.id()))
print("Number of events = {}".format(w.getNumberEvents()))
Output:
Workspace type = EventWorkspace
Number of events = 2178
Categories: AlgorithmIndex | Workflow\Inelastic
C++ header: DgsReduction.h (last modified: 2021-03-31)
C++ source: DgsReduction.cpp (last modified: 2021-03-31)