\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MaskWorkspace | Mandatory | MaskWorkspace to be inverted. |
OutputWorkspace | Output | MaskWorkspace | AnonynmousOutput | MaskWorkspace has inverted bits from input MaskWorkspace. |
A NOT operation will be conducted on the input masking workspace (SpecialWorkspace2D).
Example - invert a POWGEN mask:
# Load data
maskws = LoadMask(Instrument="POWGEN_Definition_2015-08-01.xml",
InputFile="Mask-PG3-19884.xml")
# Check source mask workspace
nummasked = 0
for i in range(maskws.getNumberHistograms()):
if maskws.readY(i)[0] > 0.5:
nummasked += 1
# Invert mask
invmaskws = InvertMask(InputWorkspace=maskws)
# Check target mask workspace
nummasked2 = 0
for i in range(invmaskws.getNumberHistograms()):
if invmaskws.readY(i)[0] > 0.5:
nummasked2 += 1
# Print out
print("Number of histogram: {}".format(maskws.getNumberHistograms()))
print("Source Mask workspace # Detectors masked = {}".format(nummasked))
print("Source Mask workspace # Detectors masked = {}".format(nummasked2))
Output:
Number of histogram: 33418
Source Mask workspace # Detectors masked = 82
Source Mask workspace # Detectors masked = 33336
Categories: AlgorithmIndex | Transforms\Masking
C++ header: InvertMask.h (last modified: 2021-03-31)
C++ source: InvertMask.cpp (last modified: 2021-03-31)