25#include "pybind11/pybind11.h"
26#include "pybind11/eigen.h"
34using namespace pybind11::literals;
40void declareAstrometryTransform(lsst::cpputils::python::WrapperCollection &wrappers) {
41 using PyAstrometryTransform = py::class_<AstrometryTransform, std::shared_ptr<AstrometryTransform>>;
43 wrappers.
wrapType(PyAstrometryTransform(wrappers.
module,
"AstrometryTransform"), [](
auto &mod,
auto &cls) {
45 (jointcal::Point(AstrometryTransform::*)(const jointcal::Point &) const) &
46 AstrometryTransform::apply,
49 (jointcal::Frame(AstrometryTransform::*)(Frame const &, bool) const) &AstrometryTransform::apply,
50 "inputframe"_a,
"inscribed"_a);
51 cls.def(
"getNpar", &AstrometryTransform::getNpar);
52 cls.def(
"offsetParams", &AstrometryTransform::offsetParams);
53 cls.def(
"linearApproximation", &AstrometryTransform::linearApproximation);
54 cls.def(
"computeDerivative", [](AstrometryTransform const &self, Point const &where, double const step) {
55 AstrometryTransformLinear derivative;
56 self.computeDerivative(where, derivative, step);
64void declareAstrometryTransformIdentity(lsst::cpputils::python::WrapperCollection &wrappers) {
65 using PyAstrometryTransformIdentity =
66 py::class_<AstrometryTransformIdentity, std::shared_ptr<AstrometryTransformIdentity>,
AstrometryTransform>;
68 wrappers.
wrapType(PyAstrometryTransformIdentity(wrappers.
module,
"AstrometryTransformIdentity"),
69 [](
auto &mod,
auto &cls) {});
72void declareAstrometryTransformPolynomial(lsst::cpputils::python::WrapperCollection &wrappers) {
73 using PyAstrometryTransformPolynomial = py::class_<AstrometryTransformPolynomial, std::shared_ptr<AstrometryTransformPolynomial>,
77 PyAstrometryTransformPolynomial(wrappers.
module,
"AstrometryTransformPolynomial"),
78 [](
auto &mod,
auto &cls) {
79 cls.def(py::init<const unsigned>(),
"order"_a);
80 cls.def(
"getOrder", &AstrometryTransformPolynomial::getOrder);
81 cls.def(
"getCoefficient", py::overload_cast<std::size_t, std::size_t, std::size_t>(
82 &AstrometryTransformPolynomial::getCoefficient, py::const_));
83 cls.def(
"setCoefficient",
84 [](AstrometryTransformPolynomial &self, std::size_t powX, std::size_t powY,
85 std::size_t whichCoord,
86 double value) { self.getCoefficient(powX, powY, whichCoord) = value; });
102void declareAstrometryTransformLinear(lsst::cpputils::python::WrapperCollection &wrappers) {
103 using PyAstrometryTransformLinear = py::class_<AstrometryTransformLinear, std::shared_ptr<AstrometryTransformLinear>,
104 AstrometryTransformPolynomial>;
107 PyAstrometryTransformLinear(wrappers.
module,
"AstrometryTransformLinear"), [](
auto &mod,
auto &cls) {
108 cls.def(py::init<>());
112void declareAstrometryTransformLinearShift(lsst::cpputils::python::WrapperCollection &wrappers) {
113 using PyAstrometryTransformLinearShift = py::class_<AstrometryTransformLinearShift,
114 std::shared_ptr<AstrometryTransformLinearShift>, AstrometryTransformLinear>;
116 wrappers.
wrapType(PyAstrometryTransformLinearShift(wrappers.
module,
"AstrometryTransformLinearShift"),
117 [](
auto &mod,
auto &cls) {});
120void declareAstrometryTransformLinearRot(lsst::cpputils::python::WrapperCollection &wrappers) {
121 using PyAstrometryTransformLinearRot =
122 py::class_<AstrometryTransformLinearRot,
123 std::shared_ptr<AstrometryTransformLinearRot>, AstrometryTransformLinear>;
126 PyAstrometryTransformLinearRot(wrappers.
module,
"AstrometryTransformLinearRot"),
127 [](
auto &mod,
auto &cls) {});
130void declareAstrometryTransformLinearScale(lsst::cpputils::python::WrapperCollection &wrappers) {
131 using PyAstrometryTransformLinearScale =
132 py::class_<AstrometryTransformLinearScale, std::shared_ptr<AstrometryTransformLinearScale>,
133 AstrometryTransformLinear>;
136 PyAstrometryTransformLinearScale(wrappers.
module,
"AstrometryTransformLinearScale"),
137 [](
auto &mod,
auto &cls) {});
140void declareAstrometryTransformSkyWcs(lsst::cpputils::python::WrapperCollection &wrappers) {
141 using PyAstrometryTransformSkyWcs =
142 py::class_<AstrometryTransformSkyWcs, std::shared_ptr<AstrometryTransformSkyWcs>, AstrometryTransform>;
145 PyAstrometryTransformSkyWcs(wrappers.
module,
"AstrometryTransformSkyWcs"), [](
auto &mod,
auto &cls) {
146 cls.def(
"getSkyWcs", &AstrometryTransformSkyWcs::getSkyWcs);
150void declareBaseTanWcs(lsst::cpputils::python::WrapperCollection &wrappers) {
151 using PyBaseTanWcs = py::class_<BaseTanWcs, std::shared_ptr<BaseTanWcs>, AstrometryTransform> ;
153 wrappers.
wrapType(PyBaseTanWcs(wrappers.
module,
"BaseTanWcs"), [](
auto &mod,
auto &cls) {});
156void declareTanPixelToRaDec(lsst::cpputils::python::WrapperCollection &wrappers) {
157 using PyTanPixelToRaDec = py::class_<TanPixelToRaDec, std::shared_ptr<TanPixelToRaDec>, AstrometryTransform>;
159 wrappers.
wrapType(PyTanPixelToRaDec(wrappers.
module,
"TanPixelToRaDec"), [](
auto &mod,
auto &cls) {});
162void declareTanRaDecToPixel(lsst::cpputils::python::WrapperCollection &wrappers) {
163 using PyTanRaDecToPixel = py::class_<TanRaDecToPixel, std::shared_ptr<TanRaDecToPixel>, AstrometryTransform>;
165 wrappers.
wrapType(PyTanRaDecToPixel(wrappers.
module,
"TanRaDecToPixel"), [](
auto &mod,
auto &cls) {});
168void declareTanSipPixelToRaDec(lsst::cpputils::python::WrapperCollection &wrappers) {
169 using PyTanSipPixelToRaDec = py::class_<TanSipPixelToRaDec, std::shared_ptr<TanSipPixelToRaDec>, BaseTanWcs>;
171 wrappers.
wrapType(PyTanSipPixelToRaDec(wrappers.
module,
"TanSipPixelToRaDec"), [](
auto &mod,
auto &cls) {});
176 declareAstrometryTransform(wrappers);
177 declareAstrometryTransformIdentity(wrappers);
178 declareAstrometryTransformPolynomial(wrappers);
179 declareAstrometryTransformLinear(wrappers);
180 declareAstrometryTransformLinearShift(wrappers);
181 declareAstrometryTransformLinearRot(wrappers);
182 declareAstrometryTransformLinearScale(wrappers);
183 declareAstrometryTransformSkyWcs(wrappers);
184 declareBaseTanWcs(wrappers);
185 declareTanPixelToRaDec(wrappers);
186 declareTanRaDecToPixel(wrappers);
187 declareTanSipPixelToRaDec(wrappers);
191 "maxOrder"_a = 9,
"nSteps"_a = 50);
A helper class for subdividing pybind11 module across multiple translation units (i....
PyType wrapType(PyType cls, ClassWrapperCallback function, bool setModuleName=true)
Add a type (class or enum) wrapper, deferring method and other attribute definitions until finish() i...
pybind11::module module
The module object passed to the PYBIND11_MODULE block that contains this WrapperCollection.
void addOutputOp(PyClass &cls, std::string const &method)
Add __str__ or __repr__ method implemented by operator<<.
std::shared_ptr< AstrometryTransformPolynomial > inversePolyTransform(AstrometryTransform const &forward, Frame const &domain, double precision, std::size_t maxOrder=9, std::size_t nSteps=50)
Approximate the inverse by a polynomial, to some precision.
void wrapAstrometryTransform(WrapperCollection &wrappers)