\(\renewcommand\AA{\unicode{x212B}}\)
HeliumAnalyserEfficiency v1¶
Summary¶
Calculates the efficiency of a He3 analyser.
Properties¶
Name |
Direction |
Type |
Default |
Description |
|---|---|---|---|---|
InputWorkspaces |
Input |
str list |
Mandatory |
List of Polarized Transmission Group Workspaces. Each item on the list must be a workspace group with 4 members, each one representing a spin state. |
SpinStates |
Input |
string |
Mandatory |
Order of individual spin configurations in the input group workspaces, e.g. “01,11,00,10”, it is assumed that all input workspaces have the same spin order. |
PXD |
Input |
number |
12 |
Gas pressure in bar multiplied by cell length in metres |
PXDError |
Input |
number |
0 |
Error in gas pressure (p x d) |
DecayTimeInitial |
Input |
number |
54 |
Initial decay time for He3 Polarization decay fit |
H3PolarizationInitial |
Input |
number |
0.6 |
Initial polarization for He3 Polarization decay fit |
StartX |
Input |
number |
1.75 |
Lower boundary of wavelength range to use for fitting helium polarization |
EndX |
Input |
number |
8 |
Upper boundary of wavelength range to use for fitting helium polarization |
IgnoreFitQualityError |
Input |
boolean |
False |
Whether the algorithm should ignore a poor chi-squared (fit cost value) of greater than 1 and therefore not throw an error |
OutputWorkspace |
Output |
WorkspaceGroup |
Mandatory |
Helium analyzer efficiency as a function of wavelength |
OutputFitCurves |
Output |
WorkspaceGroup |
A group workspace containing the fit curves. |
|
OutputFitParameters |
Output |
A table workspace containing the fit parameters. |
Description¶
Takes a set of normalised polarized transmission runs as group workspaces. For each transmission run:
Calculates the analyzer cell efficiency (\(\epsilon_{cell}\)) by looking at the polarization from the wanted \(T_{para}\) and unwanted \(T_{anti}\) spin states
Extracts the polarization of the Helium gas (\(p_{He}\)) from a fit to : \(\epsilon_{cell}=\frac{1}{2}\big(1+\tanh(\mu p_{He})\big)\)
Extract the timestamp at which the transmission measurement was realized
Once polarizations and timestamps for all the input transmission runs are retrieved, the decay parameter (\(\Gamma\)) and initial polarization (\(p_{He_{0}}\)) are extracted from a fit to: \(p_{He}(t)=p_{He_{0}}(t) e^{-t/\Gamma}\)
Each of the input workspaces must be a group of four single spectrum histogram workspaces, each
representing the transmission of a known spin state as specified by the SpinStates property.
Efficiency and Polarization of Helium gas¶
If the transmission of the wanted spin state is \(T_{para}\), and the transmission of the unwanted spin state is \(T_{anti}\), then the polarization of an unpolarized incoming beam after the analyser cell, \(P_{cell}\) is given by [1]
The efficiency of the analyser cell is given by
Where the polarization is \(p_{He}\) and \(\mu\) is the opacity of the cell, defined as : \(\mu=0.0733pd\lambda\). Where \(pd\) is the mean gas length that can be computed in DepolarizedAnalyserTransmission v1 algorithm, and \(\lambda\) is the wavelength of each bin.
With the four periods in each input workspace being \(T_{00}, T_{01}, T_{10}, T_{11}\), and the subscript denoting the spin configuration, then \(T_{para} = T_{00} + T_{11}\) and \(T_{anti} = T_{01} + T_{10}\), and we can calculate \(\epsilon_{cell}\) from the above equation. We fit \(\frac{1 + \tanh(0.0733pd\lambda p_{He})}{2}\) to our calculated \(\epsilon_{cell}\) to give us \(p_{He}\).
To calculate the error, \(\sigma_{\epsilon_{cell}}\), we need the error on \(p_{He}\), \(\sigma_{p_{He}}\), and
the error of \(pd\), \(\sigma_{pd}\), given by PXDError. The covariance between \(pd\) and \(p_{He}\)
is assumed to be zero. Then the error \(\sigma_{\epsilon_{cell}}\) is given by
where \(mu = 0.0733 * pd\) and \(\sigma_{\lambda}\) is the width of the wavelength bin.
If \(n_b\) is the number of histogram bins used in the fit, then define \(n := n_b-1\), since we are fitting one parameter (\(p_{He}\)). Then the factor \(t_{crit}\) follows a \(t\) distribution with \(n\) degrees of freedom, and probability density function \(f_t(x,n)\). For a standard 68.3% (1-sigma) error the factor \(t_{crit}\) is given by the solution to
As the number of histogram bins used in the fit increases, \(t_{crit} \rightarrow 1\).
Helium Polarization Decay¶
After the polarizations are extracted from the transmission data {\(p_{He}\)}, the timestamp at which each run occurred as well as the difference in time between the input runs is extracted using the TimeDifference v1 algorithm, then the polarizations and times are fit to an exponential decay curve:
From this fit, the decay time \(\Gamma\) and initial polarization \(p_{He_{0}}\) are obtained. These parameters can be used in HeliumAnalyserEfficiency v1 algorithm to retrieve the efficiency of the fitted helium cell at an arbitrary time.
Outputs¶
Up to three distinct outputs can be retrieved from this algorithm:
OutputWorkspace: Efficiencies. A group workspace of MatrixWorkspaces with the calculated analytical efficiencies for each input transmission run.
OutputCurves: A group workspace of MatrixWorkspaces with the fitted curves from both the polarization of helium fit (suffix He3_Polarization_curves) and the decay in polarization fit(suffix decay_curves).
OutputParameters: A TableWorkspace with the parameters from both the polarization of helium fit and the decay in polarization fit.
If only one input group is set on the InputWorkspaces property, the algorithm will not do a Polarization Decay fit, and the output will only be the efficiency of the group and the results from the Helium Gas Polarization fit.
Usage¶
Example - Calculate Analyser Polarization Decay
from mantid.api import mtd
from mantid.kernel import DateAndTime
import numpy as np
def createWorkspaceWithTime(x,y,name,delay):
CreateWorkspace(DataX = x, DataY = y, OutputWorkspace = name, UnitX = 'Wavelength')
run = mtd[name].getRun()
start = np.datetime64("2025-07-01T08:00:00")
run.setStartAndEndTime(DateAndTime(str(start+int(3600*delay))), DateAndTime(str(start+int(3600*(delay+1)))))
ConvertToHistogram(InputWorkspace = name, OutputWorkspace = name)
groups = []
tau = 45
polIni = 0.6
delays = np.linspace(0,20,3)
lam = np.linspace(1.75,8,10)
mu = 0.0733 * 12 * lam
phe = polIni * np.exp(-delays/tau)
for n, delay in enumerate(delays):
ynsf = np.exp(- mu * (1-phe[n]))
ysf = np.exp(-mu * (1 + phe[n]))
names = [name + f"_{n}" for name in ["T00", "T11", "T01", "T10"]]
[createWorkspaceWithTime(lam, ynsf, name, delay) for name in names[:2]]
[createWorkspaceWithTime(lam, ysf, name, delay) for name in names[2:]]
groups.append(f"group_{n}")
GroupWorkspaces(InputWorkspaces = names, OutputWorkspace = groups[-1])
out, curves, table = HeliumAnalyserEfficiency(InputWorkspaces=groups,
SpinStates = "00,11,01,10")
p1 = mtd['table'].column(1)[0:3]
p0, tau = mtd['table'].column(1)[4:-1]
print(f"Polarizations at delay times are {p1[0]:.2f}, {p1[1]:.2f}, {p1[2]:.2f}")
print(f"Initial He3 Polarization is {p0:.2f}")
print(f"Polarization decay time is {tau:.2f}")
Output:
Polarizations at delay times are 0.60, 0.48, 0.38
Initial He3 Polarization is 0.60
Polarization decay time is 45.00
References¶
Categories: AlgorithmIndex | SANS\PolarizationCorrections
Source¶
C++ header: HeliumAnalyserEfficiency.h
C++ source: HeliumAnalyserEfficiency.cpp