22 #include <pybind11/pybind11.h>
23 #include <pybind11/stl.h>
24 #include "ndarray/pybind11.h"
33 using namespace pybind11::literals;
39 py::module::import(
"astshim.object");
40 py::module::import(
"astshim.mapBox");
41 py::module::import(
"astshim.mapSplit");
43 py::class_<Mapping, std::shared_ptr<Mapping>, Object>
cls(mod,
"Mapping");
45 cls.def_property_readonly(
"nIn", &Mapping::getNIn);
46 cls.def_property_readonly(
"nOut", &Mapping::getNOut);
47 cls.def_property_readonly(
"isSimple", &Mapping::getIsSimple);
48 cls.def_property_readonly(
"hasForward", &Mapping::hasForward);
49 cls.def_property_readonly(
"hasInverse", &Mapping::hasInverse);
50 cls.def_property_readonly(
"isInverted", &Mapping::isInverted);
51 cls.def_property_readonly(
"isLinear", &Mapping::getIsLinear);
52 cls.def_property(
"report", &Mapping::getReport, &Mapping::setReport);
54 cls.def(
"copy", &Mapping::copy);
55 cls.def(
"inverted", &Mapping::inverted);
56 cls.def(
"linearApprox", &Mapping::linearApprox,
"lbnd"_a,
"ubnd"_a,
"tol"_a);
58 cls.def(
"under", &Mapping::under,
"next"_a);
59 cls.def(
"rate", &Mapping::rate,
"at"_a,
"ax1"_a,
"ax2"_a);
63 cls.def(
"applyForward", py::overload_cast<ConstArray2D const &>(&Mapping::applyForward, py::const_),
65 cls.def(
"applyForward",
66 py::overload_cast<
std::vector<double> const &>(&Mapping::applyForward, py::const_),
"from"_a);
67 cls.def(
"applyInverse", py::overload_cast<ConstArray2D const &>(&Mapping::applyInverse, py::const_),
69 cls.def(
"applyInverse",
70 py::overload_cast<
std::vector<double> const &>(&Mapping::applyInverse, py::const_),
"from"_a);
71 cls.def(
"tranGridForward",
72 py::overload_cast<PointI const &, PointI const &, double, int, int>(&Mapping::tranGridForward,
74 "lbnd"_a,
"ubnd"_a,
"tol"_a,
"maxpix"_a,
"nPoints"_a);
75 cls.def(
"tranGridInverse",
76 py::overload_cast<PointI const &, PointI const &, double, int, int>(&Mapping::tranGridInverse,
78 "lbnd"_a,
"ubnd"_a,
"tol"_a,
"maxpix"_a,
"nPoints"_a);