25#include "pybind11/pybind11.h"
26#include "pybind11/stl.h"
38using namespace pybind11::literals;
45 using PyPoint = py::class_<Point, std::shared_ptr<Point>>;
47 wrappers.
wrapType(PyPoint(wrappers.module,
"Point"), [](
auto &mod,
auto &cls) {
48 cls.def(py::init<double, double>(),
"x"_a,
"y"_a);
49 cls.def_readwrite(
"x", &Point::x);
50 cls.def_readwrite(
"y", &Point::y);
51 cpputils::python::addOutputOp(cls,
"__str__");
56 using PyFatPoint = py::class_<FatPoint, std::shared_ptr<FatPoint>, Point> ;
58 wrappers.
wrapType(PyFatPoint(wrappers.module,
"FatPoint"), [](
auto &mod,
auto &cls) {
64 using PyBaseStar = py::class_<BaseStar, std::shared_ptr<BaseStar>, FatPoint>;
66 wrappers.
wrapType(PyBaseStar(wrappers.module,
"BaseStar"), [](
auto &mod,
auto &cls) {
67 cls.def(py::init<double, double, double, double>(),
"x"_a,
"y"_a,
"flux"_a,
"fluxErr"_a);
71 cls.def_readwrite(
"vx", &BaseStar::vx);
72 cls.def_readwrite(
"vy", &BaseStar::vy);
73 cls.def_readwrite(
"vxy", &BaseStar::vxy);
75 cls.def_property_readonly(
"flux", (double (BaseStar::*)() const) &BaseStar::getFlux);
76 cls.def_property_readonly(
"fluxErr", (double (BaseStar::*)() const) &BaseStar::getFluxErr);
77 cls.def_property_readonly(
"mag", (double (BaseStar::*)() const) &BaseStar::getMag);
78 cls.def_property_readonly(
"magErr", (double (BaseStar::*)() const) &BaseStar::getMagErr);
83 using PyRefStar = py::class_<RefStar, std::shared_ptr<RefStar>, BaseStar>;
85 wrappers.
wrapType(PyRefStar(wrappers.module,
"RefStar"), [](
auto &mod,
auto &cls) {
86 cls.def(py::init<double, double, double, double>(),
"xx"_a,
"yy"_a,
"flux"_a,
"fluxErr"_a);
87 cls.def(
"setProperMotion", py::overload_cast<ProperMotion const &>(&RefStar::setProperMotion));
88 cls.def(
"applyProperMotion", &RefStar::applyProperMotion);
93 using PyFittedStar = py::class_<FittedStar, std::shared_ptr<FittedStar>, BaseStar> ;
95 wrappers.
wrapType(PyFittedStar(wrappers.module,
"FittedStar"), [](
auto &mod,
auto &cls) {
96 cls.def(py::init<>());
97 cls.def(py::init<BaseStar const &>(),
"baseStar"_a);
102 using PyMeasuredStar = py::class_<MeasuredStar, std::shared_ptr<MeasuredStar>, BaseStar>;
104 wrappers.
wrapType(PyMeasuredStar(wrappers.module,
"MeasuredStar"), [](
auto &mod,
auto &cls) {
105 cls.def(py::init<>());
106 cls.def(py::init<BaseStar const &>(),
"baseStar"_a);
107 cls.def(
"getFittedStar", &MeasuredStar::getFittedStar);
108 cls.def(
"setFittedStar", &MeasuredStar::setFittedStar);
109 cls.def(
"getInstFlux", &MeasuredStar::getInstFlux);
110 cls.def(
"setInstFluxAndErr", &MeasuredStar::setInstFluxAndErr);
111 cls.def(
"getInstFluxErr", &MeasuredStar::getInstFluxErr);
112 cls.def(
"getInstMag", &MeasuredStar::getInstMag);
113 cls.def(
"getInstMagErr", &MeasuredStar::getInstMagErr);
114 cls.def(
"setXFocal", &MeasuredStar::setXFocal);
115 cls.def(
"setYFocal", &MeasuredStar::setYFocal);
116 cls.def(
"getXFocal", &MeasuredStar::getXFocal);
117 cls.def(
"getYFocal", &MeasuredStar::getYFocal);
122 using PyProperMotion = py::class_<ProperMotion, std::shared_ptr<ProperMotion>> ;
124 wrappers.
wrapType(PyProperMotion(wrappers.module,
"ProperMotion"), [](
auto &mod,
auto &cls) {
125 cls.def(py::init<double, double, double, double, double>(),
"ra"_a,
"dec"_a,
"raErr"_a,
"decErr"_a,
127 cls.def(
"apply", &ProperMotion::apply);
128 cpputils::python::addOutputOp(cls,
"__str__");
134 declarePoint(wrappers);
135 declareFatPoint(wrappers);
136 declareBaseStar(wrappers);
137 declareRefStar(wrappers);
138 declareFittedStar(wrappers);
139 declareMeasuredStar(wrappers);
140 declareProperMotion(wrappers);
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...
void wrapStar(WrapperCollection &wrappers)