23 #include "pybind11/pybind11.h" 24 #include "ndarray/pybind11.h" 56 using PyExposureRecord = py::class_<ExposureRecord, std::shared_ptr<ExposureRecord>, BaseRecord>;
57 using PyExposureTable = py::class_<ExposureTable, std::shared_ptr<ExposureTable>, BaseTable>;
58 using PyExposureCatalog =
60 SortedCatalogT<ExposureRecord>>;
62 PyExposureRecord declareExposureRecord(
py::module &mod) {
63 PyExposureRecord
cls(mod,
"ExposureRecord");
64 cls.def(
"getId", &ExposureRecord::getId);
65 cls.def(
"setId", &ExposureRecord::setId,
"id"_a);
66 cls.def(
"getBBox", &ExposureRecord::getBBox);
67 cls.def(
"setBBox", &ExposureRecord::setBBox,
"bbox"_a);
68 cls.def(
"getTable", &ExposureRecord::getTable);
69 cls.def_property_readonly(
"table", &ExposureRecord::getTable);
73 "coord"_a,
"includeValidPolygon"_a =
false);
76 ExposureRecord::contains,
77 "point"_a,
"wcs"_a,
"includeValidPolygon"_a =
false);
78 cls.def(
"getWcs", &ExposureRecord::getWcs);
79 cls.def(
"setWcs", &ExposureRecord::setWcs,
"wcs"_a);
80 cls.def(
"getPsf", &ExposureRecord::getPsf);
81 cls.def(
"setPsf", &ExposureRecord::setPsf,
"psf"_a);
84 cls.def(
"_getCalib", &ExposureRecord::getCalib);
85 cls.def(
"_setCalib", &ExposureRecord::setCalib,
"photoCalib"_a);
87 cls.def(
"getPhotoCalib", &ExposureRecord::getPhotoCalib);
88 cls.def(
"setPhotoCalib", &ExposureRecord::setPhotoCalib,
"photoCalib"_a);
89 cls.def(
"getApCorrMap", &ExposureRecord::getApCorrMap);
90 cls.def(
"setApCorrMap", &ExposureRecord::setApCorrMap,
"apCorrMap"_a);
91 cls.def(
"getValidPolygon", &ExposureRecord::getValidPolygon);
94 cls.def(
"setValidPolygon",
95 [](ExposureRecord &
self, py::object polygon) {
96 if (polygon.is(py::none())) {
97 self.setValidPolygon(
nullptr);
104 cls.def(
"getVisitInfo", &ExposureRecord::getVisitInfo);
105 cls.def(
"setVisitInfo", &ExposureRecord::setVisitInfo,
"visitInfo"_a);
106 cls.def(
"getTransmissionCurve", &ExposureRecord::getTransmissionCurve);
107 cls.def(
"setTransmissionCurve", &ExposureRecord::setTransmissionCurve,
"transmissionCurve"_a);
108 cls.def(
"getDetector", &ExposureRecord::getDetector);
109 cls.def(
"setDetector", &ExposureRecord::setDetector,
"detector"_a);
113 PyExposureTable declareExposureTable(
py::module &mod) {
114 PyExposureTable
cls(mod,
"ExposureTable");
115 cls.def_static(
"make", &ExposureTable::make);
116 cls.def_static(
"makeMinimalSchema", &ExposureTable::makeMinimalSchema);
117 cls.def_static(
"checkSchema", &ExposureTable::checkSchema,
"schema"_a);
119 cls.def_static(
"getIdKey", &ExposureTable::getIdKey);
120 cls.def_static(
"getBBoxMinKey", &ExposureTable::getBBoxMinKey);
121 cls.def_static(
"getBBoxMaxKey", &ExposureTable::getBBoxMaxKey);
124 cls.def(
"makeRecord", &ExposureTable::makeRecord);
126 ExposureTable::copyRecord);
127 cls.def(
"copyRecord",
129 ExposureTable::copyRecord);
133 PyExposureCatalog declareExposureCatalog(
py::module &mod) {
134 using Catalog = ExposureCatalogT<ExposureRecord>;
135 table::python::declareSortedCatalog<ExposureRecord>(mod,
"Exposure",
true);
138 PyExposureCatalog
cls(mod,
"ExposureCatalog", py::dynamic_attr());
140 cls.def(py::init<Schema const &>(),
"schema"_a);
142 cls.def(py::init<Catalog const &>(),
"other"_a);
144 cls.def_static(
"readFits", (Catalog(*)(
std::string const &,
int,
int)) & Catalog::readFits,
"filename"_a,
146 cls.def_static(
"readFits", (Catalog(*)(fits::MemFileManager &,
int,
int)) & Catalog::readFits,
150 cls.def(
"subset", (Catalog(Catalog::*)(ndarray::Array<bool const, 1>
const &)
const) & Catalog::subset,
154 "startd"_a,
"stopd"_a,
"step"_a);
155 cls.def(
"subsetContaining",
157 "coord"_a,
"includeValidPolygon"_a =
false);
158 cls.def(
"subsetContaining",
160 Catalog::subsetContaining,
161 "point"_a,
"wcs"_a,
"includeValidPolygon"_a =
false);
168 py::module::import(
"lsst.afw.table.simple");
169 py::module::import(
"lsst.afw.geom");
172 auto clsExposureRecord = declareExposureRecord(mod);
173 auto clsExposureTable = declareExposureTable(mod);
174 auto clsExposureColumnView = table::python::declareColumnView<ExposureRecord>(mod,
"Exposure");
175 auto clsExposureCatalog = declareExposureCatalog(mod);
177 clsExposureRecord.attr(
"Table") = clsExposureTable;
178 clsExposureRecord.attr(
"ColumnView") = clsExposureColumnView;
179 clsExposureRecord.attr(
"Catalog") = clsExposureCatalog;
180 clsExposureTable.attr(
"Record") = clsExposureRecord;
181 clsExposureTable.attr(
"ColumnView") = clsExposureColumnView;
182 clsExposureTable.attr(
"Catalog") = clsExposureCatalog;
183 clsExposureCatalog.attr(
"Record") = clsExposureRecord;
184 clsExposureCatalog.attr(
"Table") = clsExposureTable;
185 clsExposureCatalog.attr(
"ColumnView") = clsExposureColumnView;
bool contains(VertexIterator const begin, VertexIterator const end, UnitVector3d const &v)
A base class for image defects.
Point in an unspecified spherical coordinate system.
PYBIND11_MODULE(exposure, mod)
Implementation of the Photometric Calibration class.
const int DEFAULT_HDU
Specify that the default HDU should be read.