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

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 Operator to compare to given values. Allowed values: [‘Equal’, ‘NotEqual’, ‘Greater’, ‘GreaterEqual’, ‘Less’, ‘LessEqual’, ‘NotFinite’]
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 each bin in each spectrum, and will select (or deselect) it is any of the bins match the test. 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 will clear the data in the spectra under question. Unmasking will just clear the masking flag but will not restore the data.

Note

If you select the NotFinite operator, the value property is ignored. This operator finds values that are infinite or NaN.

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