\(\renewcommand\AA{\unicode{x212B}}\)
MaskBins v1¶
Summary¶
Marks bins in a workspace as being masked.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
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’; |
|
OutputWorkspace |
Output |
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 |
Deprecated, use InputWorkspaceIndexSet. |
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: {}".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.3 0.3 0.3]
Source¶
C++ header: MaskBins.h
C++ source: MaskBins.cpp