23 #include "pybind11/pybind11.h" 24 #include "pybind11/eigen.h" 28 #include "ndarray/pybind11.h" 48 using PySourceRecord = py::class_<SourceRecord, std::shared_ptr<SourceRecord>, SimpleRecord>;
49 using PySourceTable = py::class_<SourceTable, std::shared_ptr<SourceTable>, SimpleTable>;
50 using PySourceColumnView =
52 ColumnViewT<SourceRecord>>;
57 PySourceRecord declareSourceRecord(
py::module &mod) {
58 PySourceRecord
cls(mod,
"SourceRecord");
59 cls.def(
"getFootprint", &SourceRecord::getFootprint);
60 cls.def(
"setFootprint", &SourceRecord::setFootprint);
61 cls.def(
"getTable", &SourceRecord::getTable);
62 cls.def_property_readonly(
"table", &SourceRecord::getTable);
64 cls.def(
"getParent", &SourceRecord::getParent);
65 cls.def(
"setParent", &SourceRecord::setParent,
"id"_a);
67 cls.def(
"getPsfInstFlux", &SourceRecord::getPsfInstFlux);
68 cls.def(
"getPsfInstFluxErr", &SourceRecord::getPsfInstFluxErr);
69 cls.def(
"getPsfFluxFlag", &SourceRecord::getPsfFluxFlag);
71 cls.def(
"getModelInstFlux", &SourceRecord::getModelInstFlux);
72 cls.def(
"getModelInstFluxErr", &SourceRecord::getModelInstFluxErr);
73 cls.def(
"getModelFluxFlag", &SourceRecord::getModelFluxFlag);
75 cls.def(
"getApInstFlux", &SourceRecord::getApInstFlux);
76 cls.def(
"getApInstFluxErr", &SourceRecord::getApInstFluxErr);
77 cls.def(
"getApFluxFlag", &SourceRecord::getApFluxFlag);
79 cls.def(
"getGaussianInstFlux", &SourceRecord::getGaussianInstFlux);
80 cls.def(
"getGaussianInstFluxErr", &SourceRecord::getGaussianInstFluxErr);
81 cls.def(
"getGaussianFluxFlag", &SourceRecord::getGaussianFluxFlag);
83 cls.def(
"getCalibInstFlux", &SourceRecord::getCalibInstFlux);
84 cls.def(
"getCalibInstFluxErr", &SourceRecord::getCalibInstFluxErr);
85 cls.def(
"getCalibFluxFlag", &SourceRecord::getCalibFluxFlag);
87 cls.def(
"getCentroid", &SourceRecord::getCentroid);
88 cls.def(
"getCentroidErr", &SourceRecord::getCentroidErr);
89 cls.def(
"getCentroidFlag", &SourceRecord::getCentroidFlag);
91 cls.def(
"getShape", &SourceRecord::getShape);
92 cls.def(
"getShapeErr", &SourceRecord::getShapeErr);
93 cls.def(
"getShapeFlag", &SourceRecord::getShapeFlag);
95 cls.def(
"getX", &SourceRecord::getX);
96 cls.def(
"getY", &SourceRecord::getY);
97 cls.def(
"getIxx", &SourceRecord::getIxx);
98 cls.def(
"getIyy", &SourceRecord::getIyy);
99 cls.def(
"getIxy", &SourceRecord::getIxy);
100 cls.def(
"updateCoord", (
void (SourceRecord::*)(geom::SkyWcs
const &)) & SourceRecord::updateCoord,
102 cls.def(
"updateCoord",
103 (
void (SourceRecord::*)(geom::SkyWcs
const &, PointKey<double>
const &)) &
104 SourceRecord::updateCoord,
112 PySourceTable declareSourceTable(
py::module &mod) {
113 PySourceTable
cls(mod,
"SourceTable");
115 cls.def_static(
"make",
119 cls.def_static(
"makeMinimalSchema", &SourceTable::makeMinimalSchema);
120 cls.def_static(
"getParentKey", &SourceTable::getParentKey);
121 cls.def(
"copyRecord",
123 cls.def(
"copyRecord",
125 SourceTable::copyRecord);
126 cls.def(
"makeRecord", &SourceTable::makeRecord);
128 cls.def(
"getPsfFluxSlot", &SourceTable::getPsfFluxSlot);
129 cls.def(
"definePsfFlux", &SourceTable::definePsfFlux,
"name"_a);
131 cls.def(
"getModelFluxSlot", &SourceTable::getModelFluxSlot);
132 cls.def(
"defineModelFlux", &SourceTable::defineModelFlux,
"name"_a);
134 cls.def(
"getApFluxSlot", &SourceTable::getApFluxSlot);
135 cls.def(
"defineApFlux", &SourceTable::defineApFlux,
"name"_a);
137 cls.def(
"getGaussianFluxSlot", &SourceTable::getGaussianFluxSlot);
138 cls.def(
"defineGaussianFlux", &SourceTable::defineGaussianFlux,
"name"_a);
140 cls.def(
"getCalibFluxSlot", &SourceTable::getCalibFluxSlot);
141 cls.def(
"defineCalibFlux", &SourceTable::defineCalibFlux,
"name"_a);
143 cls.def(
"getCentroidSlot", &SourceTable::getCentroidSlot);
144 cls.def(
"defineCentroid", &SourceTable::defineCentroid,
"name"_a);
145 cls.def(
"getCentroidDefinition", &SourceTable::getCentroidDefinition);
146 cls.def(
"hasCentroidSlot", &SourceTable::hasCentroidSlot);
147 cls.def(
"getCentroidKey", &SourceTable::getCentroidKey);
148 cls.def(
"getCentroidErrKey", &SourceTable::getCentroidErrKey);
149 cls.def(
"getCentroidFlagKey", &SourceTable::getCentroidFlagKey);
151 cls.def(
"getShapeSlot", &SourceTable::getShapeSlot);
152 cls.def(
"defineShape", &SourceTable::defineShape,
"name"_a);
153 cls.def(
"getShapeDefinition", &SourceTable::getShapeDefinition);
154 cls.def(
"hasShapeSlot", &SourceTable::hasShapeSlot);
155 cls.def(
"getShapeKey", &SourceTable::getShapeKey);
156 cls.def(
"getShapeErrKey", &SourceTable::getShapeErrKey);
157 cls.def(
"getShapeFlagKey", &SourceTable::getShapeFlagKey);
162 PySourceColumnView declareSourceColumnView(
py::module &mod) {
163 table::python::declareColumnView<SourceRecord>(mod,
"Source",
true);
164 PySourceColumnView
cls(mod,
"SourceColumnView");
166 cls.def(
"getPsfInstFlux", &SourceColumnView::getPsfInstFlux);
167 cls.def(
"getPsfInstFluxErr", &SourceColumnView::getPsfInstFluxErr);
168 cls.def(
"getApInstFlux", &SourceColumnView::getApInstFlux);
169 cls.def(
"getApInstFluxErr", &SourceColumnView::getApInstFluxErr);
170 cls.def(
"getModelInstFlux", &SourceColumnView::getModelInstFlux);
171 cls.def(
"getModelInstFluxErr", &SourceColumnView::getModelInstFluxErr);
172 cls.def(
"getGaussianInstFlux", &SourceColumnView::getGaussianInstFlux);
173 cls.def(
"getGaussianInstFluxErr", &SourceColumnView::getGaussianInstFluxErr);
174 cls.def(
"getCalibInstFlux", &SourceColumnView::getCalibInstFlux);
175 cls.def(
"getCalibInstFluxErr", &SourceColumnView::getCalibInstFluxErr);
176 cls.def(
"getX", &SourceColumnView::getX);
177 cls.def(
"getY", &SourceColumnView::getY);
178 cls.def(
"getIxx", &SourceColumnView::getIxx);
179 cls.def(
"getIyy", &SourceColumnView::getIyy);
180 cls.def(
"getIxy", &SourceColumnView::getIxy);
185 py::module::import(
"lsst.afw.geom.ellipses");
186 py::module::import(
"lsst.afw.table.simple");
187 py::module::import(
"lsst.afw.table.aggregates");
188 py::module::import(
"lsst.afw.table.slots");
194 mod.attr(
"SOURCE_IO_NO_HEAVY_FOOTPRINTS") =
197 auto clsSourceRecord = declareSourceRecord(mod);
198 auto clsSourceTable = declareSourceTable(mod);
199 auto clsSourceColumnView = declareSourceColumnView(mod);
200 auto clsSourceCatalog = table::python::declareSortedCatalog<SourceRecord>(mod,
"Source");
202 clsSourceRecord.attr(
"Table") = clsSourceTable;
203 clsSourceRecord.attr(
"ColumnView") = clsSourceColumnView;
204 clsSourceRecord.attr(
"Catalog") = clsSourceCatalog;
205 clsSourceTable.attr(
"Record") = clsSourceRecord;
206 clsSourceTable.attr(
"ColumnView") = clsSourceColumnView;
207 clsSourceTable.attr(
"Catalog") = clsSourceCatalog;
208 clsSourceCatalog.attr(
"Record") = clsSourceRecord;
209 clsSourceCatalog.attr(
"Table") = clsSourceTable;
210 clsSourceCatalog.attr(
"ColumnView") = clsSourceColumnView;
PYBIND11_MODULE(camera, mod)
A base class for image defects.
SourceColumnViewT< SourceRecord > SourceColumnView
const char * source()
Source function that allows astChannel to source from a Stream.
Read/write heavy footprints as non-heavy footprints.
Do not read/write footprints at all.