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 is:
where (1) is the mean of the population and (2)
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: Algorithm Index | Utility\Calculation
C++ source: CalculateZscore.cpp (last modified: 2019-01-07)
C++ header: CalculateZscore.h (last modified: 2018-10-05)