\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | The name of the input 2D workspace. |
WorkspaceName | Input | string | The name used in the normalization table. If this is blank the InputWorkspace’s name will be used. | |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | The name of the output 2D workspace. |
OutputUnNormData | Input | boolean | False | If to output the data with just the exponential decay removed. |
OutputUnNormWorkspace | Output | MatrixWorkspace | unNormalisedData | The name of the output unnormalized workspace. |
Spectra | Input | int list | The workspace indices to remove the exponential decay from. | |
StartX | Input | number | 0.1 | The lower limit for calculating the asymmetry (an X value). |
EndX | Input | number | 15 | The upper limit for calculating the asymmetry (an X value). |
NormalizationIn | Input | number | 0 | If this value is non-zero then this is used for the normalization, instead of being estimated. |
NormalizationTable | InOut | TableWorkspace | Name of the table containing the normalizations for the asymmetries. |
If the NormalizationIn property is greater than zero, the algorithm will apply the user defined normalization to the data instead of calculating an estimate.
This algorithm estimates the asymmetry from the specified muon spectra. By default, all of the spectra in a workspace will be corrected.
The formula for estimating the asymmetry is given by:
where \(\tau\) is the muon lifetime (2.1969811e-6 seconds), \(F\) is the number of good frames and \(N_0\) is a fitted normalization constant. The normalization is given by
where the summation only includes the data with times bewtween \(t_0\) and \(t_N\) and \(\Delta t\) is the time step.
Example - Removing exponential decay:
import math
import numpy as np
tab = CreateEmptyTableWorkspace()
tab.addColumn('double', 'norm')
tab.addColumn('str', 'name')
tab.addColumn('str', 'method')
y = [100, 150, 50, 10, 5]
x = [1,2,3,4,5,6]
input = CreateWorkspace(x,y)
run = input.getRun()
run.addProperty("goodfrm","10","None",True)
output,unnorm=EstimateMuonAsymmetryFromCounts(InputWorkspace=input,spectra=0,NormalizationTable=tab,StartX=1,EndX=5,OutputUnNormData=True)
print("Asymmetry : {}".format(['{0:.2f}'.format(value) for value in output.readY(0)]))
print("Unnormalized: {}".format(['{0:.2f}'.format(value) for value in unnorm.readY(0)]))
print("Normalization constant: {0:.2f}".format(tab.column(0)[0]))
Output:
Asymmetry : ['-0.31', '0.64', '-0.14', '-0.73', '-0.79']
Unnormalized: ['19.79', '46.80', '24.59', '7.75', '6.11']
Normalization constant: 28.56
Example - Setting the normalization:
import math
import numpy as np
tab = CreateEmptyTableWorkspace()
tab.addColumn('double', 'norm')
tab.addColumn('str', 'name')
tab.addColumn('str', 'method')
y = [100, 150, 50, 10, 5]
x = [1,2,3,4,5,6]
input = CreateWorkspace(x,y)
run = input.getRun()
run.addProperty("goodfrm","10","None",True)
output=EstimateMuonAsymmetryFromCounts(InputWorkspace=input,spectra=0,NormalizationTable=tab,StartX=1,EndX=5,NormalizationIn=20.0)
print("Asymmetry: {}".format(['{0:.2f}'.format(value) for value in output.readY(0)]))
print("Normalization constant: {0:.2f}".format(tab.column(0)[0]))
Output:
Asymmetry: ['-0.01', '1.34', '0.23', '-0.61', '-0.69']
Normalization constant: 20.00
Categories: AlgorithmIndex | Muon
C++ header: EstimateMuonAsymmetryFromCounts.h (last modified: 2020-03-20)
C++ source: EstimateMuonAsymmetryFromCounts.cpp (last modified: 2020-03-20)