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 return std::all_of(dets.cbegin(), dets.cend(),
35 [](const auto &det) { return det->parameterMap().detectorInfo().isMonitor(det->index()); });
36}
37} // namespace
38
40 class_<DetectorGroup, bases<IDetector>, boost::noncopyable>("DetectorGroup", no_init)
41 .def("isMasked", &isMaskedDeprecated, arg("self"),
42 "Returns the value of the masked flag. True means ignore this "
43 "detector")
44 .def("isMonitor", &isMonitorDeprecated, arg("self"),
45 "Returns True if the detector is marked as a monitor in the IDF")
46 .def("getDetectorIDs", &DetectorGroup::getDetectorIDs, arg("self"),
47 "Returns the list of detector IDs within this group")
48 .def("getNameSeparator", &DetectorGroup::getNameSeparator, arg("self"),
49 "Returns separator for list of names of detectors");
50}
void export_DetectorGroup()
Holds a collection of detectors.
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