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

MaskBinsFromTable v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Mask bins from a table workspace.

See Also

MaskBins

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

Input Workspace to mask bins.

OutputWorkspace

Output

MatrixWorkspace

Mandatory

Output Workspace with bins masked.

MaskingInformation

Input

TableWorkspace

Mandatory

Input TableWorkspace containing parameters, XMin and XMax and either SpectraList or DetectorIDsList

Description

Masks bins in a workspace. The user specified masking parameters, such as spectra, xmin and xmax are given via a TableWorkspace.

It calls algorithm MaskBins underneath. If DetectorIDsList column exists it will convert this list to a list of spectra before calling MaskBins.

The table may have several rows, in which case it calls Maskbins for each row.

Usage

Masking of a small workspace

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

# Create table workspace with masking information in it
mask_info = CreateEmptyTableWorkspace()
mask_info.addColumn("str", "SpectraList")
mask_info.addColumn("double", "XMin")
mask_info.addColumn("double", "XMax")
mask_info.addRow(["", 16.0, 32.0]) # 1st mask: SpectraList=ALL, Xmin=16, XMax=32
mask_info.addRow(["", 71.5, 79.0]) # 2nd mask: SpectraList=ALL, Xmin=71.5, XMax=79


# Mask a range of X-values
wsMasked = MaskBinsFromTable(ws,MaskingInformation=mask_info)

# Show Y values in workspaces
print("Before masking: {}".format(ws.readY(0)))
print("After masking: {}".format(wsMasked.readY(0)))

Output:

Before masking: [  0.3   0.3   0.3   0.3   0.3  10.3   0.3   0.3   0.3   0.3]
After masking: [  0.3   0.    0.    0.    0.3  10.3   0.3   0.    0.3   0.3]

Source

C++ header: MaskBinsFromTable.h

C++ source: MaskBinsFromTable.cpp