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 PyErr_Warn(PyExc_DeprecationWarning,
".getName() is deprecated. Use .name instead.");
87 register_ptr_to_python<std::shared_ptr<IMDDimension>>();
89 class_<IMDDimension, boost::noncopyable>(
"IMDDimension", no_init)
90 .def(
"getName", &
getName, arg(
"self"),
91 "Return the name of the dimension "
92 "as can be displayed along the "
95 "Return the name of the dimension as can be displayed "
100 "Return the number of bins dimension have (an integrated has one). "
101 "A axis directed along dimension would have getNBins+1 axis points.")
103 "Return the number of bins boundaries (axis points) dimension have "
104 "(an integrated has two). "
105 "A axis directed along dimension would have getNBins+1 axis points.")
106 .def(
"getX", &
IMDDimension::getX, (arg(
"self"), arg(
"ind")),
"Return coordinate of the axis at the given index")
109 "Return a short name which identify the dimension among other "
111 "A dimension can be usually find by its ID and various ")
112 .def(
"getUnits", &getUnitsAsStr, arg(
"self"),
"Return the units associated with this dimension.")
113 .def(
"getMDFrame", &getMDFrame, arg(
"self"),
"Return the multidimensional frame for this dimension.")
114 .def(
"setName", &setName, (arg(
"self"), arg(
"name")),
115 "Set the name of the dimension as displayed along the axis. Only "
116 "supported for MDHistoWorkspace dimensions.")
117 .def(
"setUnits", &setUnits, (arg(
"self"), arg(
"units")),
118 "Set the units of the dimension. Only supported for MDHistoWorkspace "
119 "dimensions whose frame permits it (HKL and general frames); an HKL "
120 "dimension accepts 'r.l.u.' or an inverse-Angstrom-style label such as "
121 "'in 2.5 A^-1'. Raises for a frame with a fixed unit (e.g. QSample/QLab) "
122 "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.