DetectorInfo

Introduction

DetectorInfo provides faster and simpler access to instrument/beamline detector geometry and metadata as required by Mantid Algorithms than was possible using Instrument. DetectorInfo and ComponentInfo are designed as full replacements to Instrument.

Instrument Access Layers provides details on how DetectorInfo interacts with other geometry access layers.

Python Interface

Example of using DetectorInfo in python

Mask detectors at some distance from the source

from mantid.simpleapi import CreateSampleWorkspace

# Test workspace with instrument
ws = CreateSampleWorkspace()
det_info = ws.detectorInfo();
mask_count = 0
for item in det_info:
    if not item.isMonitor and item.l2 > 2.0:
        item.setMasked(True)
        mask_count += 1
print('masked {} detectors'.format(mask_count))

Output:

masked 200 detectors

Category: Concepts