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

PeaksInRegion v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Find peaks intersecting a box region.

See Also

PeaksOnSurface

Properties

Name

Direction

Type

Default

Description

CheckPeakExtents

Input

boolean

False

Include any peak in the region that has a shape extent extending into that region.

InputWorkspace

Input

PeaksWorkspace

Mandatory

An input peaks workspace.

CoordinateFrame

Input

string

Mandatory

What coordinate system to use for intersection criteria? DetectorSpace: Real-space coordinates. Q (lab frame): Wave-vector change of the lattice in the lab frame. Q (sample frame): Momentum in the sample frame. HKL. Allowed values: [‘Detector space’, ‘Q (lab frame)’, ‘Q (sample frame)’, ‘HKL’]

PeakRadius

Input

number

0

Effective peak radius in CoordinateFrame

OutputWorkspace

Output

TableWorkspace

Mandatory

An output table workspace. Two columns. Peak index into input workspace, and boolean, where true is for positive intersection.

Extents

Input

dbl list

-50,50

A comma separated list of min, max for each dimension, specifying the extents of each dimension. Optional, default +-50 in each dimension.

Description

Determines which peaks intersect a defined box region in either QLab, QSample or HKL space. Similar to PeaksOnSurface v1.

Usage

Example - Peaks inside and outside of a defined region

# Load an MDEventWorkspace (QLab) containing some SC diffration peaks
mdew = Load("TOPAZ_3680_5_sec_MDEW.nxs")
# Find some peaks. These are all unindexed so will have HKL = [0,0,0]
peaks = FindPeaksMD(InputWorkspace=mdew, MaxPeaks=1)

# Find peaks in region when the Peak sits in the centre of a box
in_box_table = PeaksInRegion(peaks, CoordinateFrame='HKL', PeakRadius=0.1, Extents=[-1.0,1.0,-1.0,1.0,-1.0,1.0], CheckPeakExtents=True)
print("{{'Distance': {Distance}, 'PeakIndex': {PeakIndex}, 'Intersecting': {Intersecting}}}".format(**in_box_table.row(0)))

# Find peaks in region when the peak is just outside the box (by radius)
just_outside_box_table = PeaksInRegion(peaks, CoordinateFrame='HKL', PeakRadius=0.999, Extents=[1.0,2.0,-1.0,1.0,-1.0,1.0], CheckPeakExtents=True)
print("{{'Distance': {Distance}, 'PeakIndex': {PeakIndex}, 'Intersecting': {Intersecting}}}".format(**just_outside_box_table.row(0)))

# Find peaks in region when the peak is just inside the box (by radius)
just_intersecting_box_table = PeaksInRegion(peaks, CoordinateFrame='HKL', PeakRadius=1.00, Extents=[1.0,2.0,-1.0,1.0,-1.0,1.0], CheckPeakExtents=True)
print("{{'Distance': {Distance}, 'PeakIndex': {PeakIndex}, 'Intersecting': {Intersecting}}}".format(**just_intersecting_box_table.row(0)))

Output:

{'Distance': 0.0, 'PeakIndex': 0, 'Intersecting': True}
{'Distance': -1.0, 'PeakIndex': 0, 'Intersecting': False}
{'Distance': -1.0, 'PeakIndex': 0, 'Intersecting': True}

Categories: AlgorithmIndex | Crystal\Peaks

Source

C++ header: PeaksInRegion.h

C++ source: PeaksInRegion.cpp