\(\renewcommand\AA{\unicode{x212B}}\)

# EnggVanadiumCorrections v1¶

## Summary¶

This algorithm is deprecated as of May 2021, use a workflow with the Integration algorithm instead.Calculates correction features and / or uses them to correct diffraction data with respect to reference Vanadium data.

## Properties¶

Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|

Workspace |
InOut |
Workspace with the diffraction data to correct. The Vanadium corrections will be applied on it. |
||

VanadiumWorkspace |
Input |
Workspace with the reference Vanadium diffraction data. |
||

OutIntegrationWorkspace |
Output |
Output integration workspace produced when given an input Vanadium workspace |
||

OutCurvesWorkspace |
Output |
Output curves workspace produced when given an input Vanadium workspace |
||

SplineBreakPoints |
Input |
number |
50 |
Number of break points used when fitting the bank profiles with a spline function. |

IntegrationWorkspace |
Input |
Workspace with the integrated values for every spectra of the reference Vanadium diffraction data. One row per spectrum. |
||

CurvesWorkspace |
Input |
Workspace with the curves fitted on bank-aggregated Vanadium diffraction data, one per bank. This workspace has three spectra per bank, as produced by the algorithm Fit. This is meant to be used as an alternative input VanadiumWorkspace |

## Description¶

Warning

This algorithm is being developed for a specific instrument and technique. It might get changed or even removed without a notification, should instrument scientists decide to do so.

This algorithm performs calculations related to two types of corrections with respect to a reference Vanadium diffraction dataset (workspace), in the following order:

sensitivity correction

pixel-by-pixel correction

The algorithm outputs the features extracted from the Vanadium data that are used to perform the two types of corrections, respectively:

the

*integration*of every individual Vanadium spectruma list of

*curves*of aggregated counts as a function of time-of-flight (one per bank)

If an input/output workspace with diffraction data is passed, the algorithm applies the corrections on the diffraction data workspace by using the integration and curves calculated from the reference Vanadium datasset.

These outputs can be used to apply the corrections on a diffraction data workspace in the same algorithm run, or be used subsequently to apply corrections to different input workspaces. In practice, both outputs need to be calculated only once for every reference Vanadium dataset, while they would normally be used to correct a (possibly long) series of different diffraction data workspaces.

If a vanadium data workspace is passed, the algorithm will calculate
features that can then be used to apply Vanadium corrections in other
*Engg* algorithms. If in addition an input/output workspace with
diffraction data is passed, the corrections will be applied on
it. Afterwards the same corrections can be applied on different
diffraction data workspaces by calling again this algorithm and
providing as inputs the integraion and curves workspaces produced by
the first call. The same correction features (integration and curves)
can be re-used for as long as the same reference Vanadium diffraction
data is still valid.

Normally this algorithm can be used in two different ways:

Pre-calculate correction features from a Vanadium data workspace.

Apply Vanadium corrections once the correction features have been calculated.

Examples of these two alternatives are shown below. In the first option, only the input VanadiumWorkspace is required, and the two outputs (integration and curves workspaces) are produced normally. Optionally, a diffraction data workspace can be passed in the input property InputWorkspace for it to be corrected. In the second option, the corrections can be applied by using pre-calculated features from a previous run of this algorithm (both IntegrationWorkspace and CurvesWorkspace have to be passed as input properties, If these two properties are not passed, they will be re-calculated provided that a VanadiumWorkspace is passed which is not recommended). All the calculations (integration, sums, divisions, etc.) are done in the d-spacing space.

This algorithm is used as a child algorithm in the algorithms EnggFocus v1 and EnggCalibrateFull v1.

## Usage¶

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 - apply Vanadium corrections on a sample workspace from an EnginX run file:**

```
# # To generate the pre-calculated features (integration and curves), for a new
# Vanadium run, and apply the corrections on a workspace:
#
# sample_ws = Load('ENGINX00213855.nxs')
# van_ws = Load('ENGINX00236516.nxs')
# EnggVanadiumCorrections(Workspace = sample_ws, VanadiumWorkspace = van_ws
# OutIntegrationWorkspace = 'integ_ws',
# OutCurvesWorkspace = 'curves_ws')
#
# # Now you can save the two pre-calculated features / workspaces:
# SaveNexus(InputWorkspace='integ_ws',
# Filename='ENGINX_precalculated_vanadium_run000236516_integration.nxs',)
# SaveNexus(InputWorkspace='curves_ws',
# Filename='ENGINX_precalculated_vanadium_run000236516_bank_curves.nxs')
#
# # (not done here because the Vanadium run file has a large number of events)
#
# # Below we use the pre-calculated features that can be obtained with
# # the commands listed above.
sample_ws = Load('ENGINX00213855.nxs')
integ_ws = LoadNexus('ENGINX_precalculated_vanadium_run000236516_integration.nxs')
curves_ws = LoadNexus('ENGINX_precalculated_vanadium_run000236516_bank_curves.nxs')
EnggVanadiumCorrections(Workspace = sample_ws,
IntegrationWorkspace = integ_ws,
CurvesWorkspace = curves_ws)
# Should have one spectrum only
print("No. of spectra: {}".format(sample_ws.getNumberHistograms()))
# Print a few arbitrary integrated spectra
ws_idx = 400
idx_count = 3
integ_ws = Integration(sample_ws, StartWorkspaceIndex=ws_idx,
EndWorkspaceIndex=ws_idx+idx_count)
fmt = "For workspace index {0:d} the spectrum integration is {1:.3f}"
for i in range(idx_count):
print(fmt.format(ws_idx+i, integ_ws.readY(i)[0]))
```

Output:

```
No. of spectra: 2513
For workspace index 400 the spectrum integration is 23.998
For workspace index 401 the spectrum integration is 23.799
For workspace index 402 the spectrum integration is 22.872
```

**Categories**: AlgorithmIndex | Diffraction\Engineering | CorrectionFunctions\BackgroundCorrections | CorrectionFunctions\EfficiencyCorrections | CorrectionFunctions\NormalisationCorrections

## Source¶

Python: EnggVanadiumCorrections.py