\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | Name of input MatrixWorkspace to have Z-score calculated. |
OutputWorkspace | Output | Workspace2D | Name of the output Workspace2D containing the Z-scores. | |
WorkspaceIndex | Input | number | Optional | Index of the spetrum to have Z-score calculated. Default is to calculate for all spectra. |
Calculate Z-score of a spectrum in a given workspace.
The standard score of a raw score \(x\) is:
where (1) \(\mu\) is the mean of the population and (2) \(\sigma\) is the standard deviation of the population.
Example - calculate Z-score for a single spectrum workspace:
# create histogram workspace
dataX = [0,1,2,3,4,5,6,7,8,9]
dataY = [1,1.5,-11,1,19,1,1,2,1]
ws = CreateWorkspace(dataX, dataY)
# rebin from min to max with size bin = 2
ws2 = CalculateZscore(InputWorkspace=ws)
print("The Z-scores are: {}".format(ws2.readY(0)))
Output:
The Z-scores are: [ 0.11618485 0.04647394 1.78924674 0.11618485 2.39340797 0.11618485
0.11618485 0.02323697 0.11618485]
Categories: AlgorithmIndex | Utility\Calculation
C++ header: CalculateZscore.h (last modified: 2020-03-20)
C++ source: CalculateZscore.cpp (last modified: 2020-03-20)