Mantid
Loading...
Searching...
No Matches
DetectorGroup.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
10#include <boost/python/class.hpp>
11
14using namespace boost::python;
15
16namespace {
17bool isMaskedDeprecated(const DetectorGroup &self) {
18 PyErr_Warn(PyExc_DeprecationWarning, "'DetectorGroup::isMasked' is deprecated, "
19 "use 'SpectrumInfo::isMasked' instead.");
20 const auto &dets = self.getDetectors();
21 bool masked = true;
22 for (const auto &det : dets) {
23 const auto &detInfo = det->parameterMap().detectorInfo();
24 masked &= detInfo.isMasked(det->index());
25 }
26 return masked;
27}
28
29bool isMonitorDeprecated(const DetectorGroup &self) {
30 PyErr_Warn(PyExc_DeprecationWarning, "'DetectorGroup::isMonitor' is "
31 "deprecated, use "
32 "'SpectrumInfo::isMonitor' instead.");
33 const auto &dets = self.getDetectors();
34 for (const auto &det : dets) {
35 const auto &detInfo = det->parameterMap().detectorInfo();
36 if (!detInfo.isMonitor(det->index()))
37 return false;
38 }
39 return true;
40}
41} // namespace
42
44 class_<DetectorGroup, bases<IDetector>, boost::noncopyable>("DetectorGroup", no_init)
45 .def("isMasked", &isMaskedDeprecated, arg("self"),
46 "Returns the value of the masked flag. True means ignore this "
47 "detector")
48 .def("isMonitor", &isMonitorDeprecated, arg("self"),
49 "Returns True if the detector is marked as a monitor in the IDF")
50 .def("getDetectorIDs", &DetectorGroup::getDetectorIDs, arg("self"),
51 "Returns the list of detector IDs within this group")
52 .def("getNameSeparator", &DetectorGroup::getNameSeparator, arg("self"),
53 "Returns separator for list of names of detectors");
54}
void export_DetectorGroup()
Holds a collection of detectors.
Definition: DetectorGroup.h:28
std::string getNameSeparator() const
Return separator for list of names of detectors.
std::vector< detid_t > getDetectorIDs() const
What detectors are contained in the group?
std::vector< IDetector_const_sptr > getDetectors() const
What detectors are contained in the group?
Interface class for detector objects.
Definition: IDetector.h:43