\(\renewcommand\AA{\unicode{x212B}}\)
PolarizationCorrectionFredrikze v1¶
Summary¶
Makes corrections for polarization efficiencies of the polarizer and analyzer in a reflectometry neutron spectrometer.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
WorkspaceGroup |
Mandatory |
An input workspace to process. |
PolarizationAnalysis |
Input |
string |
PA |
What Polarization mode will be used? PNR: Polarized Neutron Reflectivity mode PA: Full Polarization Analysis PNR-PA. Allowed values: [‘PA’, ‘PNR’] |
Efficiencies |
Input |
Mandatory |
A workspace containing the efficiency factors Pp, Ap, Rho and Alpha as histograms |
|
OutputWorkspace |
Output |
WorkspaceGroup |
Mandatory |
An output workspace. |
InputSpinStates |
Input |
string |
The order of spin states in the input workspace group. The possible values are ‘pp,pa,ap,aa’ or ‘p,a’, in any order. |
|
OutputSpinStates |
Input |
string |
The order of spin states in the output workspace group. The possible values are ‘pp,pa,ap,aa’ or ‘p,a’, in any order. |
Description¶
Performs wavelength polarization correction on a TOF reflectometer spectrometer.
The algorithm is based on the paper Fredrikze, H, et al. “Calibration of a polarized neutron reflectometer” Physica B 297 (2001) [1].
Polarizer and Analyzer efficiencies are calculated and used to perform an intensity correction on the input workspace. The input workspace(s) are in units of wavelength (inverse angstroms).
In the ideal case \(P_{p} = P_{a} = A_{p} = A_{a} = 1\).
\(\rho = \frac{P_{a}}{P_{p}}\) where rho is bounded by, but inclusive of 0 and 1. Since this ratio is wavelength dependent, rho is a polynomial, which is expressed as a function of wavelength. For example: \(\rho(\lambda) =\sum\limits_{i=0}^{i=2} K_{i}\centerdot\lambda^i\), can be provided as \(K_{0}, K_{1}, K_{2}\).
\(\alpha = \frac{A_{a}}{A_{p}}\) where alpha is bounded by, but inclusive of 0 and 1. Since this ratio is wavelength dependent, alpha is a polynomial, which is expressed as a function of wavelength. For example: \(\alpha(\lambda) =\sum\limits_{i=0}^{i=2} K_{i}\centerdot\lambda^i\), can be provided as \(K_{0}, K_{1}, K_{2}\).
Spin State Configurations¶
The algorithm expresses the order of the workspaces in the input and output groups in terms of spin states. These orders are specified using two properties:
Input Spin State Order: This property determines the order of the spin states in the input workspace group
'pp, pa, ap, aa'
Full polarization analysis (
'PA'
): both parallel, parallel-anti-parallel, anti-parallel-parallel, both anti-parallel. Four input workspaces are required. The spin states can be provided in any order and should match the order of the workspaces in the input group. The default order ispp, pa, ap, aa
.
'p, a'
Polarized Neutron Reflectivity (
'PNR'
): parallel, anti-parallel. Two input workspaces are required. The spin states can be provided in any order and should match the order of the workspaces in the input group. The default order isp, a
.
Output Spin State Order: This property determines the order of the spin states in the output workspace group. Similar to the input configuration, users can specify output spin states in any order.
Output from Full Polarization Analysis¶
The output of this algorithm is a :ref:WorkspaceGroup. The resulting :ref:WorkspaceGroup will have 4 entries, corresponding to the specified output spin state orders. If no specific output spin states are specified, it will be formatted as follows:
Entry in group |
Measurement |
---|---|
1 |
\(I_{pp}\) |
2 |
\(I_{pa}\) |
3 |
\(I_{ap}\) |
4 |
\(I_{aa}\) |
Output from Polarized Neutron Reflectivity¶
The output of this algorithm is a WorkspaceGroup. The resulting WorkspaceGroup will have 2 entries, corresponding to the specified output spin state orders. If no specific output spin states are specified, it will be formatted as follows:
Entry in group |
Measurement |
---|---|
1 |
\(I_{p}\) |
2 |
\(I_{a}\) |
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 - PolarizationCorrectionFredrikze (PNR)
# import mantid algorithms, numpy and matplotlib
from mantid.simpleapi import *
import matplotlib.pyplot as plt
import numpy as np
run = Load("POLREF00004699.nxs")
ws1 = CreateWorkspace([0.01, 17.0, 34.0], [50000, 50000])
eff = JoinISISPolarizationEfficiencies(Pp=ws1, Rho=ws1, Ap=ws1, Alpha=ws1)
run = ConvertUnits(run, "Wavelength")
eff = ConvertUnits(eff, "Wavelength")
eff = RebinToWorkspace(eff, run.getItem(0), True)
out = PolarizationCorrectionFredrikze(run, eff, "PNR", InputSpinStates="p, a", OutputSpinStates="p, a")
for i, orig in enumerate(run):
corrected = out[i]
y_idx = run[0].yIndexOfX(15.0)
ratio = corrected.readY(29)[y_idx] / orig.readY(29)[y_idx]
print(f"Ratio of corrected {corrected.name()} and original {orig.name()} intensity at 15A: {round(ratio, 4)}")
Output:
Ratio of corrected out_1 and original run_1 intensity at 15A: 1.0005
Ratio of corrected out_2 and original run_2 intensity at 15A: 0.9508
Example - PolarizationCorrectionFredrikze (PA)
from mantid.simpleapi import *
import matplotlib.pyplot as plt
import numpy as np
run1 = Load("POLREF00004699.nxs")
run2 = run1 * 1.2
run = GroupWorkspaces([run1, run2])
ws1 = CreateWorkspace([0.01, 17.0, 34.0], [50000, 50000])
eff = JoinISISPolarizationEfficiencies(Pp=ws1, Rho=ws1, Ap=ws1, Alpha=ws1)
run = ConvertUnits(run, "Wavelength")
eff = ConvertUnits(eff, "Wavelength")
eff = RebinToWorkspace(eff, run.getItem(0), True)
out = PolarizationCorrectionFredrikze(run, eff, "PA", InputSpinStates="pp, pa, ap, aa", OutputSpinStates="pp, pa, ap, aa")
for i, orig in enumerate(run):
corrected = out[i]
y_idx = run[0].yIndexOfX(15.0)
ratio = corrected.readY(29)[y_idx] / orig.readY(29)[y_idx]
print(f"Ratio of corrected {corrected.name()} and original {orig.name()} intensity at 15A: {round(ratio, 4)}")
Ratio of corrected out_1 and original run1_1 intensity at 15A: 1.0025
Ratio of corrected out_2 and original run1_2 intensity at 15A: 0.9527
Ratio of corrected out_3 and original run2_1 intensity at 15A: 0.8355
Ratio of corrected out_4 and original run2_2 intensity at 15A: 0.794
References¶
Categories: AlgorithmIndex | Reflectometry
Source¶
C++ header: PolarizationCorrectionFredrikze.h
C++ source: PolarizationCorrectionFredrikze.cpp