lsst.afw  13.0-94-ga1c444047
exposureInfo.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2008-2017 AURA/LSST.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <https://www.lsstcorp.org/LegalNotices/>.
21  */
22 
23 #include "pybind11/pybind11.h"
24 
25 #include "lsst/daf/base/PropertySet.h"
27 #include "lsst/afw/detection/Psf.h"
30 #include "lsst/afw/image/Calib.h"
32 #include "lsst/afw/image/Filter.h"
34 #include "lsst/afw/image/Wcs.h"
36 
37 namespace py = pybind11;
38 using namespace py::literals;
39 
40 namespace lsst {
41 namespace afw {
42 namespace image {
43 namespace {
44 
45 using PyExposureInfo = py::class_<ExposureInfo, std::shared_ptr<ExposureInfo>>;
46 
48  py::module mod("exposureInfo");
49 
50  py::module::import("lsst.daf.base");
51  py::module::import("lsst.afw.image.wcs");
52  py::module::import("lsst.afw.image.calib");
53  py::module::import("lsst.afw.image.apCorrMap");
54  py::module::import("lsst.afw.image.coaddInputs");
55  py::module::import("lsst.afw.image.filter");
56  py::module::import("lsst.afw.image.visitInfo");
57 
58  /* Module level */
59  PyExposureInfo cls(mod, "ExposureInfo");
60 
61  /* Member types and enums */
62 
63  /* Constructors */
64  cls.def(py::init<std::shared_ptr<Wcs const> const &, std::shared_ptr<detection::Psf const> const &,
65  std::shared_ptr<Calib const> const &,
66  std::shared_ptr<cameraGeom::Detector const> const &,
67  std::shared_ptr<geom::polygon::Polygon const> const &, Filter const &,
68  std::shared_ptr<daf::base::PropertySet> const &, std::shared_ptr<CoaddInputs> const &,
69  std::shared_ptr<ApCorrMap> const &, std::shared_ptr<VisitInfo const>>(),
70  "wcs"_a = std::shared_ptr<Wcs const>(), "psf"_a = std::shared_ptr<detection::Psf const>(),
71  "calib"_a = std::shared_ptr<Calib const>(),
72  "detector"_a = std::shared_ptr<cameraGeom::Detector const>(),
73  "polygon"_a = std::shared_ptr<geom::polygon::Polygon const>(), "filter"_a = Filter(),
74  "metadata"_a = std::shared_ptr<daf::base::PropertySet>(),
75  "coaddInputs"_a = std::shared_ptr<CoaddInputs>(), "apCorrMap"_a = std::shared_ptr<ApCorrMap>(),
76  "visitInfo"_a = std::shared_ptr<VisitInfo const>());
77  cls.def(py::init<>());
78  cls.def(py::init<ExposureInfo>(), "other"_a);
79  cls.def(py::init<ExposureInfo, bool>(), "other"_a, "copyMetadata"_a);
80 
81  /* Members */
82  cls.def("hasWcs", &ExposureInfo::hasWcs);
83  cls.def("getWcs", (std::shared_ptr<Wcs> (ExposureInfo::*)()) & ExposureInfo::getWcs);
84  cls.def("setWcs", &ExposureInfo::setWcs, "wcs"_a);
85 
86  cls.def("hasDetector", &ExposureInfo::hasDetector);
87  cls.def("getDetector", &ExposureInfo::getDetector);
88  cls.def("setDetector",
89  [](ExposureInfo &self, py::object detector) {
90  if (detector == py::none()) {
91  self.setDetector(nullptr);
92  } else {
93  self.setDetector(py::cast<std::shared_ptr<afw::cameraGeom::Detector>>(detector));
94  }
95  },
96  "detector"_a);
97 
98  cls.def("getFilter", &ExposureInfo::getFilter);
99  cls.def("setFilter", &ExposureInfo::setFilter, "filter"_a);
100 
101  cls.def("hasCalib", &ExposureInfo::hasCalib);
102  cls.def("getCalib", (std::shared_ptr<Calib> (ExposureInfo::*)()) & ExposureInfo::getCalib);
103  cls.def("setCalib", &ExposureInfo::setCalib, "calib"_a);
104 
105  cls.def("getMetadata", &ExposureInfo::getMetadata);
106  cls.def("setMetadata", &ExposureInfo::setMetadata, "metadata"_a);
107 
108  cls.def("hasPsf", &ExposureInfo::hasPsf);
109  cls.def("getPsf", &ExposureInfo::getPsf);
110  cls.def("setPsf",
111  [](ExposureInfo &self, py::object psf) {
112  if (psf == py::none()) {
113  self.setPsf(nullptr);
114  } else {
115  self.setPsf(py::cast<std::shared_ptr<afw::detection::Psf>>(psf));
116  }
117  },
118  "psf"_a);
119 
120  cls.def("hasValidPolygon", &ExposureInfo::hasValidPolygon);
121  cls.def("getValidPolygon", &ExposureInfo::getValidPolygon);
122  cls.def("setValidPolygon",
123  [](ExposureInfo &self, py::object polygon) {
124  if (polygon == py::none()) {
125  self.setValidPolygon(nullptr);
126  } else {
127  self.setValidPolygon(py::cast<std::shared_ptr<afw::geom::polygon::Polygon>>(polygon));
128  }
129  },
130  "polygon"_a);
131 
132  cls.def("hasApCorrMap", &ExposureInfo::hasApCorrMap);
133  cls.def("getApCorrMap", (std::shared_ptr<ApCorrMap> (ExposureInfo::*)()) & ExposureInfo::getApCorrMap);
134  cls.def("setApCorrMap", &ExposureInfo::setApCorrMap, "apCorrMap"_a);
135  cls.def("initApCorrMap", &ExposureInfo::initApCorrMap);
136 
137  cls.def("hasCoaddInputs", &ExposureInfo::hasCoaddInputs);
138  cls.def("getCoaddInputs", &ExposureInfo::getCoaddInputs);
139  cls.def("setCoaddInputs", &ExposureInfo::setCoaddInputs, "coaddInputs"_a);
140 
141  cls.def("hasVisitInfo", &ExposureInfo::hasVisitInfo);
142  cls.def("getVisitInfo", &ExposureInfo::getVisitInfo);
143  cls.def("setVisitInfo", &ExposureInfo::setVisitInfo, "visitInfo"_a);
144 
145  return mod.ptr();
146 }
147 }
148 }
149 }
150 } // namespace lsst::afw::image::<anonymous>
PYBIND11_PLUGIN(_cameraPoint)
Definition: cameraPoint.cc:35
A base class for image defects.
Definition: cameraGeom.dox:3