EnggCalibrate v1

../_images/EnggCalibrate-v1_dlg.png

EnggCalibrate dialog.

Summary

Calibrates one or more detector banks (or group(s) of detectors) by performing single peak fitting.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory Workspace with the calibration run to use.
ExpectedPeaks Input dbl list 3.12428,2.7057,1.91322,1.6316,1.56214,1.35285,1.24146,1.21003,1.1046,1.04143,1.04143,0.95661,0.914694,0.901901,0.855618,0.825232,0.8158,0.781069,0.757748,0.750427,0.72313,0.704505,0.676426,0.661108,0.656229,0.63774,0.624855,0.620731,0.605014 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 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.
Difc Output number   Calibrated Difc value for the bank or range of pixels/detectors given
Zero Output number   Calibrated Zero value for the bank or range of pixels/detectors given

Description

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 DIFC and ZERO 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 Difc and Zero rather than an actual new sample position (hence the reason for ‘indirect’).

The parameters 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.

The script EnggUtils included with Mantid can produce a GSAS parameters file for the ENGIN-X instrument, given the 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: Algorithms | Diffraction\Engineering

Usage

Note

To run these usage examples please first download the usage data, and add these to your path. In MantidPlot this is done using Manage User Directories.

Example - Calculate Difc and Zero for EnginX:

out_tbl_name = 'out_params'
ws_name = 'test'
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')

Difc1, Zero1 = EnggCalibrate(InputWorkspace=ws_name,
                             VanIntegrationWorkspace=van_integ_ws,
                             VanCurvesWorkspace=van_curves_ws,
                             ExpectedPeaks=[1.097, 2.1], Bank='1',
                             OutputParametersTableName=out_tbl_name)

Difc2, Zero2 = EnggCalibrate(InputWorkspace=ws_name,
                             VanIntegrationWorkspace=van_integ_ws,
                             VanCurvesWorkspace=van_curves_ws,
                             ExpectedPeaks=[1.097, 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_bank1'
import EnggUtils
EnggUtils.write_ENGINX_GSAS_iparam_file(GSAS_iparm_fname, [Difc1, Difc2], [Zero1, Zero2])

print "Difc1: %.2f" % (Difc1)
print "Zero1: %.2f" % (Zero1)
tbl = mtd[out_tbl_name]
print "The output table has %d row(s)" % tbl.rowCount()
print "Parameters from the table, Difc1: %.2f, Zero1: %.2f" % (tbl.cell(0,0), tbl.cell(0,1))
import os
print "Output GSAS iparam file was written?", os.path.exists(GSAS_iparm_fname)
print "Number of lines of the GSAS iparam file:", sum(1 for line in open(GSAS_iparm_fname))

Output:

Difc1: 18400.19
Zero1: -2.06
The output table has 1 row(s)
Parameters from the table, Difc1: 18400.19, Zero1: -2.06
Output GSAS iparam file was written? True
Number of lines of the GSAS iparam file: 35