24#include "pybind11/pybind11.h"
25#include "pybind11/eigen.h"
29#include "ndarray/pybind11.h"
44using namespace pybind11::literals;
50using cpputils::python::WrapperCollection;
54using PySourceRecord = py::classh<SourceRecord, SimpleRecord>;
55using PySourceTable = py::classh<SourceTable, SimpleTable>;
62 return wrappers.
wrapType(PySourceRecord(wrappers.
module,
"SourceRecord"), [](
auto &mod,
auto &cls) {
63 cls.def(
"getFootprint", &SourceRecord::getFootprint);
64 cls.def(
"setFootprint", &SourceRecord::setFootprint);
65 cls.def(
"getTable", &SourceRecord::getTable);
66 cls.def_property_readonly(
"table", &SourceRecord::getTable);
68 cls.def(
"getParent", &SourceRecord::getParent);
69 cls.def(
"setParent", &SourceRecord::setParent,
"id"_a);
71 cls.def(
"getPsfInstFlux", &SourceRecord::getPsfInstFlux);
72 cls.def(
"getPsfInstFluxErr", &SourceRecord::getPsfInstFluxErr);
73 cls.def(
"getPsfFluxFlag", &SourceRecord::getPsfFluxFlag);
75 cls.def(
"getModelInstFlux", &SourceRecord::getModelInstFlux);
76 cls.def(
"getModelInstFluxErr", &SourceRecord::getModelInstFluxErr);
77 cls.def(
"getModelFluxFlag", &SourceRecord::getModelFluxFlag);
79 cls.def(
"getApInstFlux", &SourceRecord::getApInstFlux);
80 cls.def(
"getApInstFluxErr", &SourceRecord::getApInstFluxErr);
81 cls.def(
"getApFluxFlag", &SourceRecord::getApFluxFlag);
83 cls.def(
"getGaussianInstFlux", &SourceRecord::getGaussianInstFlux);
84 cls.def(
"getGaussianInstFluxErr", &SourceRecord::getGaussianInstFluxErr);
85 cls.def(
"getGaussianFluxFlag", &SourceRecord::getGaussianFluxFlag);
87 cls.def(
"getCalibInstFlux", &SourceRecord::getCalibInstFlux);
88 cls.def(
"getCalibInstFluxErr", &SourceRecord::getCalibInstFluxErr);
89 cls.def(
"getCalibFluxFlag", &SourceRecord::getCalibFluxFlag);
91 cls.def(
"getCentroid", &SourceRecord::getCentroid);
92 cls.def(
"getCentroidErr", &SourceRecord::getCentroidErr);
93 cls.def(
"getCentroidFlag", &SourceRecord::getCentroidFlag);
95 cls.def(
"getShape", &SourceRecord::getShape);
96 cls.def(
"getShapeErr", &SourceRecord::getShapeErr);
97 cls.def(
"getShapeFlag", &SourceRecord::getShapeFlag);
99 cls.def(
"getX", &SourceRecord::getX);
100 cls.def(
"getY", &SourceRecord::getY);
101 cls.def(
"getIxx", &SourceRecord::getIxx);
102 cls.def(
"getIyy", &SourceRecord::getIyy);
103 cls.def(
"getIxy", &SourceRecord::getIxy);
104 cls.def(
"updateCoord", (void (SourceRecord::*)(geom::SkyWcs const &, bool)) & SourceRecord::updateCoord,
105 "wcs"_a,
"include_covariance"_a=true);
106 cls.def(
"updateCoord",
107 (void (SourceRecord::*)(geom::SkyWcs const &, PointKey<double> const &, bool)) &
108 SourceRecord::updateCoord,
109 "wcs"_a,
"key"_a,
"include_covariance"_a=true);
117 return wrappers.
wrapType(PySourceTable(wrappers.
module,
"SourceTable"), [](
auto &mod,
auto &cls) {
118 cls.def(
"clone", &SourceTable::clone);
119 cls.def_static(
"make",
120 (std::shared_ptr<SourceTable>(*)(Schema const &, std::shared_ptr<IdFactory> const &)) &
122 cls.def_static(
"make", (std::shared_ptr<SourceTable>(*)(Schema const &)) & SourceTable::make);
123 cls.def_static(
"makeMinimalSchema", &SourceTable::makeMinimalSchema);
124 cls.def_static(
"getParentKey", &SourceTable::getParentKey);
125 cls.def(
"copyRecord", (std::shared_ptr<SourceRecord>(SourceTable::*)(BaseRecord const &)) &
126 SourceTable::copyRecord);
127 cls.def(
"copyRecord",
128 (std::shared_ptr<SourceRecord>(SourceTable::*)(BaseRecord const &, SchemaMapper const &)) &
129 SourceTable::copyRecord);
130 cls.def(
"makeRecord", &SourceTable::makeRecord);
132 cls.def(
"getPsfFluxSlot", &SourceTable::getPsfFluxSlot);
133 cls.def(
"definePsfFlux", &SourceTable::definePsfFlux,
"name"_a);
135 cls.def(
"getModelFluxSlot", &SourceTable::getModelFluxSlot);
136 cls.def(
"defineModelFlux", &SourceTable::defineModelFlux,
"name"_a);
138 cls.def(
"getApFluxSlot", &SourceTable::getApFluxSlot);
139 cls.def(
"defineApFlux", &SourceTable::defineApFlux,
"name"_a);
141 cls.def(
"getGaussianFluxSlot", &SourceTable::getGaussianFluxSlot);
142 cls.def(
"defineGaussianFlux", &SourceTable::defineGaussianFlux,
"name"_a);
144 cls.def(
"getCalibFluxSlot", &SourceTable::getCalibFluxSlot);
145 cls.def(
"defineCalibFlux", &SourceTable::defineCalibFlux,
"name"_a);
147 cls.def(
"getCentroidSlot", &SourceTable::getCentroidSlot);
148 cls.def(
"defineCentroid", &SourceTable::defineCentroid,
"name"_a);
150 cls.def(
"getShapeSlot", &SourceTable::getShapeSlot);
151 cls.def(
"defineShape", &SourceTable::defineShape,
"name"_a);
157 return wrappers.
wrapType(PySourceColumnView(wrappers.
module,
"SourceColumnView"),
158 [](
auto &mod,
auto &cls) {
159 using Class = SourceColumnViewT<SourceRecord>;
160 cls.def(
"getPsfInstFlux", &Class::getPsfInstFlux);
161 cls.def(
"getPsfInstFluxErr", &Class::getPsfInstFluxErr);
162 cls.def(
"getApInstFlux", &Class::getApInstFlux);
163 cls.def(
"getApInstFluxErr", &Class::getApInstFluxErr);
164 cls.def(
"getModelInstFlux", &Class::getModelInstFlux);
165 cls.def(
"getModelInstFluxErr", &Class::getModelInstFluxErr);
166 cls.def(
"getGaussianInstFlux", &Class::getGaussianInstFlux);
167 cls.def(
"getGaussianInstFluxErr", &Class::getGaussianInstFluxErr);
168 cls.def(
"getCalibInstFlux", &Class::getCalibInstFlux);
169 cls.def(
"getCalibInstFluxErr", &Class::getCalibInstFluxErr);
170 cls.def(
"getX", &Class::getX);
171 cls.def(
"getY", &Class::getY);
172 cls.def(
"getIxx", &Class::getIxx);
173 cls.def(
"getIyy", &Class::getIyy);
174 cls.def(
"getIxy", &Class::getIxy);
187 auto &mod = wrappers.
module;
189 mod.attr(
"SOURCE_IO_NO_HEAVY_FOOTPRINTS") =
192 auto clsSourceRecord = declareSourceRecord(wrappers);
193 auto clsSourceTable = declareSourceTable(wrappers);
194 auto clsSourceColumnView = declareSourceColumnView(wrappers);
197 clsSourceRecord.attr(
"Table") = clsSourceTable;
198 clsSourceRecord.attr(
"ColumnView") = clsSourceColumnView;
199 clsSourceRecord.attr(
"Catalog") = clsSourceCatalog;
200 clsSourceTable.attr(
"Record") = clsSourceRecord;
201 clsSourceTable.attr(
"ColumnView") = clsSourceColumnView;
202 clsSourceTable.attr(
"Catalog") = clsSourceCatalog;
203 clsSourceCatalog.attr(
"Record") = clsSourceRecord;
204 clsSourceCatalog.attr(
"Table") = clsSourceTable;
205 clsSourceCatalog.attr(
"ColumnView") = clsSourceColumnView;
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.
A helper class for subdividing pybind11 module across multiple translation units (i....
pybind11::module module
The module object passed to the PYBIND11_MODULE block that contains this WrapperCollection.
PySortedCatalog< Record > declareSortedCatalog(cpputils::python::WrapperCollection &wrappers, std::string const &name, bool isBase=false)
Wrap an instantiation of lsst::afw::table::SortedCatalogT<Record>.
PyColumnView< Record > declareColumnView(cpputils::python::WrapperCollection &wrappers, std::string const &name, bool isBase=false)
Declare member and static functions for a given instantiation of lsst::afw::table::ColumnViewT<Record...
void wrapSource(WrapperCollection &wrappers)
@ SOURCE_IO_NO_FOOTPRINTS
Do not read/write footprints at all.
@ SOURCE_IO_NO_HEAVY_FOOTPRINTS
Read/write heavy footprints as non-heavy footprints.