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

MaskBinsFromWorkspace v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Copies over masked bins from a workspace to another workspace.

See Also

MaskBinsFromTable

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

The name of the input workspace. Must contain histogram data.

InputWorkspaceIndexType

Input

string

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

InputWorkspaceIndexSet

Input

int 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’;

MaskedWorkspace

Input

MatrixWorkspace

Mandatory

The name of the workspaces containing masked bins to copy over. Must contain histogram data.

MaskedWorkspaceIndexType

Input

string

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

MaskedWorkspaceIndexSet

Input

int 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

The name of the Workspace containing the masked bins.

Description

Copy bin mask flags to a workspace from another workspace.

At present, the bin masks attached to the mask workspace’s 0th spectrum are applied to every spectrum in the input workspace.

Usage

Masking of a small workspace

# Create workspace with 10 bins of width 10
ws = CreateSampleWorkspace(BankPixelWidth=1, Xmax=100, BinWidth=10)
wsToMask = CreateSampleWorkspace(BankPixelWidth=1, XMax=100, BinWidth=10)

# Mask a range of X-values
wsMasked = MaskBins(wsToMask,XMin=16,XMax=32)

# Copy the masks over
copiedMasksWS = MaskBinsFromWorkspace(ws, wsMasked)

# Show Y values in workspaces, and the masked bin indices
print("After mask copying: {}".format(copiedMasksWS.readY(0)))
print("Masked bin indices: {}".format(copiedMasksWS.maskedBinsIndices(0)))

Output:

After mask copying: [  0.3   0.3   0.3   0.3   0.3  10.3   0.3   0.3   0.3   0.3]
Masked bin indices: [1,2,3]

Categories: AlgorithmIndex | Transforms\Masking

Source

C++ header: MaskBinsFromWorkspace.h

C++ source: MaskBinsFromWorkspace.cpp