Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | An input workspace. |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | An output workspace. |
This algorithm calculates the weighted mean from all the spectra in a given workspace. Monitors and masked spectra are ignored. Also, individual bins with IEEE values will be excluded from the result. The weighted mean calculated by the following:
and the variance is calculated by:
dataX = range(1,13)
dataY = range(1,12)
dataE = range(1,12)
ws = CreateWorkspace(dataX, dataY, dataE)
ws1 = WeightedMeanOfWorkspace(ws)
print("Weighted Mean of Workspace: {}".format(str(ws1.readY(0))))
print("Weighted Mean Error of Workspace: {}".format(str(ws1.readE(0))))
Output:
Weighted Mean of Workspace: [ 1.93826376]
Weighted Mean Error of Workspace: [ 1.2482116]
Categories: Algorithms | Arithmetic
C++ source: WeightedMeanOfWorkspace.cpp (last modified: 2016-10-12)
C++ header: WeightedMeanOfWorkspace.h (last modified: 2016-06-13)