23 #include "pybind11/pybind11.h"
24 #include "pybind11/stl.h"
35 namespace py = pybind11;
36 using namespace pybind11::literals;
42 void declarePoint(py::module &mod) {
43 py::class_<Point, std::shared_ptr<Point>> cls(mod,
"Point");
45 cls.def_readonly(
"x", &Point::x);
46 cls.def_readonly(
"y", &Point::y);
49 void declareBaseStar(py::module &mod) {
50 py::class_<BaseStar, std::shared_ptr<BaseStar>, Point> cls(mod,
"BaseStar");
52 cls.def(py::init<>());
53 cls.def(py::init<double, double, double>(),
"x"_a,
"y"_a,
"flux"_a);
57 cls.def_readonly(
"vx", (
double BaseStar::*)&BaseStar::vx);
58 cls.def_readonly(
"vy", (
double BaseStar::*)&BaseStar::vy);
59 cls.def_readonly(
"vxy", (
double BaseStar::*)&BaseStar::vxy);
62 cls.def_property_readonly(
"flux", (
double (BaseStar::*)()
const) & BaseStar::getFlux);
64 cls.def(
"__str__", &BaseStar::__str__);
67 void declareRefStar(py::module &mod) {
68 py::class_<RefStar, std::shared_ptr<RefStar>, BaseStar> cls(mod,
"RefStar");
70 cls.def(py::init<const BaseStar &>(),
"baseStar"_a);
73 void declareFittedStar(py::module &mod) {
74 py::class_<FittedStar, std::shared_ptr<FittedStar>, BaseStar> cls(mod,
"FittedStar");
76 cls.def(py::init<const BaseStar &>(),
"baseStar"_a);
79 void declareMeasuredStar(py::module &mod) {
80 py::class_<MeasuredStar, std::shared_ptr<MeasuredStar>, BaseStar> cls(mod,
"MeasuredStar");
82 cls.def(py::init<const BaseStar &>(),
"baseStar"_a);
85 PYBIND11_PLUGIN(star) {
86 py::module mod(
"star");
91 declareFittedStar(mod);
92 declareMeasuredStar(mod);