lsst.afw  13.0-91-g2a3e2ee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
apCorrMap.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 #include "pybind11/stl.h"
25 
26 #include <string>
27 #include <vector>
28 
30 
33 
34 namespace py = pybind11;
35 using namespace pybind11::literals;
36 
37 namespace lsst {
38 namespace afw {
39 namespace image {
40 namespace {
41 
42 using PyApCorrMap = py::class_<ApCorrMap, std::shared_ptr<ApCorrMap>, table::io::PersistableFacade<ApCorrMap>,
43  table::io::Persistable>;
44 
45 PYBIND11_PLUGIN(apCorrMap) {
46  py::module mod("apCorrMap");
47 
48  py::module::import("lsst.afw.table.io");
49 
50  /* Declare CRTP base class. */
51  table::io::python::declarePersistableFacade<ApCorrMap>(mod, "ApCorrMap");
52 
53  PyApCorrMap cls(mod, "ApCorrMap");
54 
55  /* Constructors */
56  cls.def(py::init<>());
57 
58  /* Operators */
59  cls.def("__imul__", &ApCorrMap::operator*=);
60  cls.def("__itruediv__", &ApCorrMap::operator/=);
61 
62  /* Members */
63  cls.def("get", &ApCorrMap::get);
64  cls.def("set", &ApCorrMap::set);
65  cls.def("items", [](ApCorrMap const& self) { return py::make_iterator(self.begin(), self.end()); },
66  py::keep_alive<0, 1>());
67  // values, keys, and __iter__ defined in apCorrMap.py
68 
69  cls.def("__len__", &ApCorrMap::size);
70  cls.def("__getitem__", &ApCorrMap::operator[]);
71  cls.def("__setitem__", &ApCorrMap::set);
72  cls.def("__contains__",
73  [](ApCorrMap const& self, std::string name) { return static_cast<bool>(self.get(name)); });
74 
75  return mod.ptr();
76 }
77 }
78 }
79 }
80 } // namespace lsst::afw::geom::<anonymous>
PYBIND11_PLUGIN(_cameraPoint)
Definition: cameraPoint.cc:35
table::Key< std::string > name
Definition: ApCorrMap.cc:71
afw::table::Key< afw::table::Array< ImagePixelT > > image
int end