ConvertSnsRoiFileToMask v1

../_images/ConvertSnsRoiFileToMask-v1_dlg.png

ConvertSnsRoiFileToMask dialog.

Summary

This algorithm reads in an old SNS reduction ROI file and converts it into a Mantid mask workspace.

Properties

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.

Description

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
...

Usage

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.

# 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)
MaskDetectors(ws, MaskedWorkspace=mask)

# Check to see that only first 2 pixels are not masked
print "Is detector 0 masked:", ws.getDetector(0).isMasked()
print "Is detector 1 masked:", ws.getDetector(1).isMasked()
print "Is detector 2 masked:", ws.getDetector(2).isMasked()

Output:

Is detector 0 masked: False
Is detector 1 masked: False
Is detector 2 masked: True

Categories: Algorithms | Inelastic\Utility