Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
VanadiumWorkspaces | Input | str list | Mandatory | Comma separated list of Vanadium workspaces or groups of workspaces. |
BackgroundWorkspaces | Input | str list | Mandatory | Comma separated list of Background workspaces or groups of workspaces. |
OutputWorkspace | Output | Workspace | Mandatory | Name of the workspace or group of workspaces that will contain computed coefficients. |
TwoThetaTolerance | Input | number | 0.05 | Tolerance for 2theta comparison (degrees). Number between 0 and 0.1. |
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.
This algorithm computes detector efficiency correction coefficients using a given Vanadium and background workspaces. As a result, output workspace or group of workspaces with coefficients will be created.
Detector efficiency correction is performed using the measurements of vanadium standard sample (hereafter Vanadium). Background for Vanadium must be also measured and provided to the algorithm as an input BkgWorkspace. Vanadium and its background can be measured at several detector bank positions. This algorithm does the detector efficiency for a particular run in following steps:
Warning
Algorithm requires data normalized either to monitor counts or experiment duration. The normalization must be the same for all input workspaces.
Subtract Background from Vanadium:
The Minus v1 algorithm is used for this step. In the case of negative result, the error message will be produced and the algorithm terminates.
Calculate the correction coefficients:
where SF and NSF correspond to spin-slip and non-spin-flip signal, respectively. is calculated in a following way:
where is the mean value of the total signal for -th detector calculated using the Mean v1 algorithm, is the number of not masked detectors. Sum is calculated using the SumSpectra v1 algorithm.
The Divide v1 algorithm is used for this step.
Note
To apply detector efficiency corrrection to the data, one should divide neutron counts by the coefficients:
The input workspaces or groups of workspaces have to have the following in order to be valid inputs for this algorithm.
For the physically meaningful correction it is also important that these workspaces have the same slits size, polarisation, and the neutron wavelength. If some of these parameters are different, algorithm produces warning. If these properties are not specified in the workspace sample logs, no comparison is performed.
Example - Calculate coefficients and apply correction to a single run:
# Load Vanadium and background data
curtable = 'currents.txt'
vana_sf = LoadDNSLegacy('dn134011vana.d_dat', Normalization='duration', CoilCurrentsTable=curtable)
vana_nsf = LoadDNSLegacy('dn134012vana.d_dat', Normalization='duration', CoilCurrentsTable=curtable)
bkgr_sf = LoadDNSLegacy('dn134037leer.d_dat', Normalization='duration', CoilCurrentsTable=curtable)
bkgr_nsf = LoadDNSLegacy('dn134038leer.d_dat', Normalization='duration', CoilCurrentsTable=curtable)
# Mask 'bad' detectors
MaskDetectors(vana_nsf, DetectorList=[1])
# Calculate correction coefficients
coefs = DNSComputeDetEffCorrCoefs([vana_sf, vana_nsf], [bkgr_sf, bkgr_nsf])
print("First 3 correction coefficients: ")
for i in range(3):
print(round(coefs.readY(i),2))
print("Is first detector masked? {}".format(coefs.getInstrument().getDetector(1).isMasked()))
# load sample data
rawdata = LoadDNSLegacy('oi196012pbi.d_dat', Normalization='duration', CoilCurrentsTable=curtable)
# apply correction
corrected_data = rawdata/coefs
print("First 3 corrected data points")
for i in range(3):
print(round(corrected_data.readY(i),2))
Output:
First 3 correction coefficients:
0.0
1.13
1.26
Is first detector masked? True
First 3 corrected data points
0.0
287.89
277.55
Categories: Algorithms | Workflow\MLZ\DNS | CorrectionFunctions\SpecialCorrections
Python: DNSComputeDetEffCorrCoefs.py (last modified: 2017-09-06)