Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | InOut | MatrixWorkspace | Mandatory | Input signal workspace |
TofBinning | Input | dbl list | Mandatory | Min, Step, and Max of time-of-flight bins. Logarithmic binning is used if Step is negative. |
PreviousCalibrationFile | Input | string | Previous calibration file. Allowed extensions: [‘.h5’, ‘.cal’] | |
PreviousCalibrationTable | Input | TableWorkspace | Previous calibration table. This overrides results from previous file. | |
PeakFunction | Input | string | Gaussian | Allowed values: [‘BackToBackExponential’, ‘Gaussian’, ‘Lorentzian’, ‘PseudoVoigt’] |
BackgroundType | Input | string | Linear | Type of Background. Allowed values: [‘Flat’, ‘Linear’, ‘Quadratic’] |
PeakPositions | Input | dbl list | Mandatory | Comma delimited d-space positions of reference peaks. |
PeakWindow | Input | number | 0.1 | The maximum window (in d space) around peak to look for peak. |
PeakWidthPercent | Input | number | Optional | The estimated peak width as a percentage of the d-spacing of the center of the peak. This is the same as the width in time-of-flight. |
MinimumPeakHeight | Input | number | 2 | Minimum peak height such that all the fitted peaks with height under this value will be excluded. |
MaxChiSq | Input | number | 100 | Maximum chisq value for individual peak fit allowed. (Default: 100) |
ConstrainPeakPositions | Input | boolean | False | If true peak position will be constrained by estimated positions (highest Y value position) and the peak width either estimted by observation or calculate. |
CalibrationParameters | Input | string | DIFC | Select calibration parameters to fit. Allowed values: [‘DIFC’, ‘DIFC+TZERO’, ‘DIFC+TZERO+DIFA’] |
TZEROrange | Input | dbl list | Range for allowable TZERO from calibration (default is all) | |
DIFArange | Input | dbl list | Range for allowable DIFA from calibration (default is all) | |
OutputCalibrationTable | Output | TableWorkspace | Mandatory | An output workspace containing the Calibration Table |
DiagnosticWorkspaces | Output | WorkspaceGroup | Mandatory | Workspaces to promote understanding of calibration results |
This algorithm calibrates the detector pixels and creates a diffraction calibration workspace. Unlike CalibrateRectangularDetectors v1 the peak fitting and calibration is done in TOF not d spacing. The peak d values are converted to TOF based on either the old calibration or the instrument geometry. The InputWorkspace contains the data from a standard sample. The results are then fitted with up to (in order) difc, t_zero and difa, these values are details in AlignDetectors v1.
The peak fitting properties are explained in more detail in FitPeaks v1. This is used to perform a refinement of peaks using as much information as is provided as possible. Each input spectrum is calibrated separately following the same basic steps:
If more than one constant is requested, the result that has the lowest reduced chi-squared value is returned. This favors using less parameters.
A mask workspace is created, named “OutputCalibrationTable” + ‘_mask’, with uncalibrated pixels masked.
The resulting calibration table can be saved with SaveDiffCal v1, loaded with LoadDiffCal v1 and applied to a workspace with AlignDetectors v1. There are also three workspaces placed in the DiagnosticWorkspace group. They are:
Since multiple peak shapes can be used, see the documentation for the individual fit functions to see how they relate to the effective values displayed in the diagnostic tables. For Gaussian and Lorentzian, the widths and resolution are converted to values that can be directly compared with the results of EstimateResolutionDiffraction v1.
Example - PDCalibration
# If you have an old calibration it can be used as the starting point
oldCal = 'NOM_calibrate_d72460_2016_05_23.h5'
# list of d values for diamond
dvalues = (0.3117,0.3257,0.3499,0.4205,0.4645,0.4768,0.4996,0.5150,0.5441,0.5642,0.5947,0.6307,.6866,.7283,.8185,.8920,1.0758,1.2615,2.0599)
LoadEventNexus(Filename='NOM_72460', OutputWorkspace='NOM_72460')
PDCalibration(InputWorkspace='NOM_72460',
TofBinning=[300,-.001,16666.7],
PreviousCalibrationFile=oldCal,
PeakPositions=dvalues,
PeakWidthPercent=.008,
OutputCalibrationTable='cal',
DiagnosticWorkspaces='diag')
# Print the result
print("The calibrated difc at detid {detid} is {difc}".format(**mtd['cal'].row(40000)))
Output:
The calibrated difc at detid 40896 is 5523.060327692842
Categories: AlgorithmIndex | Diffraction\Calibration
C++ source: PDCalibration.cpp (last modified: 2019-07-17)
C++ header: PDCalibration.h (last modified: 2018-10-05)