MaskBins v1

../_images/MaskBins-v1_dlg.png

MaskBins dialog.

Summary

Marks bins in a workspace as being masked.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory The name of the input workspace. Must contain histogram data.
OutputWorkspace Output MatrixWorkspace Mandatory The name of the Workspace containing the masked bins.
XMin Input number Mandatory The value to start masking from.
XMax Input number Mandatory The value to end masking at.
SpectraList Input int list   Optional: A list of individual which spectra to mask (specified using the workspace index). If not set, all spectra are masked. Can be entered as a comma-seperated list of values, or a range (such as ‘a-b’ which will include spectra with workspace index of a to b inclusively).

Description

Masks bins in a workspace. Masked bins should properly be regarded as having been completely removed from the workspace. Bins falling within the range given (even partially) are masked, i.e. their data and error values are set to zero and the bin is added to the list of masked bins. This range is masked for all spectra in the workspace (though the workspace does not have to have common X values in all spectra).

At present, although the zeroing of data will obviously be ‘seen’ by all downstream algorithms. Only DiffractionFocussing v2 (version 2) and Q1D v2 have been modified to take account of masking. Several algorithms (e.g. Rebin v1, CropWorkspace v1) have been modified to properly propagate the masking.

Usage

Masking of a small workspace

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

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

# Show Y values in workspaces
print "Before masking:", ws.readY(0)
print "After masking:",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.3   0.3   0.3]

Source

C++ source: MaskBins.cpp

C++ header: MaskBins.h