\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
This algorithm is deprecated as of May 2021, consider using PDCalibration instead.Calibrates one or more detector banks (or group(s) of detectors) by performing single peak fitting.
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | Workspace with the calibration run to use. |
ExpectedPeaks | Input | dbl list | 2.7057,1.91322,1.6316,1.35285,1.1046 | A list of dSpacing values where peaks are expected. |
ExpectedPeaksFromFile | Input | string | Load from file a list of dSpacing values to be translated into TOF to find expected peaks. This takes precedence over ‘ExpectedPeaks’ if both options are given. Allowed extensions: [‘.csv’] | |
VanadiumWorkspace | Input | MatrixWorkspace | Workspace with the Vanadium (correction and calibration) run. Alternatively, when the Vanadium run has been already processed, the properties can be used | |
VanIntegrationWorkspace | Input | TableWorkspace | Results of integrating the spectra of a Vanadium run, with one column (integration result) and one row per spectrum. This can be used in combination with OutVanadiumCurveFits from a previous execution and VanadiumWorkspace to provide pre-calculated values for Vanadium correction. | |
VanCurvesWorkspace | Input | MatrixWorkspace | A workspace2D with the fitting workspaces corresponding to the instrument banks. This workspace has three spectra per bank, as produced by the algorithm Fit. This is meant to be used as an alternative input VanadiumWorkspace for testing and performance reasons. If not given, no workspace is generated. | |
Bank | Input | string | Which bank to calibrate. It can be specified as 1 or 2, or equivalently, North or South. See also SpectrumNumbers for a more flexible alternative to select specific detectors. Allowed values: [‘’, ‘North’, ‘South’, ‘Both: North, South’, ‘1’, ‘2’] | |
SpectrumNumbers | Input | string | Sets the spectrum numbers for the detectors that should be considered in the calibration (all others will be ignored). This option cannot be used together with Bank, as they overlap. You can give multiple ranges, for example: “0-99”, or “0-9, 50-59, 100-109”. | |
DetectorPositions | Input | TableWorkspace | Calibrated detector positions. If not specified, default ones (from the current instrument definition) are used. | |
OutputParametersTableName | Input | string | Name for a table workspace with the calibration parameters calculated from this algorithm: difc and zero parameters for GSAS. these two parameters are added as two columns in a single row. If not given, no table is generated. | |
DIFA | Output | number | Calibration parameter DIFA for the bank or range of pixels/detectors given | |
DIFC | Output | number | Calibration parameter DIFC for the bank or range of pixels/detectors given | |
TZERO | Output | number | Calibration parameter TZERO for the bank or range of pixels/detectors given | |
FittedPeaks | Output | TableWorkspace | Mandatory | Information on fitted peaks as produced by the (child) algorithm EnggFitPeaks. |
Warning
This algorithm is being developed for a specific instrument. It might get changed or even removed without a notification, should instrument scientists decide to do so.
Utilises EnggFocus v1 which performs a TOF to dSpacing conversion using calibrated pixel positions, focuses the values in dSpacing and then converts them back to TOF. EnggFocus v1 also perform corrections with Vanadium data.
Then this algorithm calls EnggFitPeaks v1 (as a child algorithm) which through a sequence of peak fits determines a linear relationship between dSpacing and measured TOF values in terms of DIFA, DIFC and TZERO values and provides the these parameters to the Calibrate algorithm.
This algorithm provides an indirect calibration of the sample position, that is, a calibration returned in terms of DIFA, DIFC and ZERO rather than an actual new sample position (hence the reason for ‘indirect’).
The parameters DIFA, DIFC and ZERO are returned and can be retrieved as output properties as well. If a name is given in OutputParametersTableName the algorithm also produces a table workspace with that name, containing the two output parameters. Presently the DIFA parameter is always set to zero (see EnggFitTOFFromPeaks v1).
The script EnggUtils included with Mantid can produce a GSAS parameters file for the ENGIN-X instrument, given the DIFA, DIFC, and ZERO parameters for the instrument banks as produced by EnggCalibrate. This can be done with the write_ENGINX_GSAS_iparam_file() function as shown in the usage example below.
See the algorithm EnggFocus v1 for details on the Vanadium corrections.
Categories: AlgorithmIndex | Diffraction\Engineering
Python: EnggCalibrate.py (last modified: 2021-06-11)
Note
To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.
Example - Calculate Difa, Difc, and Zero for EnginX:
out_tbl_name = 'out_params'
ws_name = 'test_engg_data'
Load('ENGINX00213855.nxs', OutputWorkspace=ws_name)
# Using precalculated Vanadium corrections. To calculate from scrach see EnggVanadiumCorrections
van_integ_ws = Load('ENGINX_precalculated_vanadium_run000236516_integration.nxs')
van_curves_ws = Load('ENGINX_precalculated_vanadium_run000236516_bank_curves.nxs')
difa1, difc1, tzero1, peaks1 = EnggCalibrate(InputWorkspace=ws_name,
VanIntegrationWorkspace=van_integ_ws,
VanCurvesWorkspace=van_curves_ws,
ExpectedPeaks=[1.09, 1.28, 2.1], Bank='1',
OutputParametersTableName=out_tbl_name)
difa2, difc2, tzero2, peaks2 = EnggCalibrate(InputWorkspace=ws_name,
VanIntegrationWorkspace=van_integ_ws,
VanCurvesWorkspace=van_curves_ws,
ExpectedPeaks=[1.09, 1.28, 2.1], Bank='2')
# You can produce an instrument parameters (iparam) file for GSAS.
# Note that this is very specific to ENGIN-X
GSAS_iparm_fname = 'ENGIN_X_banks.prm'
import EnggUtils
EnggUtils.write_ENGINX_GSAS_iparam_file(GSAS_iparm_fname, bank_names=['North', 'South'],
difa=[difa1, difa2], difc=[difc1, difc2], tzero=[tzero1, tzero2])
import math
tbl = mtd[out_tbl_name]
print("The output table has {0} row(s)".format(tbl.rowCount()))
import os
print("Output GSAS iparam file was written? {0}".format(os.path.exists(GSAS_iparm_fname)))
print("Number of lines of the GSAS iparam file: {0}".format(sum(1 for line in open(GSAS_iparm_fname))))
Output:
The output table has 1 row(s)
Output GSAS iparam file was written? True
Number of lines of the GSAS iparam file: 36