Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | IMDHistoWorkspace | Mandatory | An input workspace. |
Condition | Input | string | Less Than | Selected threshold condition. Any value which does meet this condition with respect to the ReferenceValue will be overwritten. Allowed values: [‘Less Than’, ‘Greater Than’] |
ReferenceValue | Input | number | 0 | Comparator value used by the Condition. |
OverwriteWithZero | Input | boolean | True | Flag for enabling overwriting with a custom value. Defaults to overwrite signals with zeros. |
CustomOverwriteValue | Input | number | 0 | Custom overwrite value for the signal. Defaults to zero. |
OutputWorkspace | Output | IMDHistoWorkspace | Mandatory | Output thresholded workspace. |
This algorithm applies a simple linear transformation to a MDWorkspace or MDHistoWorkspace. This could be used, for example, to scale the Energy dimension to different units.
Each coordinate is tranformed so that where:
You can specify either a single value for Scaling and Offset, in which case the same m_scaling or m_offset are applied to each dimension; or you can specify a list with one entry for each dimension.
The relationship between the workspace and the original MDWorkspace, for example when the MDHistoWorkspace is the result of BinMD v1, is lost. This means that you cannot re-bin a transformed MDHistoWorkspace.
No units are not modified by this algorithm.
Example - Threshold a small workspace:
# Create input workspace
CreateMDWorkspace(Dimensions=3, Extents='-10,10,-10,10,-10,10', Names='A,B,C', Units='U,U,U', OutputWorkspace='demo')
FakeMDEventData(InputWorkspace='demo', PeakParams='32,0,0,0,1')
threshold_input = BinMD(InputWorkspace='demo', AlignedDim0='A,-2,2,4', AlignedDim1='B,-2,2,4', AlignedDim2='C,-2,2,4')
# Run the algorithm to set all values greater than 4 to zero
threshold_output = ThresholdMD(InputWorkspace='threshold_input', Condition='Greater Than', ReferenceValue=4)
# Print selection before and after
print "selected bins before threshold greater than 4",threshold_input.getSignalArray()[1,1]
print "same bins after threshold greater than 4",threshold_output.getSignalArray()[1,1]
Output:
selected bins before threshold greater than 4 [ 0. 4. 5. 0.]
same bins after threshold greater than 4 [ 0. 4. 0. 0.]
Categories: Algorithms | MDAlgorithms