13#include <boost/python/class.hpp>
14#include <boost/python/copy_const_reference.hpp>
15#include <boost/python/overloads.hpp>
16#include <boost/python/register_ptr_to_python.hpp>
31 if (PyErr_Warn(PyExc_DeprecationWarning,
32 "Instrument.getBaseInstrument() is deprecated in Mantid 7.0.\n"
33 "Use ExperimentInfo.baseComponentInfo() instead. "
34 "For more information, see the instrument access layers concept page: "
35 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html") < 0)
36 throw boost::python::error_already_set();
41 if (PyErr_Warn(PyExc_DeprecationWarning,
42 "'Instrument.getSample' is deprecated in Mantid 7.0, "
43 "use 'ComponentInfo.sample'/'samplePosition' instead. "
44 "For more information, see the instrument access layers concept page: "
45 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html") < 0)
46 throw boost::python::error_already_set();
51 if (PyErr_Warn(PyExc_DeprecationWarning,
52 "'Instrument.getSource' is deprecated in Mantid 7.0, "
53 "use 'ComponentInfo.source'/'sourcePosition' instead. "
54 "For more information, see the instrument access layers concept page: "
55 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html") < 0)
56 throw boost::python::error_already_set();
85std::size_t getNumberDetectorsDeprecated(
const Instrument &self,
const bool skipMonitors =
false) {
86 if (PyErr_Warn(PyExc_DeprecationWarning,
87 "'Instrument.getNumberDetectors' is deprecated in Mantid 7.0, "
88 "use 'DetectorInfo.size' instead. "
89 "For more information, see the instrument access layers concept page: "
90 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html") < 0)
91 throw boost::python::error_already_set();
95std::vector<RectangularDetector_const_sptr> findRectDetectorsDeprecated(
const Instrument &self) {
107std::vector<GridDetector_const_sptr> findGridDetectorsDeprecated(
const Instrument &self) {
123BOOST_PYTHON_FUNCTION_OVERLOADS(Instrument_getNumberDetectors, getNumberDetectorsDeprecated, 1, 2)
130 register_ptr_to_python<std::shared_ptr<Instrument>>();
132 class_<Instrument, bases<CompAssembly>, boost::noncopyable>(
"Instrument", no_init)
133 .def(
"getSample", &getSampleDeprecated, arg(
"self"), return_value_policy<RemoveConstSharedPtr>(),
134 "Return the :class:`~mantid.geometry.Component` object that "
135 "represents the sample (deprecated, use ComponentInfo.sample)")
137 .def(
"getSource", &getSourceDeprecated, arg(
"self"), return_value_policy<RemoveConstSharedPtr>(),
138 "Return the :class:`~mantid.geometry.Component` object that "
139 "represents the source (deprecated, use ComponentInfo.source)")
141 .def(
"getComponentByName", &getComponentByNameDeprecated, (arg(
"self"), arg(
"cname"), arg(
"nlevels") = 0),
142 return_value_policy<RemoveConstSharedPtr>(),
143 "Returns the named :class:`~mantid.geometry.Component` "
144 "(deprecated, use ComponentInfo.indexOfAny)")
146 .def(
"getDetector", &getDetectorDeprecated, (arg(
"self"), arg(
"detector_id")),
147 return_value_policy<RemoveConstSharedPtr>(),
148 "Returns the :class:`~mantid.geometry.Detector` with the given ID "
149 "(deprecated, use DetectorInfo.indexOf)")
152 "Return the name of the preferred view in instrument view.")
155 "Return the instrument XML.")
157 .def(
"getNumberDetectors", &getNumberDetectorsDeprecated,
158 Instrument_getNumberDetectors(
"Return the number of detectors (deprecated, use DetectorInfo.size)",
159 (arg(
"self"), arg(
"skipMonitors") =
false)))
162 arg(
"self"), return_value_policy<RemoveConstSharedPtr>(),
163 "Returns the :class:`~mantid.geometry.ReferenceFrame` attached that "
164 "defines the instrument "
168 "Return the valid from :class:`~mantid.kernel.DateAndTime` of the "
172 "Return the valid to :class:`~mantid.kernel.DateAndTime` of the "
176 "Return the name of the file that the original IDF was from")
179 "Set the name of the file that the original IDF was from")
181 .def(
"getBaseInstrument", &getBaseInstrumentDeprecated, arg(
"self"), return_value_policy<RemoveConstSharedPtr>(),
182 "Return reference to the base instrument "
183 "(deprecated, use baseComponentInfo() on the workspace).")
185 .def(
"findRectDetectors", &findRectDetectorsDeprecated, arg(
"self"),
186 "Return a list of rectangular detectors "
187 "(deprecated, use ComponentInfo.componentType).")
188 .def(
"findGridDetectors", &findGridDetectorsDeprecated, arg(
"self"),
189 "Return a list of grid detectors "
190 "(deprecated, use ComponentInfo.componentType).")
192 "Return the memory footprint of the instrument in bytes.");
#define GET_POINTER_SPECIALIZATION(TYPE)
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
std::shared_ptr< const IComponent > getComponentByName(const std::string &cname, int nlevels=0) const override
Returns a pointer to the first component of assembly encountered with the given name.
std::size_t getNumberDetectors(bool skipMonitors=false) const
IComponent_const_sptr getSource() const
Gets a pointer to the source.
std::vector< GridDetector_const_sptr > findGridDetectors() const
std::shared_ptr< const Instrument > baseInstrument() const
Pointer to the 'real' instrument, for parametrized instruments.
size_t getMemorySize() const
Get the footprint in memory in bytes.
std::vector< RectangularDetector_const_sptr > findRectDetectors() const
const std::string & getFilename() const
const std::string & getDefaultView() const
Get the default type of the instrument view.
const std::string & getXmlText() const
Types::Core::DateAndTime getValidFromDate() const
std::shared_ptr< const ReferenceFrame > getReferenceFrame() const
Get refernce Frame.
IDetector_const_sptr getDetector(const detid_t &detector_id) const
Gets a pointer to the detector from its ID Note that for getting the detector associated with a spect...
void setFilename(const std::string &filename)
Set the path to the original IDF .xml file that was loaded for this instrument.
Types::Core::DateAndTime getValidToDate() const
IComponent_const_sptr getSample() const
Gets a pointer to the Sample Position.
std::shared_ptr< const IComponent > IComponent_const_sptr
Typdef of a shared pointer to a const IComponent.
std::shared_ptr< const Mantid::Geometry::IDetector > IDetector_const_sptr
Shared pointer to IDetector (const version)
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
int32_t detid_t
Typedef for a detector ID.
Implements the RemoveConstSharedPtr policy.