\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
This algorithm reads in an old SNS reduction ROI file and converts it into a Mantid mask workspace.
Name | Direction | Type | Default | Description |
---|---|---|---|---|
SnsRoiFile | Input | string | Mandatory | SNS reduction ROI file to load. Allowed extensions: [‘.dat’, ‘.txt’] |
Instrument | Input | string | Mandatory | One of the supported instruments. Allowed values: [‘ARCS’, ‘BASIS’, ‘CNCS’, ‘SEQUOIA’] |
OutputFilePrefix | Input | string | Overrides the default filename for the output file (Optional). Default is <inst_name>_Mask. | |
OutputDirectory | Input | string | Mandatory | Directory to save mask file. Default is current Mantid save directory. |
This algorithm reads in an old SNS reduction ROI file and converts it into a Mantid mask workspace. It will save that mask to a Mantid mask file.
The file format of the ROI file looks like:
bank1_0_0
bank1_0_1
...
Note
To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.
# Run converter
inst_name = "CNCS"
ConvertSnsRoiFileToMask("cncs_roi.txt", inst_name, ".")
# To test, load data and mask
ws = Load("CNCS_7860_event.nxs")
mask_file = inst_name + "_Mask.xml"
mask = LoadMask(inst_name, mask_file, RefWorkspace = ws)
MaskDetectors(ws, MaskedWorkspace=mask)
# Check to see that only first 2 pixels are not masked
print("Is detector 0 masked: {}".format(ws.getDetector(0).isMasked()))
print("Is detector 1 masked: {}".format(ws.getDetector(1).isMasked()))
print("Is detector 2 masked: {}".format(ws.getDetector(2).isMasked()))
Output:
Is detector 0 masked: False
Is detector 1 masked: False
Is detector 2 masked: True
Categories: AlgorithmIndex | Inelastic\Utility
Python: ConvertSnsRoiFileToMask.py (last modified: 2020-03-27)