Mantid
Loading...
Searching...
No Matches
IMaskWorkspace.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 +
11#include <boost/python/class.hpp>
12#include <boost/python/extract.hpp>
13#include <boost/python/list.hpp>
14
15GNU_DIAG_OFF("strict-aliasing")
16
18using namespace Mantid::PythonInterface::Registry;
19using namespace boost::python;
20
22
23namespace {
24
25bool isMaskedFromList(const IMaskWorkspace &self, const boost::python::list &ids) {
26 std::set<Mantid::detid_t> idSet;
27 auto length = len(ids);
28 for (auto i = 0; i < length; ++i) {
29 idSet.insert(extract<Mantid::detid_t>(ids[i])());
30 }
31 return self.isMasked(idSet);
32}
33} // namespace
34
36 class_<IMaskWorkspace, boost::noncopyable>("IMaskWorkspace", no_init)
37 .def("getNumberMasked", &IMaskWorkspace::getNumberMasked, arg("self"),
38 "Returns the number of masked pixels in the workspace")
39 .def("isMasked", (bool (IMaskWorkspace::*)(const Mantid::detid_t) const) & IMaskWorkspace::isMasked,
40 (arg("self"), arg("detector_id")), "Returns whether the given detector ID is masked")
41 .def("isMasked", isMaskedFromList, (arg("self"), arg("detector_id_list")),
42 "Returns whether all of the given detector ID list are masked");
43
44 // register pointers
46}
#define GET_POINTER_SPECIALIZATION(TYPE)
Definition: GetPointer.h:17
void export_IMaskWorkspace()
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
This class provides an interface to a MaskWorkspace.
virtual bool isMasked(const detid_t detectorID) const =0
Check if a detector is masked.
virtual std::size_t getNumberMasked() const =0
Total number of masked pixels.
Helper class which provides the Collimation Length for SANS instruments.
int32_t detid_t
Typedef for a detector ID.
Definition: SpectrumInfo.h:21
Definition: NDArray.h:49
Encapsulates the registration required for an interface type T that sits on top of a Kernel::DataItem...