Skip to content
Snippets Groups Projects
Commit 3327e2c7 authored by Arturs Bekasovs's avatar Arturs Bekasovs
Browse files

Refs #9568. RemoveExpDecay

parent 4d6af782
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,7 @@ void MuonRemoveExpDecay::init() ...@@ -33,7 +33,7 @@ void MuonRemoveExpDecay::init()
declareProperty(new API::WorkspaceProperty<API::MatrixWorkspace>("OutputWorkspace", "", declareProperty(new API::WorkspaceProperty<API::MatrixWorkspace>("OutputWorkspace", "",
Direction::Output), "The name of the output 2D workspace."); Direction::Output), "The name of the output 2D workspace.");
std::vector<int> empty; std::vector<int> empty;
declareProperty(new Kernel::ArrayProperty<int>("Spectra", empty), "The workspace indeces to remove the exponential decay from."); declareProperty(new Kernel::ArrayProperty<int>("Spectra", empty), "The workspace indices to remove the exponential decay from.");
} }
/** Executes the algorithm /** Executes the algorithm
......
...@@ -16,7 +16,42 @@ The formula for removing the exponential decay is given by: ...@@ -16,7 +16,42 @@ The formula for removing the exponential decay is given by:
.. math:: NewData = (OldData\times{e^\frac{t}{\tau}})/N_0 - 1.0 .. math:: NewData = (OldData\times{e^\frac{t}{\tau}})/N_0 - 1.0
where τ is the muon lifetime (2.197019e-6 seconds). :math:`N_0` is a where :math:`\tau` is the muon lifetime (2.197019e-6 seconds). :math:`N_0` is a
fitted normalisation constant. fitted normalisation constant.
Usage
-----
.. include:: ../usagedata-note.txt
**Example - Removing exponential decay from a MUSR run:**
.. testcode:: ExMUSR
# Load first period of a MUSR run
input = LoadMuonNexus('MUSR0015189.nxs', EntryNumber=1)
# Remove uninteresting bins
input = CropWorkspace('input', XMin=0.55, XMax=12)
# Remove exp. decay
output = RemoveExpDecay('input')
# Bins to compare
bins_to_compare = [0, 150, 300, 450, 600]
# Get values before&after and format them as strings for output
init_values = ["{:.3f}".format(input.readY(0)[bin]) for bin in bins_to_compare]
exp_dec_removed = ["{:.3f}".format(output.readY(0)[bin]) for bin in bins_to_compare]
print "Initial values", ", ".join(init_values)
print "Exp. decay removed:", ", ".join(exp_dec_removed)
Output:
.. testoutput:: ExMUSR
Initial values 49.000, 17.000, 2.000, 3.000, 0.000
Exp. decay removed: 0.090, 0.127, -0.605, 0.768, -0.824
.. categories:: .. categories::
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment