\(\renewcommand\AA{\unicode{x212B}}\)
PoissonErrors v1¶
Summary¶
Calculates the gaussian approxiamtion of Poisson error based on a matching workspace containing the original counts.
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
Mandatory |
The name of the input workspace on the left hand side of the operation |
|
CountsWorkspace |
Input |
Mandatory |
The name of the input workspace on the right hand side of the operation |
|
OutputWorkspace |
Output |
Mandatory |
The name to call the output workspace |
|
AllowDifferentNumberSpectra |
Input |
boolean |
False |
Are workspaces with different number of spectra allowed? For example, the LHSWorkspace might have one spectrum per detector, but the RHSWorkspace could have its spectra averaged per bank. If true, then matching between the LHS and RHS spectra is performed (all detectors in a LHS spectrum have to be in the corresponding RHS) in order to apply the RHS spectrum to the LHS. |
ClearRHSWorkspace |
Input |
boolean |
False |
For EventWorkspaces only. This will clear out event lists from the RHS workspace as the binary operation is applied. This can prevent excessive memory use, e.g. when subtracting an EventWorkspace from another: memory use will be approximately constant instead of increasing by 50%. At completion, the RHS workspace will be empty. |
Description¶
Takes a Data workspace and an original counts workspace as input and updates the error values in the data workspace to be the same fractionally as the counts workspace. The number of histograms, the binning and units of the two workspaces must match.
Usage¶
Example - Perform basic error correction
# create histogram workspaces
dataX1 = [0,1,2,3,4,5,6,7,8,9] # or use dataX1=range(0,10)
dataY1 = [0,1,2,3,4,5,6,7,8] # or use dataY1=range(0,9)
dataE1 = [1,1,1,1,1,1,1,1,1] # or use dataE1=[1]*9
dataX2 = [1,1,1,1,1,1,1,1,1,1]
dataY2 = [2,2,2,2,2,2,2,2,2]
dataE2 = [3,3,3,3,3,3,3,3,3]
ws1 = CreateWorkspace(dataX1, dataY1, dataE1)
ws2 = CreateWorkspace(dataX2, dataY2, dataE2)
# perform the algorithm
ws = PoissonErrors(ws1, ws2)
#X-values aren't touched at all, Y-Values are used but not altered, E-Values are 0 if rhsY is 0 or (rhsE/rhsY)*lshY if they are non-zero
print("The X values are: " + str(ws.readX(0)))
print("The Y values are: " + str(ws.readY(0)))
print("The updated Error values are: " + str(ws.readE(0)))
Output:
The X values are: [0. 1. 2. 3. 4. 5. 6. 7. 8. 9.]
The Y values are: [0. 1. 2. 3. 4. 5. 6. 7. 8.]
The updated Error values are: [ 0. 1.5 3. 4.5 6. 7.5 9. 10.5 12. ]
Categories: AlgorithmIndex | SANS | Arithmetic\Errors
Source¶
C++ header: PoissonErrors.h
C++ source: PoissonErrors.cpp