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

CreatePeaksWorkspace v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Create an empty PeaksWorkspace.

See Also

SortPeaksWorkspace

Properties

Name

Direction

Type

Default

Description

InstrumentWorkspace

Input

Workspace

An optional input workspace containing the default instrument for peaks in this workspace.

NumberOfPeaks

Input

number

1

Number of dummy peaks to initially create.

OutputWorkspace

Output

IPeaksWorkspace

Mandatory

An output workspace.

OutputType

Input

string

Peak

Output peak workspace type, default to full peak workspace. Allowed values: [‘Peak’, ‘LeanElasticPeak’]

Description

This algorithm can be used to create a:

Use LoadIsawPeaks v1 or FindPeaksMD v1 to create a peaks workspace with peaks.

This workspace can serve as a starting point for modifying the PeaksWorkspace, using the GUI or python scripting, for example.

If the input workspace is a MDWorkspace then the instrument from the first experiment info is used.

Usage

Example: An empty table, not tied to an instrument

ws = CreatePeaksWorkspace()
print("Created a {} with {} rows".format(ws.id(), ws.rowCount()))

Output:

Created a PeaksWorkspace with 0 rows

Example: Create an empty LeanElasticPeaksWorkspace, not tied to an instrument

ws = CreatePeaksWorkspace(NumberOfPeaks=0, OutputType="LeanElasticPeak")
print("Created a {} with {} rows".format(ws.id(), ws.rowCount()))

Output:

Created a LeanElasticPeaksWorkspace with 0 rows

Example: With a few peaks in place

sampleWs = CreateSampleWorkspace()
ws = CreatePeaksWorkspace(InstrumentWorkspace=sampleWs,NumberOfPeaks=3)
print("Created a {} with {} rows".format(ws.id(), ws.rowCount()))

Output:

Created a PeaksWorkspace with 3 rows

Categories: AlgorithmIndex | Crystal\Peaks | Utility\Workspaces

Source

C++ header: CreatePeaksWorkspace.h

C++ source: CreatePeaksWorkspace.cpp