Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | The name of the Workspace2D to take as input |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | The name of the workspace in which to store the result |
ShowMin | Input | boolean | False | Flag to show minimum instead of maximum (default=false) |
RangeLower | Input | number | Optional | The X value to search from (default min) |
RangeUpper | Input | number | Optional | The X value to search to (default max) |
StartWorkspaceIndex | Input | number | 0 | Start spectrum number (default 0) |
EndWorkspaceIndex | Input | number | Optional | End spectrum number (default max) |
The algorithm creates a new 2D workspace containing the first maxima (minima) for each spectrum, as well as their X boundaries and error. This is used in particular for single crystal as a quick way to find strong peaks. By default, the algorithm returns the maxima.
The Max v1 and Min v1 algorithms are just calls to the MaxMin v1 algorithm, with the ShowMin flag set to true/false respectively.
Example - Get maximum values for 9 spectra
# Create a workspace with 9 spectra each with 10 values of with the maximum is 10.3 for each spectrum
ws = CreateSampleWorkspace("Histogram", NumBanks=1, BankPixelWidth=3, BinWidth=10, Xmax=100)
# Run algorithm
wsMax = MaxMin (ws)
print("Maximum of each spectrum")
for i in range(9):
print(wsMax.readY(i))
Output:
Maximum of each spectrum
[ 10.3]
[ 10.3]
[ 10.3]
[ 10.3]
[ 10.3]
[ 10.3]
[ 10.3]
[ 10.3]
[ 10.3]
Example - Get minimum values for 9 spectra
# Create a workspace with 9 spectra each with 10 values of with the minimum is 0.3 for each spectrum
ws = CreateSampleWorkspace("Histogram", NumBanks=1, BankPixelWidth=3, BinWidth=10, Xmax=100)
# Run algorithm
wsMax = MaxMin (ws, ShowMin=True)
print("Minimum of each spectrum")
for i in range(9):
print(wsMax.readY(i))
Output:
Minimum of each spectrum
[ 0.3]
[ 0.3]
[ 0.3]
[ 0.3]
[ 0.3]
[ 0.3]
[ 0.3]
[ 0.3]
[ 0.3]
Categories: AlgorithmIndex | Arithmetic
C++ source: MaxMin.cpp (last modified: 2019-08-27)
C++ header: MaxMin.h (last modified: 2018-10-05)