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 PyErr_Warn(PyExc_DeprecationWarning,
"'Instrument.getSample' is deprecated in Mantid 7.0, "
32 "use 'ComponentInfo.sample'/'samplePosition' instead. "
33 "For more information, see the instrument access layers concept page: "
34 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html");
39 PyErr_Warn(PyExc_DeprecationWarning,
"'Instrument.getSource' is deprecated in Mantid 7.0, "
40 "use 'ComponentInfo.source'/'sourcePosition' instead. "
41 "For more information, see the instrument access layers concept page: "
42 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html");
48 PyErr_Warn(PyExc_DeprecationWarning,
"'Instrument.getComponentByName' is deprecated in Mantid 7.0, "
49 "use 'ComponentInfo.indexOfAny' instead. "
50 "For more information, see the instrument access layers concept page: "
51 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html");
56 PyErr_Warn(PyExc_DeprecationWarning,
"'Instrument.getDetector' is deprecated in Mantid 7.0, "
57 "use 'DetectorInfo.indexOf' instead. "
58 "For more information, see the instrument access layers concept page: "
59 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html");
63std::size_t getNumberDetectorsDeprecated(
const Instrument &self,
const bool skipMonitors =
false) {
64 PyErr_Warn(PyExc_DeprecationWarning,
"'Instrument.getNumberDetectors' is deprecated in Mantid 7.0, "
65 "use 'DetectorInfo.size' instead. "
66 "For more information, see the instrument access layers concept page: "
67 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html");
71std::vector<RectangularDetector_const_sptr> findRectDetectorsDeprecated(
const Instrument &self) {
72 PyErr_Warn(PyExc_DeprecationWarning,
"'Instrument.findRectDetectors' is deprecated in Mantid 7.0, "
73 "use 'ComponentInfo.componentType' to identify Rectangular banks instead. "
74 "For more information, see the instrument access layers concept page: "
75 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html");
79std::vector<GridDetector_const_sptr> findGridDetectorsDeprecated(
const Instrument &self) {
80 PyErr_Warn(PyExc_DeprecationWarning,
"'Instrument.findGridDetectors' is deprecated in Mantid 7.0, "
81 "use 'ComponentInfo.componentType' to identify Grid banks instead. "
82 "For more information, see the instrument access layers concept page: "
83 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html");
91BOOST_PYTHON_FUNCTION_OVERLOADS(Instrument_getNumberDetectors, getNumberDetectorsDeprecated, 1, 2)
98 register_ptr_to_python<std::shared_ptr<Instrument>>();
100 class_<Instrument, bases<CompAssembly>, boost::noncopyable>(
"Instrument", no_init)
101 .def(
"getSample", &getSampleDeprecated, arg(
"self"), return_value_policy<RemoveConstSharedPtr>(),
102 "Return the :class:`~mantid.geometry.Component` object that "
103 "represents the sample (deprecated, use ComponentInfo.sample)")
105 .def(
"getSource", &getSourceDeprecated, arg(
"self"), return_value_policy<RemoveConstSharedPtr>(),
106 "Return the :class:`~mantid.geometry.Component` object that "
107 "represents the source (deprecated, use ComponentInfo.source)")
109 .def(
"getComponentByName", &getComponentByNameDeprecated, (arg(
"self"), arg(
"cname"), arg(
"nlevels") = 0),
110 return_value_policy<RemoveConstSharedPtr>(),
111 "Returns the named :class:`~mantid.geometry.Component` "
112 "(deprecated, use ComponentInfo.indexOfAny)")
114 .def(
"getDetector", &getDetectorDeprecated, (arg(
"self"), arg(
"detector_id")),
115 return_value_policy<RemoveConstSharedPtr>(),
116 "Returns the :class:`~mantid.geometry.Detector` with the given ID "
117 "(deprecated, use DetectorInfo.indexOf)")
120 "Return the name of the preferred view in instrument view.")
123 "Return the instrument XML.")
125 .def(
"getNumberDetectors", &getNumberDetectorsDeprecated,
126 Instrument_getNumberDetectors(
"Return the number of detectors (deprecated, use DetectorInfo.size)",
127 (arg(
"self"), arg(
"skipMonitors") =
false)))
130 arg(
"self"), return_value_policy<RemoveConstSharedPtr>(),
131 "Returns the :class:`~mantid.geometry.ReferenceFrame` attached that "
132 "defines the instrument "
136 "Return the valid from :class:`~mantid.kernel.DateAndTime` of the "
140 "Return the valid to :class:`~mantid.kernel.DateAndTime` of the "
144 "Return the name of the file that the original IDF was from")
147 "Set the name of the file that the original IDF was from")
150 "Return reference to the base instrument")
152 .def(
"findRectDetectors", &findRectDetectorsDeprecated, arg(
"self"),
153 "Return a list of rectangular detectors "
154 "(deprecated, use ComponentInfo.componentType).")
155 .def(
"findGridDetectors", &findGridDetectorsDeprecated, arg(
"self"),
156 "Return a list of grid detectors "
157 "(deprecated, use ComponentInfo.componentType).")
159 "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)
int32_t detid_t
Typedef for a detector ID.
Implements the RemoveConstSharedPtr policy.