24#include "pybind11/pybind11.h"
25#include "ndarray/pybind11.h"
51using namespace pybind11::literals;
57using utils::python::WrapperCollection;
61using PyExposureRecord = py::class_<ExposureRecord, std::shared_ptr<ExposureRecord>, BaseRecord>;
62using PyExposureTable = py::class_<ExposureTable, std::shared_ptr<ExposureTable>, BaseTable>;
63using PyExposureCatalog =
65 SortedCatalogT<ExposureRecord>>;
67PyExposureRecord declareExposureRecord(WrapperCollection &wrappers) {
68 return wrappers.wrapType(PyExposureRecord(wrappers.module,
"ExposureRecord"), [](
auto &mod,
auto &cls) {
69 cls.def(
"getId", &ExposureRecord::getId);
70 cls.def(
"setId", &ExposureRecord::setId,
"id"_a);
71 cls.def(
"getBBox", &ExposureRecord::getBBox);
72 cls.def(
"setBBox", &ExposureRecord::setBBox,
"bbox"_a);
73 cls.def(
"getTable", &ExposureRecord::getTable);
74 cls.def_property_readonly(
"table", &ExposureRecord::getTable);
76 (bool (ExposureRecord::*)(lsst::geom::SpherePoint const &, bool) const) &
77 ExposureRecord::contains,
78 "coord"_a,
"includeValidPolygon"_a = false);
80 (bool (ExposureRecord::*)(lsst::geom::Point2D const &, geom::SkyWcs const &, bool) const) &
81 ExposureRecord::contains,
82 "point"_a,
"wcs"_a,
"includeValidPolygon"_a = false);
83 cls.def(
"getWcs", &ExposureRecord::getWcs);
84 cls.def(
"setWcs", &ExposureRecord::setWcs,
"wcs"_a);
85 cls.def(
"getPsf", &ExposureRecord::getPsf);
86 cls.def(
"setPsf", &ExposureRecord::setPsf,
"psf"_a);
88 cls.def(
"getPhotoCalib", &ExposureRecord::getPhotoCalib);
89 cls.def(
"setPhotoCalib", &ExposureRecord::setPhotoCalib,
"photoCalib"_a);
90 cls.def(
"getApCorrMap", &ExposureRecord::getApCorrMap);
91 cls.def(
"setApCorrMap", &ExposureRecord::setApCorrMap,
"apCorrMap"_a);
92 cls.def(
"getValidPolygon", &ExposureRecord::getValidPolygon);
95 cls.def(
"setValidPolygon",
96 [](ExposureRecord &self, py::object polygon) {
97 if (polygon.is(py::none())) {
98 self.setValidPolygon(nullptr);
100 self.setValidPolygon(py::cast<std::shared_ptr<afw::geom::polygon::Polygon>>(polygon));
114PyExposureTable declareExposureTable(WrapperCollection &wrappers) {
115 return wrappers.wrapType(PyExposureTable(wrappers.module,
"ExposureTable"), [](
auto &mod,
auto &cls) {
116 cls.def_static(
"make", &ExposureTable::make);
117 cls.def_static(
"makeMinimalSchema", &ExposureTable::makeMinimalSchema);
118 cls.def_static(
"checkSchema", &ExposureTable::checkSchema,
"schema"_a);
120 cls.def_static(
"getIdKey", &ExposureTable::getIdKey);
121 cls.def_static(
"getBBoxMinKey", &ExposureTable::getBBoxMinKey);
122 cls.def_static(
"getBBoxMaxKey", &ExposureTable::getBBoxMaxKey);
124 cls.def(
"clone", &ExposureTable::clone);
125 cls.def(
"makeRecord", &ExposureTable::makeRecord);
126 cls.def(
"copyRecord", (std::shared_ptr<ExposureRecord>(ExposureTable::*)(BaseRecord const &)) &
127 ExposureTable::copyRecord);
128 cls.def(
"copyRecord", (std::shared_ptr<ExposureRecord>(ExposureTable::*)(BaseRecord const &,
129 SchemaMapper const &)) &
130 ExposureTable::copyRecord);
134PyExposureCatalog declareExposureCatalog(WrapperCollection &wrappers) {
135 using Catalog = ExposureCatalogT<ExposureRecord>;
136 table::python::declareSortedCatalog<ExposureRecord>(wrappers,
"Exposure",
true);
140 return wrappers.wrapType(
141 PyExposureCatalog(wrappers.module,
"ExposureCatalog", py::dynamic_attr()),
142 [](
auto &mod,
auto &cls) {
143 cls.def(py::init<Schema const &>(),
"schema"_a);
144 cls.def(py::init<std::shared_ptr<ExposureTable> const &>(),
145 "table"_a = std::shared_ptr<ExposureTable>());
146 cls.def(py::init<Catalog const &>(),
"other"_a);
149 cls.def_static(
"readFits", (Catalog(*)(std::string const &, int, int)) & Catalog::readFits,
150 "filename"_a,
"hdu"_a = fits::DEFAULT_HDU,
"flags"_a = 0);
151 cls.def_static(
"readFits", (Catalog(*)(fits::MemFileManager &, int, int)) & Catalog::readFits,
152 "manager"_a,
"hdu"_a = fits::DEFAULT_HDU,
"flags"_a = 0);
156 (Catalog(Catalog::*)(ndarray::Array<bool const, 1> const &) const) & Catalog::subset,
159 (Catalog(Catalog::*)(std::ptrdiff_t, std::ptrdiff_t, std::ptrdiff_t) const) &
161 "startd"_a,
"stopd"_a,
"step"_a);
162 cls.def(
"subsetContaining",
163 (Catalog(Catalog::*)(lsst::geom::SpherePoint const &, bool) const) &
164 Catalog::subsetContaining,
165 "coord"_a,
"includeValidPolygon"_a = false);
166 cls.def(
"subsetContaining",
167 (Catalog(Catalog::*)(lsst::geom::Point2D const &, geom::SkyWcs const &, bool) const) &
168 Catalog::subsetContaining,
169 "point"_a,
"wcs"_a,
"includeValidPolygon"_a = false);
181 auto clsExposureRecord = declareExposureRecord(wrappers);
182 auto clsExposureTable = declareExposureTable(wrappers);
183 auto clsExposureColumnView = table::python::declareColumnView<ExposureRecord>(wrappers,
"Exposure");
184 auto clsExposureCatalog = declareExposureCatalog(wrappers);
186 clsExposureRecord.attr(
"Table") = clsExposureTable;
187 clsExposureRecord.attr(
"ColumnView") = clsExposureColumnView;
188 clsExposureRecord.attr(
"Catalog") = clsExposureCatalog;
189 clsExposureTable.attr(
"Record") = clsExposureRecord;
190 clsExposureTable.attr(
"ColumnView") = clsExposureColumnView;
191 clsExposureTable.attr(
"Catalog") = clsExposureCatalog;
192 clsExposureCatalog.attr(
"Record") = clsExposureRecord;
193 clsExposureCatalog.attr(
"Table") = clsExposureTable;
194 clsExposureCatalog.attr(
"ColumnView") = clsExposureColumnView;
Implementation of the Photometric Calibration class.
void setVisitInfo(std::shared_ptr< image::VisitInfo const > visitInfo)
std::shared_ptr< image::VisitInfo const > getVisitInfo() const
std::shared_ptr< image::TransmissionCurve const > getTransmissionCurve() const
void setTransmissionCurve(std::shared_ptr< image::TransmissionCurve const > transmissionCurve)
std::shared_ptr< cameraGeom::Detector const > getDetector() const
void setDetector(std::shared_ptr< cameraGeom::Detector const > detector)
void wrapExposure(WrapperCollection &wrappers)
A base class for image defects.