lsst.jointcal  master-ge1f85bc4d5+2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mappings.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  *
4  * This product includes software developed by the
5  * LSST Project (http://www.lsst.org/).
6  * See the COPYRIGHT file
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/jointcal/Gtransfo.h"
26 #include "lsst/jointcal/Mapping.h"
28 
29 namespace py = pybind11;
30 using namespace pybind11::literals;
31 
32 namespace lsst {
33 namespace jointcal {
34 namespace {
35 
36 void declareMapping(py::module &mod) {
37  py::class_<Mapping, std::shared_ptr<Mapping>> cls(mod, "Mapping");
38 
39  cls.def("getNpar", &Mapping::getNpar);
40 }
41 
42 void declareTwoTransfoMapping(py::module &mod) {
43  py::class_<TwoTransfoMapping, std::shared_ptr<TwoTransfoMapping>, Mapping> cls(mod, "TwoTransfoMapping");
44 
45  cls.def("getTransfo1", &TwoTransfoMapping::getTransfo1, py::return_value_policy::reference_internal);
46  cls.def_property_readonly("transfo1", &TwoTransfoMapping::getTransfo1,
47  py::return_value_policy::reference_internal);
48 
49  cls.def("getTransfo2", &TwoTransfoMapping::getTransfo2, py::return_value_policy::reference_internal);
50  cls.def_property_readonly("transfo2", &TwoTransfoMapping::getTransfo2,
51  py::return_value_policy::reference_internal);
52 }
53 
54 void declareSimpleGtransfoMapping(py::module &mod) {
55  py::class_<SimpleGtransfoMapping, std::shared_ptr<SimpleGtransfoMapping>, Mapping> cls(
56  mod, "SimpleGtransfoMapping");
57 }
58 
59 void declareSimplePolyMapping(py::module &mod) {
60  py::class_<SimplePolyMapping, std::shared_ptr<SimplePolyMapping>, SimpleGtransfoMapping> cls(
61  mod, "SimplePolyMapping");
62 }
63 
64 PYBIND11_PLUGIN(mappings) {
65  py::module::import("lsst.jointcal.star");
66  py::module::import("lsst.jointcal.gtransfo");
67  py::module mod("mappings");
68 
69  declareMapping(mod);
70  declareTwoTransfoMapping(mod);
71  declareSimpleGtransfoMapping(mod);
72  declareSimplePolyMapping(mod);
73 
74  return mod.ptr();
75 }
76 } // namespace
77 } // namespace jointcal
78 } // namespace lsst