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

AddPeak v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Adds a peak to a PeaksWorkspace.

See Also

AddPeakHKL, CalculatePeaksHKL

Properties

Name

Direction

Type

Default

Description

PeaksWorkspace

InOut

PeaksWorkspace

Mandatory

A peaks workspace.

RunWorkspace

Input

MatrixWorkspace

Mandatory

An input workspace containing the run information.

TOF

Input

number

0

Peak position in time of flight.

DetectorID

Input

number

0

ID of a detector at the peak centre.

Height

Input

number

0

Height of the peak.

BinCount

Input

number

0

Bin count.

Description

Adds a peak to a PeaksWorkspace.

Usage

Example - Add a peak to a PeaksWorkspace.

ws = CreateSampleWorkspace("Histogram","Multiple Peaks")
# Find the peaks in a 2D workspace.
peaks_ws = FindSXPeaks(ws)

print("The number of peaks before adding a peak is: {}".format(peaks_ws.getNumberPeaks()))
# Add a peak to the peaks workspace.
AddPeak(PeaksWorkspace=peaks_ws,RunWorkspace=ws,DetectorID=101,TOF=3819,Height=10.3,BinCount=2)

print("The number of peaks after adding a peak is: {}".format(peaks_ws.getNumberPeaks()))

Output:

The number of peaks before adding a peak is: 174
The number of peaks after adding a peak is: 175

Categories: AlgorithmIndex | Crystal\Peaks

Source

C++ header: AddPeak.h

C++ source: AddPeak.cpp