lsst.jointcal  master-g9041cab851+8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
astrometryModels.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 #include "pybind11/stl.h"
25 
26 #include "lsst/jointcal/CcdImage.h"
30 #include "lsst/jointcal/Gtransfo.h"
31 
32 namespace py = pybind11;
33 using namespace pybind11::literals;
34 
35 namespace lsst {
36 namespace jointcal {
37 namespace {
38 
39 void declareAstrometryModel(py::module &mod) {
40  py::class_<AstrometryModel, std::shared_ptr<AstrometryModel>> cls(mod, "AstrometryModel");
41 
42  cls.def("produceSipWcs", &AstrometryModel::produceSipWcs);
43  cls.def("getMapping", &AstrometryModel::getMapping, py::return_value_policy::reference_internal);
44 }
45 
46 void declareSimplePolyModel(py::module &mod) {
47  py::class_<SimplePolyModel, std::shared_ptr<SimplePolyModel>, AstrometryModel> cls(mod,
48  "SimplePolyModel");
49 
50  cls.def(py::init<CcdImageList const &, const ProjectionHandler *, bool, unsigned, unsigned>(),
51  "ccdImageList"_a, "projectionHandler"_a, "initFromWcs"_a, "nNotFit"_a = 0, "degree"_a = 3);
52 }
53 
54 void declareConstrainedPolyModel(py::module &mod) {
55  py::class_<ConstrainedPolyModel, std::shared_ptr<ConstrainedPolyModel>, AstrometryModel> cls(
56  mod, "ConstrainedPolyModel");
57 
58  cls.def(py::init<CcdImageList const &, const ProjectionHandler *, bool, unsigned>(), "ccdImageList"_a,
59  "projectionHandler"_a, "initFromWcs"_a, "nNotFit"_a = 0);
60 }
61 
62 PYBIND11_PLUGIN(astrometryModels) {
63  py::module::import("lsst.jointcal.ccdImage");
64  py::module::import("lsst.jointcal.gtransfo");
65  py::module::import("lsst.jointcal.mappings");
66  py::module mod("astrometryModels");
67 
68  declareAstrometryModel(mod);
69  declareSimplePolyModel(mod);
70  declareConstrainedPolyModel(mod);
71 
72  return mod.ptr();
73 }
74 } // namespace
75 } // namespace jointcal
76 } // namespace lsst