\(\renewcommand\AA{\unicode{x212B}}\)

ComponentInfo

Introduction

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

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

Python Interface

Examples of using ComponentInfo in python

Print indices of detectors in “bank1” that are masked

from mantid.simpleapi import CreateSampleWorkspace

ws = CreateSampleWorkspace()
comp_info = ws.componentInfo()
det_info = ws.detectorInfo()
det_info.setMasked(2, True) # Mask  a bank 1 detector for demo
det_info.setMasked(len(det_info)-1, True) # Mask detector not in bank 1
bank_index = comp_info.indexOfAny('bank1')
for det_index in comp_info.detectorsInSubtree(bank_index):
    if det_info.isMasked(int(det_index)):
        print('Masked detector index of bank1 is {}'.format(det_index))

Output:

Masked detector index of bank1 is 2

Category: Concepts