\(\renewcommand\AA{\unicode{x212B}}\)
CalculateZscore v1¶
Summary¶
Calculate Zscore for Y and E of MatrixWorkspace.
Properties¶
Name 
Direction 
Type 
Default 
Description 

InputWorkspace 
Input 
Mandatory 
Name of input MatrixWorkspace to have Zscore calculated. 

OutputWorkspace 
Output 
Mandatory 
Name of the output Workspace2D containing the Zscores. 

WorkspaceIndex 
Input 
number 
Optional 
Index of the spetrum to have Zscore calculated. Default is to calculate for all spectra. 
Description¶
Calculate Zscore of a spectrum in a given workspace.
Definition of Zscore¶
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.
Usage¶
Example  calculate Zscore 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 Zscores are: {}".format(ws2.readY(0)))
Output:
The Zscores are: [ 0.11618485 0.04647394 1.78924674 0.11618485 2.39340797 0.11618485
0.11618485 0.02323697 0.11618485]
Categories: AlgorithmIndex  Utility\Calculation
Source¶
C++ header: CalculateZscore.h
C++ source: CalculateZscore.cpp