MaskDetectorsIf v1

../_images/MaskDetectorsIf-v1_dlg.png

MaskDetectorsIf dialog.

Summary

Masks detectors depending on the values in the input workspace.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory A 1D Workspace that contains values to select against
Mode Input string SelectIf Mode to select or deselect detectors based on comparison with values. Allowed values: [‘SelectIf’, ‘DeselectIf’]
Operator Input string Equal Unary operator to compare to given values. Allowed values: [‘Equal’, ‘NotEqual’, ‘Greater’, ‘GreaterEqual’, ‘Less’, ‘LessEqual’]
Value Input number 0  
InputCalFile Input string   The name of the CalFile with grouping data. Allowed extensions: [‘.cal’]
OutputCalFile Input string   The name of the CalFile with grouping data. Allowed extensions: [‘.cal’]
OutputWorkspace Output MatrixWorkspace   The masked workspace.

Description

Iterates over the input workspace evaluating the test for the first bin in each spectrum. There are two output modes:

Output to a calfile
For this mode the properties InputCalFile and OutputCalFile have to be set. If the detectors should be masked it deselects all of the contributing detectors in the output calfile. All other aspects of the InputCalFile are copied over to the OutputCalFile.
Output to a workspace
For this mode the OutputWorkspace property has to be set. The algorithm masks the selected detectors (Mode='SelectIf') or unmasks deselected ones (Mode='DeselectIf') for the output workspace. Masking does not clear the data in the spectra under question. Use ClearMaskedSpectra to clear the masked data manually.

Usage

Example - mask spectra whose integral is below some limit

ws = CreateSampleWorkspace()
# One spectrum has lower counts than the rest
badIndex = 3
Ys = ws.dataY(badIndex)
Ys *= 0.01
integral = Integration(ws)
MaskDetectorsIf(integral, Operator='Less', Value=10., OutputWorkspace=integral)
MaskDetectors(ws, MaskedWorkspace=integral)
# Inspect the result
isMasked = ws.spectrumInfo().isMasked(badIndex)
print('Spectrum at index {} is masked? {}'.format(badIndex, isMasked))

Output:

Spectrum at index 3 is masked? True

Categories: AlgorithmIndex | Diffraction\Masking | Transforms\Masking

Source

C++ source: MaskDetectorsIf.cpp (last modified: 2019-06-05)

C++ header: MaskDetectorsIf.h (last modified: 2018-10-05)