24 #include "pybind11/pybind11.h" 25 #include "pybind11/eigen.h" 29 #include "ndarray/pybind11.h" 50 using utils::python::WrapperCollection;
54 using PySourceRecord = py::class_<SourceRecord, std::shared_ptr<SourceRecord>, SimpleRecord>;
55 using PySourceTable = py::class_<SourceTable, std::shared_ptr<SourceTable>, SimpleTable>;
56 using PySourceColumnView =
58 ColumnViewT<SourceRecord>>;
63 PySourceRecord declareSourceRecord(WrapperCollection &wrappers) {
64 return wrappers.wrapType(PySourceRecord(wrappers.module,
"SourceRecord"), [](
auto &mod,
auto &
cls) {
65 cls.def(
"getFootprint", &SourceRecord::getFootprint);
66 cls.def(
"setFootprint", &SourceRecord::setFootprint);
67 cls.def(
"getTable", &SourceRecord::getTable);
68 cls.def_property_readonly(
"table", &SourceRecord::getTable);
70 cls.def(
"getParent", &SourceRecord::getParent);
71 cls.def(
"setParent", &SourceRecord::setParent,
"id"_a);
73 cls.def(
"getPsfInstFlux", &SourceRecord::getPsfInstFlux);
74 cls.def(
"getPsfInstFluxErr", &SourceRecord::getPsfInstFluxErr);
75 cls.def(
"getPsfFluxFlag", &SourceRecord::getPsfFluxFlag);
77 cls.def(
"getModelInstFlux", &SourceRecord::getModelInstFlux);
78 cls.def(
"getModelInstFluxErr", &SourceRecord::getModelInstFluxErr);
79 cls.def(
"getModelFluxFlag", &SourceRecord::getModelFluxFlag);
81 cls.def(
"getApInstFlux", &SourceRecord::getApInstFlux);
82 cls.def(
"getApInstFluxErr", &SourceRecord::getApInstFluxErr);
83 cls.def(
"getApFluxFlag", &SourceRecord::getApFluxFlag);
85 cls.def(
"getGaussianInstFlux", &SourceRecord::getGaussianInstFlux);
86 cls.def(
"getGaussianInstFluxErr", &SourceRecord::getGaussianInstFluxErr);
87 cls.def(
"getGaussianFluxFlag", &SourceRecord::getGaussianFluxFlag);
89 cls.def(
"getCalibInstFlux", &SourceRecord::getCalibInstFlux);
90 cls.def(
"getCalibInstFluxErr", &SourceRecord::getCalibInstFluxErr);
91 cls.def(
"getCalibFluxFlag", &SourceRecord::getCalibFluxFlag);
93 cls.def(
"getCentroid", &SourceRecord::getCentroid);
94 cls.def(
"getCentroidErr", &SourceRecord::getCentroidErr);
95 cls.def(
"getCentroidFlag", &SourceRecord::getCentroidFlag);
97 cls.def(
"getShape", &SourceRecord::getShape);
98 cls.def(
"getShapeErr", &SourceRecord::getShapeErr);
99 cls.def(
"getShapeFlag", &SourceRecord::getShapeFlag);
101 cls.def(
"getX", &SourceRecord::getX);
102 cls.def(
"getY", &SourceRecord::getY);
103 cls.def(
"getIxx", &SourceRecord::getIxx);
104 cls.def(
"getIyy", &SourceRecord::getIyy);
105 cls.def(
"getIxy", &SourceRecord::getIxy);
106 cls.def(
"updateCoord", (void (SourceRecord::*)(geom::SkyWcs const &)) & SourceRecord::updateCoord,
108 cls.def(
"updateCoord",
109 (void (SourceRecord::*)(geom::SkyWcs const &, PointKey<double> const &)) &
110 SourceRecord::updateCoord,
118 PySourceTable declareSourceTable(WrapperCollection &wrappers) {
119 return wrappers.wrapType(PySourceTable(wrappers.module,
"SourceTable"), [](
auto &mod,
auto &
cls) {
120 cls.def(
"clone", &SourceTable::clone);
121 cls.def_static(
"make",
122 (std::shared_ptr<SourceTable>(*)(Schema const &, std::shared_ptr<IdFactory> const &)) &
124 cls.def_static(
"make", (std::shared_ptr<SourceTable>(*)(Schema const &)) & SourceTable::make);
125 cls.def_static(
"makeMinimalSchema", &SourceTable::makeMinimalSchema);
126 cls.def_static(
"getParentKey", &SourceTable::getParentKey);
127 cls.def(
"copyRecord", (std::shared_ptr<SourceRecord>(SourceTable::*)(BaseRecord const &)) &
128 SourceTable::copyRecord);
129 cls.def(
"copyRecord",
130 (std::shared_ptr<SourceRecord>(SourceTable::*)(BaseRecord const &, SchemaMapper const &)) &
131 SourceTable::copyRecord);
132 cls.def(
"makeRecord", &SourceTable::makeRecord);
134 cls.def(
"getPsfFluxSlot", &SourceTable::getPsfFluxSlot);
135 cls.def(
"definePsfFlux", &SourceTable::definePsfFlux,
"name"_a);
137 cls.def(
"getModelFluxSlot", &SourceTable::getModelFluxSlot);
138 cls.def(
"defineModelFlux", &SourceTable::defineModelFlux,
"name"_a);
140 cls.def(
"getApFluxSlot", &SourceTable::getApFluxSlot);
141 cls.def(
"defineApFlux", &SourceTable::defineApFlux,
"name"_a);
143 cls.def(
"getGaussianFluxSlot", &SourceTable::getGaussianFluxSlot);
144 cls.def(
"defineGaussianFlux", &SourceTable::defineGaussianFlux,
"name"_a);
146 cls.def(
"getCalibFluxSlot", &SourceTable::getCalibFluxSlot);
147 cls.def(
"defineCalibFlux", &SourceTable::defineCalibFlux,
"name"_a);
149 cls.def(
"getCentroidSlot", &SourceTable::getCentroidSlot);
150 cls.def(
"defineCentroid", &SourceTable::defineCentroid,
"name"_a);
151 cls.def(
"getCentroidDefinition", &SourceTable::getCentroidDefinition);
152 cls.def(
"hasCentroidSlot", &SourceTable::hasCentroidSlot);
153 cls.def(
"getCentroidKey", &SourceTable::getCentroidKey);
154 cls.def(
"getCentroidErrKey", &SourceTable::getCentroidErrKey);
155 cls.def(
"getCentroidFlagKey", &SourceTable::getCentroidFlagKey);
157 cls.def(
"getShapeSlot", &SourceTable::getShapeSlot);
158 cls.def(
"defineShape", &SourceTable::defineShape,
"name"_a);
159 cls.def(
"getShapeDefinition", &SourceTable::getShapeDefinition);
160 cls.def(
"hasShapeSlot", &SourceTable::hasShapeSlot);
161 cls.def(
"getShapeKey", &SourceTable::getShapeKey);
162 cls.def(
"getShapeErrKey", &SourceTable::getShapeErrKey);
163 cls.def(
"getShapeFlagKey", &SourceTable::getShapeFlagKey);
167 PySourceColumnView declareSourceColumnView(WrapperCollection &wrappers) {
168 table::python::declareColumnView<SourceRecord>(wrappers,
"Source",
true);
169 return wrappers.wrapType(PySourceColumnView(wrappers.module,
"SourceColumnView"),
170 [](
auto &mod,
auto &
cls) {
171 using Class = SourceColumnViewT<SourceRecord>;
172 cls.def(
"getPsfInstFlux", &Class::getPsfInstFlux);
173 cls.def(
"getPsfInstFluxErr", &Class::getPsfInstFluxErr);
174 cls.def(
"getApInstFlux", &Class::getApInstFlux);
175 cls.def(
"getApInstFluxErr", &Class::getApInstFluxErr);
176 cls.def(
"getModelInstFlux", &Class::getModelInstFlux);
177 cls.def(
"getModelInstFluxErr", &Class::getModelInstFluxErr);
178 cls.def(
"getGaussianInstFlux", &Class::getGaussianInstFlux);
179 cls.def(
"getGaussianInstFluxErr", &Class::getGaussianInstFluxErr);
180 cls.def(
"getCalibInstFlux", &Class::getCalibInstFlux);
181 cls.def(
"getCalibInstFluxErr", &Class::getCalibInstFluxErr);
182 cls.def(
"getX", &Class::getX);
183 cls.def(
"getY", &Class::getY);
184 cls.def(
"getIxx", &Class::getIxx);
185 cls.def(
"getIyy", &Class::getIyy);
186 cls.def(
"getIxy", &Class::getIxy);
199 auto &mod = wrappers.
module;
201 mod.attr(
"SOURCE_IO_NO_HEAVY_FOOTPRINTS") =
204 auto clsSourceRecord = declareSourceRecord(wrappers);
205 auto clsSourceTable = declareSourceTable(wrappers);
206 auto clsSourceColumnView = declareSourceColumnView(wrappers);
207 auto clsSourceCatalog = table::python::declareSortedCatalog<SourceRecord>(wrappers,
"Source");
209 clsSourceRecord.attr(
"Table") = clsSourceTable;
210 clsSourceRecord.attr(
"ColumnView") = clsSourceColumnView;
211 clsSourceRecord.attr(
"Catalog") = clsSourceCatalog;
212 clsSourceTable.attr(
"Record") = clsSourceRecord;
213 clsSourceTable.attr(
"ColumnView") = clsSourceColumnView;
214 clsSourceTable.attr(
"Catalog") = clsSourceCatalog;
215 clsSourceCatalog.attr(
"Record") = clsSourceRecord;
216 clsSourceCatalog.attr(
"Table") = clsSourceTable;
217 clsSourceCatalog.attr(
"ColumnView") = clsSourceColumnView;
pybind11::module module
The module object passed to the PYBIND11_MODULE block that contains this WrapperCollection.
A base class for image defects.
Read/write heavy footprints as non-heavy footprints.
void wrapSource(WrapperCollection &wrappers)
Do not read/write footprints at all.
A helper class for subdividing pybind11 module across multiple translation units (i.e.