Table of Contents
The Power algorithm will raise the base workspace to a particular power. Corresponding error values will be created.
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | The name of the input workspace |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | The name to use for the output workspace (can be the same as the input one). |
Exponent | Input | number | 1 | The exponent with which to raise base values in the base workspace to. |
The algorithm will raise the InputWorkspace to the power of the Exponent. When acting on an event workspace, the output will be a Workspace2D, with the default binning from the original workspace.
Example - Square each Y value:
# Create a 2 spectrum workspace with Y values 1->8
dataX = [0,1,2,3,4,
0,1,2,3,4]
dataY = [1,2,3,4,
5,6,7,8]
data_ws = CreateWorkspace(dataX, dataY, NSpec=2)
result_ws = Power(data_ws, 2)
print "Squared values of first spectrum:", result_ws.readY(0)
print "Squared values of second spectrum:", result_ws.readY(1)
Output:
Squared values of first spectrum: [ 1. 4. 9. 16.]
Squared values of second spectrum: [ 25. 36. 49. 64.]
Categories: Algorithms | Arithmetic