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

MaskSpectra v1

Summary

Mask (zero) spectra and the underlying detectors in a workspace.

See Also

MaskDetectors

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

The input workspace

InputWorkspaceIndexType

Input

string

The type of indices in the optional index set; For optimal performance WorkspaceIndex should be preferred;. Allowed values: [‘WorkspaceIndex’, ‘SpectrumNumber’]

InputWorkspaceIndexSet

Input

long list

An optional set of spectra that will be processed by the algorithm; If not set, all spectra will be processed; The indices in this list can be workspace indices or possibly spectrum numbers, depending on the selection made for the index type; Indices are entered as a comma-separated list of values, and/or ranges; For example, ‘4,6,10-20,1000’;

OutputWorkspace

Output

MatrixWorkspace

Mandatory

Name of the output workspace

Description

Mask (zero) spectra and the underlying detectors in a workspace. If a spectrum corresponds to more than one detector, all detectors are masked.

Usage

Example - MaskSpectra

ws = CreateWorkspace(OutputWorkspace='ws', DataX='1,1', DataY='2,2', NSpec=2)
masked = MaskSpectra(InputWorkspace=ws, InputWorkspaceIndexType='WorkspaceIndex', InputWorkspaceIndexSet='1')
print('Spectrum 0 before {} after {}'.format(ws.readY(0)[0], masked.readY(0)[0]))
print('Spectrum 1 before {} after {}'.format(ws.readY(1)[0], masked.readY(1)[0]))

Output:

Spectrum 0 before 2.0 after 2.0
Spectrum 1 before 2.0 after 0.0

Categories: AlgorithmIndex | Transforms\Masking

Source

C++ header: MaskSpectra.h

C++ source: MaskSpectra.cpp