| 191 | |
| 192 | template <class T> |
| 193 | struct axis_suite : public bp::def_visitor<axis_suite<T>> { |
| 194 | template <class Class> |
| 195 | static void visit(Class& cl) { |
| 196 | cl.add_property("shape", &T::shape, |
| 197 | "Number of bins, including over-/underflow bins if they " |
| 198 | "are present."); |
| 199 | cl.add_property("label", axis_get_label<T>, axis_set_label<T>, |
| 200 | "Name or description for the axis."); |
| 201 | cl.def("index", &T::index, |
| 202 | ":param float x: value" |
| 203 | "\n:returns: bin index for the passed value", |
| 204 | bp::args("self", "x")); |
| 205 | cl.def("__len__", &T::size, |
| 206 | ":returns: number of bins, excluding over-/underflow bins.", bp::arg("self")); |
| 207 | cl.def("__getitem__", axis_getitem<T>, |
| 208 | ":param integer i: bin index" |
| 209 | "\n:returns: bin corresponding to index", |
| 210 | bp::args("self", "i")); |
| 211 | cl.def("__iter__", make_generic_iterator); |
| 212 | cl.def("__repr__", generic_repr<T>, ":returns: string representation of this axis", |
| 213 | bp::arg("self")); |
| 214 | cl.def(bp::self == bp::self); |
| 215 | #ifdef HAVE_NUMPY |
| 216 | cl.add_property("__array_interface__", &axis_array_interface<T>); |
| 217 | #endif |
| 218 | } |
| 219 | }; |
| 220 | |
| 221 | template <typename Transform> |
| 222 | bha::regular<Transform>* regular_init(unsigned bin, double lower, double upper, |
nothing calls this directly
no outgoing calls
no test coverage detected