EnggFocus v1

../_images/EnggFocus-v1_dlg.png

EnggFocus dialog.

Summary

Focuses a run by summing up all the spectra into a single one.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory Workspace with the run to focus.
OutputWorkspace Output MatrixWorkspace Mandatory A workspace with focussed data
DetectorPositions Input TableWorkspace   Calibrated detector positions. If not specified, default ones are used.
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 focus: 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 focusing operation (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”.
NormaliseByCurrent Input boolean True Normalize the input data by applying the NormaliseByCurrent algorithm which use the log entry gd_proton_charge
MaskBinsXMins Input dbl list 0,19930,39960,59850,79930 List of minimum bin values to mask, separated by commas.
MaskBinsXMaxs Input dbl list 5300,20400,40450,62000,82670 List of maximum bin values to mask, separated by commas.

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.

Performs a Time-of-flight (TOF) to dSpacing conversion using calibrated pixel positions, focuses the values in dSpacing (summing them up into a single spectrum) and then converts them back to TOF. The output workspace produced by this algorithm has one spectrum. The algorithm also normalizes the spectra values by current or proton charge, using NormaliseByCurrent v1 so that the output workspace is focused and normalized. In the focusing process, several bins will be masked in the spectra as well. A list of minimum and maximum TOF bin boundaries for the masking can be given. The default values of this list is set for the ENGIN-X instrument.

If a table of detector positions is passed as an input property, the detectors are calibrated before performing the conversions between TOF and dSpacing. The table with individual detector or pixel positions can be generated with EnggCalibrateFull v1.

In any case, before focusing the workspace, the spectra are corrected by using data from a Vanadium run (passed in the VanadiumWorkspace property). These corrections include two steps: detector sensitivity correction and pixel-by-pixel correction on a per-bank basis. See also EnggCalibrateFull v1 where the same correction is applied.

The pixel-by-pixel Vanadium correction is based on curves fitted for every bank. These curves can be obtained via the output property OutVanadiumCurveFits. For every bank, the curve is fitted to the summation of all the spectra of the bank, and then every spectra of the bank is divided by the bank curve.

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 - Simple focussing of an EnginX data file:

# Run the algorithm on an EnginX file
data_ws = Load('ENGINX00213855.nxs')

# 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')

focussed_ws = EnggFocus(InputWorkspace=data_ws,
                        VanIntegrationWorkspace=van_integ_ws,
                        VanCurvesWorkspace=van_curves_ws,
                        Bank='1')

# Should have one spectrum only
print("No. of spectra: {}".format(focussed_ws.getNumberHistograms()))

# Print a few arbitrary bins where higher intensities are expected
fmt = "For TOF of {0:.3f} normalized intensity is {1:.3f}"
for bin in [3169, 6037, 7124]:
  print(fmt.format(focussed_ws.readX(0)[bin], focussed_ws.readY(0)[bin]))

Output:

No. of spectra: 1
For TOF of 20165.642 normalized intensity is 1.769
For TOF of 33547.826 normalized intensity is 2.895
For TOF of 38619.804 normalized intensity is 5.181

Categories: Algorithms | Diffraction\Engineering

Source

Python: EnggFocus.py (last modified: 2017-11-13)