16#include <boost/python/class.hpp>
17#include <boost/python/copy_const_reference.hpp>
18#include <boost/python/register_ptr_to_python.hpp>
19#include <boost/python/return_internal_reference.hpp>
40std::shared_ptr<MDFrame> getMDFrame(
const IMDDimension &self) {
53 if (!histoDimension) {
54 throw std::runtime_error(
"Editing the name or units is only supported for MDHistoWorkspace dimensions.");
56 return *histoDimension;
63void setName(
IMDDimension &self,
const std::string &
name) { asEditableDimension(self).setName(
name); }
69void setUnits(
IMDDimension &self,
const std::string &units) {
82 if (PyErr_Warn(PyExc_DeprecationWarning,
".getName() is deprecated. Use .name instead.") < 0)
83 throw boost::python::error_already_set();
88 register_ptr_to_python<std::shared_ptr<IMDDimension>>();
90 class_<IMDDimension, boost::noncopyable>(
"IMDDimension", no_init)
91 .def(
"getName", &
getName, arg(
"self"),
92 "Return the name of the dimension "
93 "as can be displayed along the "
96 "Return the name of the dimension as can be displayed "
101 "Return the number of bins dimension have (an integrated has one). "
102 "A axis directed along dimension would have getNBins+1 axis points.")
104 "Return the number of bins boundaries (axis points) dimension have "
105 "(an integrated has two). "
106 "A axis directed along dimension would have getNBins+1 axis points.")
107 .def(
"getX", &
IMDDimension::getX, (arg(
"self"), arg(
"ind")),
"Return coordinate of the axis at the given index")
110 "Return a short name which identify the dimension among other "
112 "A dimension can be usually find by its ID and various ")
113 .def(
"getUnits", &getUnitsAsStr, arg(
"self"),
"Return the units associated with this dimension.")
114 .def(
"getMDFrame", &getMDFrame, arg(
"self"),
"Return the multidimensional frame for this dimension.")
115 .def(
"setName", &setName, (arg(
"self"), arg(
"name")),
116 "Set the name of the dimension as displayed along the axis. Only "
117 "supported for MDHistoWorkspace dimensions.")
118 .def(
"setUnits", &setUnits, (arg(
"self"), arg(
"units")),
119 "Set the units of the dimension. Only supported for MDHistoWorkspace "
120 "dimensions whose frame permits it (HKL and general frames); an HKL "
121 "dimension accepts 'r.l.u.' or an inverse-Angstrom-style label such as "
122 "'in 2.5 A^-1'. Raises for a frame with a fixed unit (e.g. QSample/QLab) "
123 "or a label the frame does not accept.");
#define GET_POINTER_SPECIALIZATION(TYPE)
void export_IMDDimension()
std::string getName(const IMDDimension &self)
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
The class describes one dimension of multidimensional dataset representing an orthogonal dimension an...
virtual coord_t getMaximum() const =0
virtual coord_t getMinimum() const =0
virtual std::string getName() const =0
virtual const Geometry::MDFrame & getMDFrame() const =0
virtual const Kernel::UnitLabel getUnits() const =0
virtual const std::string & getDimensionId() const =0
short name which identify the dimension among other dimension.
virtual coord_t getBinWidth() const
virtual coord_t getX(size_t ind) const =0
virtual size_t getNBoundaries() const =0
virtual size_t getNBins() const =0
virtual MDFrame * clone() const =0
A base-class for the a class that is able to return unit labels in different representations.
const AsciiString & ascii() const
Return an ascii label for unit.