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

Max v1

Summary

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

See Also

Min, MaxMin

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

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 1D workspace containing all maxima as well as their X boundaries and error. This is used in particular for single crystal as a quick way to find strong peaks.

Usage

# Create a workspace with two peaks in each spectrum
ws = CreateSampleWorkspace(Function='Multiple Peaks')
# Find the max values
max_ws = Max(ws)

# Check the returned values
print('Maximum found at bin [ {} , {} ], value {}'.format(max_ws.readX(0)[0], max_ws.readX(0)[1], max_ws.readY(0)[0]))
print('In original workspace')
print('Bounds of bin 30     [ {} , {} ], value {}'.format(ws.readX(0)[30], ws.readX(0)[31], ws.readY(0)[30]))

# Find another peak
max_ws = Max(ws,RangeLower = 7000)

# Check the returned values
print('Maximum found at bin [ {} , {} ], value {}'.format(max_ws.readX(0)[0], max_ws.readX(0)[1], max_ws.readY(0)[0]))
print('In original workspace')
print('Bounds of bin 60     [ {} , {} ], value {}'.format(ws.readX(0)[60], ws.readX(0)[61], ws.readY(0)[60]))

Output

Maximum found at bin [ 6000.0 , 6200.0 ], value 10.3
In original workspace
Bounds of bin 30     [ 6000.0 , 6200.0 ], value 10.3
Maximum found at bin [ 12000.0 , 12200.0 ], value 8.3
In original workspace
Bounds of bin 60     [ 12000.0 , 12200.0 ], value 8.3

Categories: AlgorithmIndex | Arithmetic

Source

C++ header: Max.h

C++ source: Max.cpp