Table of Contents
Load file containing masking information to a SpecialWorkspace2D (masking workspace). This algorithm is renamed from LoadMaskingFile.
Name | Direction | Type | Default | Description |
---|---|---|---|---|
Instrument | Input | string | Mandatory | The name of the instrument to apply the mask. |
InputFile | Input | string | Mandatory | Masking file for masking. Supported file format is XML and ISIS ASCII. Allowed extensions: [‘.xml’, ‘.msk’] |
OutputWorkspace | Output | MaskWorkspace | Output Masking Workspace |
This algorithm is used to load a masking file, which can be in XML format (defined later in this page) or old-styled calibration file.
Example 1:
<?xml version="1.0" encoding="UTF-8" ?>
<detector-masking>
<group>
<detids>3,34-44,47</detids>
<component>bank123</component>
<component>bank124</component>
</group>
</detector-masking>
Example 2:
1-3 62-64
65-67 126-128
129-131 190-192
193-195 254-256
257-259 318-320
321-323 382-384
385 387 446 448
... ...
All the integers in file of this format are spectrum IDs to mask. Two spectrum IDs with “-” in between indicate a continuous range of spectra to mask. It does not matter if there is any space between integer number and “-”. There is no restriction on how the line is structured. Be noticed that any line starting with a non-digit character, except space, will be treated as a comment line.
This algorithm loads masking file to a SpecialWorkspace2D/MaskWorkspace.
Supporting
* Component ID --> Detector IDs --> Workspace Indexes
* Detector ID --> Workspace Indexes
* Spectrum ID --> Workspace Indexes
Note
To run these usage examples please first download the usage data, and add these to your path. In MantidPlot this is done using Manage User Directories.
ws = Load('HYS_11092_event.nxs')
mask = LoadMask('HYS', 'HYS_mask.xml')
# To check if mask loaded, apply it
MaskDetectors(ws, MaskedWorkspace=mask)
# One can alternatively do
# ws.maskDetectors(MaskedWorkspace=mask)
# Check some pixels
print "Is detector 0 masked:", ws.getDetector(0).isMasked()
print "Is detector 6245 masked:", ws.getDetector(6245).isMasked()
print "Is detector 11464 masked:", ws.getDetector(11464).isMasked()
print "Is detector 17578 masked:", ws.getDetector(17578).isMasked()
print "Is detector 20475 masked:", ws.getDetector(20475).isMasked()
Output:
Is detector 0 masked: True
Is detector 6245 masked: True
Is detector 11464 masked: False
Is detector 17578 masked: False
Is detector 20475 masked: True
Categories: Algorithms | DataHandling | Transforms | Masking