\(\renewcommand\AA{\unicode{x212B}}\)

MaxMin v1

Summary

Takes a 2D workspace as input and find the maximum (minimum) in each 1D spectrum.

See Also

Max, Min

Properties

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)

Description

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.

Usage

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

Source

C++ header: MaxMin.h

C++ source: MaxMin.cpp