EstimateMuonAsymmetryFromCounts v1

../_images/EstimateMuonAsymmetryFromCounts-v1_dlg.png

EstimateMuonAsymmetryFromCounts dialog.

Summary

This algorithm gives an estimate for the asymmetry.

Properties

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.

Description

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:

\textrm{NewData} = (\textrm{OldData}\times e^\frac{t}{\tau})/(F N_0) - 1.0,

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

N_0= \frac{\Delta t\sum_j(\textrm{OldData}_j)}{\tau F \left( \exp(-\frac{t_0}{\tau})-\exp(-\frac{t_N}{\tau})\right)  },

where the summation only includes the data with times bewtween t_0 and t_N and \Delta t is the time step.

Usage

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.45', '0.31', '-0.31', '-0.78', '-0.83']
Unnormalized:  ['15.76', '37.28', '19.59', '6.18', '4.87']
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.21', '0.86', '-0.02', '-0.69', '-0.76']
Normalization constant: 20.00

Categories: AlgorithmIndex | Muon

Source

C++ source: EstimateMuonAsymmetryFromCounts.cpp (last modified: 2019-07-17)

C++ header: EstimateMuonAsymmetryFromCounts.h (last modified: 2019-10-28)