23#include "pybind11/pybind11.h"
24#include "pybind11/eigen.h"
33using namespace pybind11::literals;
41using PyCentroidChecker = py::class_<CentroidChecker>;
42using PyCentroidResult = py::class_<CentroidResult, std::shared_ptr<CentroidResult>>;
43using PyCentroidResultKey = py::class_<CentroidResultKey>;
44using PyCentroidTransform = py::class_<CentroidTransform, std::shared_ptr<CentroidTransform>, BaseTransform>;
47 wrappers.
wrapType(PyCentroidResult(wrappers.module,
"CentroidResult"), [](
auto &mod,
auto &cls) {
48 cls.def_readwrite(
"x", &CentroidResult::x);
49 cls.def_readwrite(
"y", &CentroidResult::y);
50 cls.def_readwrite(
"xErr", &CentroidResult::xErr);
51 cls.def_readwrite(
"yErr", &CentroidResult::yErr);
52 cls.def_readwrite(
"x_y_Cov", &CentroidResult::x_y_Cov);
54 cls.def(py::init<>());
55 cls.def(py::init<CentroidElement, CentroidElement, CentroidCov const &>(),
"x"_a,
"y"_a,
"matrix"_a);
56 cls.def(py::init<CentroidElement, CentroidElement, ErrElement, ErrElement>(),
"x"_a,
"y"_a,
"xErr"_a,
59 cls.def(
"getCentroid", &CentroidResult::getCentroid);
60 cls.def(
"setCentroid", &CentroidResult::setCentroid,
"centroid"_a);
61 cls.def(
"getPoint", &CentroidResult::getPoint);
62 cls.def(
"getCentroidErr", &CentroidResult::getCentroidErr);
63 cls.def(
"setCentroidErr",
64 (void (CentroidResult::*)(CentroidCov const &)) &CentroidResult::setCentroidErr,
"matrix"_a);
65 cls.def(
"setCentroidErr",
66 (void (CentroidResult::*)(ErrElement, ErrElement)) &CentroidResult::setCentroidErr,
"xErr"_a,
72 wrappers.
wrapType(PyCentroidResultKey(wrappers.module,
"CentroidResultKey"), [](
auto &mod,
auto &cls) {
73 cls.def(py::init<>());
74 cls.def(py::init<afw::table::PointKey<CentroidElement> const &,
75 afw::table::CovarianceMatrixKey<ErrElement, 2> const &>(),
76 "centroid"_a,
"uncertainty"_a);
77 cls.def(py::init<afw::table::SubSchema const &>(),
"subSchema"_a);
79 cls.def_static(
"addFields", &CentroidResultKey::addFields,
"schema"_a,
"name"_a,
"doc"_a,
"uncertainty"_a);
81 cls.def(
"__eq__", &CentroidResultKey::operator==, py::is_operator());
82 cls.def(
"__nq__", &CentroidResultKey::operator!=, py::is_operator());
84 cls.def(
"get", &CentroidResultKey::get,
"record"_a);
85 cls.def(
"set", &CentroidResultKey::set,
"record"_a,
"value"_a);
86 cls.def(
"isValid", &CentroidResultKey::isValid);
87 cls.def(
"getCentroid", &CentroidResultKey::getCentroid);
88 cls.def(
"getCentroidErr", &CentroidResultKey::getCentroidErr);
89 cls.def(
"getX", &CentroidResultKey::getX);
90 cls.def(
"getY", &CentroidResultKey::getY);
95 wrappers.
wrapType(PyCentroidTransform(wrappers.module,
"CentroidTransform"), [](
auto &mod,
auto &cls) {
96 cls.def(py::init<std::string const &, afw::table::SchemaMapper &>(),
"name"_a,
"mapper"_a);
98 cls.def(
"__call__", &CentroidTransform::operator(),
"inputCatalog"_a,
"outputCatalog"_a,
"wcs"_a,
104 wrappers.
wrapType(PyCentroidChecker(wrappers.module,
"CentroidChecker"), [](
auto &mod,
auto &cls) {
105 cls.def(py::init<afw::table::Schema &, std::string const &, bool, double>(),
"schema"_a,
"name"_a,
106 "inside"_a = true,
"maxDistFromPeak"_a = -1.0);
108 cls.def(
"__call__", &CentroidChecker::operator(),
"record"_a);
113 wrappers.
wrapType(py::enum_<UncertaintyEnum>(wrappers.module,
"UncertaintyEnum"), [](
auto &mod,
auto &enm) {
114 enm.value(
"NO_UNCERTAINTY", UncertaintyEnum::NO_UNCERTAINTY);
115 enm.value(
"SIGMA_ONLY", UncertaintyEnum::SIGMA_ONLY);
116 enm.value(
"FULL_COVARIANCE", UncertaintyEnum::FULL_COVARIANCE);
123 declareCentroidResult(wrappers);
124 declareCentroidResultKey(wrappers);
125 declareCentroidTransform(wrappers);
126 declareCentroidChecker(wrappers);
127 declareUncertaintyEnum(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 wrapCentroidUtilities(WrapperCollection &)