Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
Workspace | InOut | Workspace | Input workspace (optional) | |
Instrument | Input | string | One of the following instruments: ARCS, BIOSANS, CG2, CHESS, CNCS, CORELLI, EQ-SANS, HYSPEC, MANDI, NOMAD, POWGEN, REF_M, SEQUOIA, SNAP, SXD, TOPAZ, WAND, WISH. Allowed values: [‘’, ‘ARCS’, ‘BIOSANS’, ‘CG2’, ‘CHESS’, ‘CNCS’, ‘CORELLI’, ‘EQ-SANS’, ‘HYSPEC’, ‘MANDI’, ‘NOMAD’, ‘POWGEN’, ‘REF_M’, ‘SEQUOIA’, ‘SNAP’, ‘SXD’, ‘TOPAZ’, ‘WAND’, ‘WISH’] | |
Components | Input | str list | Component names to mask | |
Bank | Input | int list | Bank(s) to be masked. If empty, will apply to all banks | |
Tube | Input | string | Tube(s) to be masked. If empty, will apply to all tubes | |
Pixel | Input | string | Pixel(s) to be masked. If empty, will apply to all pixels | |
MaskedDetectors | Output | int list | List of masked detectors |
Algorithm to mask detectors in particular banks, tube, or pixels. To use the Bank argument, the instrument must be one of: ARCS, BIOSANS, CG2 CNCS, CORELLI, EQ-SANS HYSPEC, MANDI, NOMAD, POWGEN, SEQUOIA, SNAP, SXD, TOPAZ, WAND, WISH. For instruments with rectangular position sensitive detectors (POWGEN, SNAP, TOPAZ), the tube is corresponding to the x coordinate, and pixel to the y coordinate. For example, on SNAP Bank="1", Tube="3" corresponds to SNAP/East/Column1/bank1/bank1(x=3), and Bank="1", Tube="3", Pixel="5" is SNAP/East/Column1/bank1/bank1(x=3)/bank1(3,5).
If one of Bank, Tube, Pixel entries is left blank, it will apply to all elements of that type. For example:
The algorithm allows ranged inputs:
Alternatively, the Components argument can be used to select named components instead of Banks. This is can be used for masking entire sub-components of an instrument.
Note
Either the input workspace or the instrument must be set. If the workspace is set, the instrument is ignored.
a=MaskBTP(Instrument='CNCS',Tube='1-3')
b=MaskBTP(Workspace='CNCSMaskBTP',Instrument='CNCS',Bank='40-50',Pixel='1-10')
c=MaskBTP(Workspace='CNCSMaskBTP',Instrument='CNCS',Bank='42')
print("Detectors masked")
print("Step 1: 50 * 3 * 128 = {0.size}".format(a))
print("Step 2: 11 * 8 * 10 = {0.size}".format(b))
print("Step 3: 1 * 8 * 128 = {0.size}".format(c))
print("Here are some of the masked detectors:")
instrument=mtd['CNCSMaskBTP'].getInstrument()
print("A pixel Bank 42, detector 42700: {}".format(instrument.getDetector(42700).isMasked()))
print("Pixel 1 in Tube 4 in Bank 45, detector 45440: {}".format(instrument.getDetector(45440).isMasked()))
print("Pixel 100 in Tube 2 in Bank 45, detector 45283: {}".format(instrument.getDetector(45283).isMasked()))
print("")
print("And one that should not be masked")
print("Pixel 128 in Tube 8 in Bank 50, detector 51199: {}".format(instrument.getDetector(51199).isMasked()))
Output:
Detectors masked
Step 1: 50 * 3 * 128 = 19200
Step 2: 11 * 8 * 10 = 880
Step 3: 1 * 8 * 128 = 1024
Here are some of the masked detectors:
A pixel Bank 42, detector 42700: True
Pixel 1 in Tube 4 in Bank 45, detector 45440: True
Pixel 100 in Tube 2 in Bank 45, detector 45283: True
And one that should not be masked
Pixel 128 in Tube 8 in Bank 50, detector 51199: False
The instrument view should look like
Categories: AlgorithmIndex | Transforms\Masking | Inelastic\Utility
Python: MaskBTP.py (last modified: 2019-11-05)