lsst.jointcal  master-g9041cab851
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
gtransfo.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/Frame.h"
26 #include "lsst/jointcal/Gtransfo.h"
28 
29 namespace py = pybind11;
30 using namespace pybind11::literals;
31 
32 namespace lsst {
33 namespace jointcal {
34 namespace {
35 
36 void declareGtransfo(py::module &mod) {
37  py::class_<Gtransfo, std::shared_ptr<Gtransfo>> cls(mod, "Gtransfo");
38 
39  cls.def("__str__", &Gtransfo::__str__);
40 }
41 
42 void declareGtransfoIdentity(py::module &mod) {
43  py::class_<GtransfoIdentity, std::shared_ptr<GtransfoIdentity>, Gtransfo> cls(mod, "GtransfoIdentity");
44 }
45 
46 void declareGtransfoPoly(py::module &mod) {
47  py::class_<GtransfoPoly, std::shared_ptr<GtransfoPoly>, Gtransfo> cls(mod, "GtransfoPoly");
48 }
49 
50 void declareGtransfoLin(py::module &mod) {
51  py::class_<GtransfoLin, std::shared_ptr<GtransfoLin>, GtransfoPoly> cls(mod, "GtransfoLin");
52 }
53 
54 void declareGtransfoLinShift(py::module &mod) {
55  py::class_<GtransfoLinShift, std::shared_ptr<GtransfoLinShift>, GtransfoLin> cls(mod, "GtransfoLinShift");
56 }
57 
58 void declareGtransfoLinRot(py::module &mod) {
59  py::class_<GtransfoLinRot, std::shared_ptr<GtransfoLinRot>, GtransfoLin> cls(mod, "GtransfoLinRot");
60 }
61 
62 void declareGtransfoLinScale(py::module &mod) {
63  py::class_<GtransfoLinScale, std::shared_ptr<GtransfoLinScale>, GtransfoLin> cls(mod, "GtransfoLinScale");
64 }
65 
66 void declareBaseTanWcs(py::module &mod) {
67  py::class_<BaseTanWcs, std::shared_ptr<BaseTanWcs>, Gtransfo> cls(mod, "BaseTanWcs");
68 }
69 
70 void declareTanPix2RaDec(py::module &mod) {
71  py::class_<TanPix2RaDec, std::shared_ptr<TanPix2RaDec>, Gtransfo> cls(mod, "TanPix2RaDec");
72 }
73 
74 void declareTanRaDec2Pix(py::module &mod) {
75  py::class_<TanRaDec2Pix, std::shared_ptr<TanRaDec2Pix>, Gtransfo> cls(mod, "TanRaDec2Pix");
76 }
77 
78 void declareTanSipPix2RaDec(py::module &mod) {
79  py::class_<TanSipPix2RaDec, std::shared_ptr<TanSipPix2RaDec>, BaseTanWcs> cls(mod, "TanSipPix2RaDec");
80 }
81 
82 PYBIND11_PLUGIN(gtransfo) {
83  py::module::import("lsst.jointcal.frame");
84  py::module mod("gtransfo");
85 
86  declareGtransfo(mod);
87  declareGtransfoIdentity(mod);
88  declareGtransfoPoly(mod);
89  declareGtransfoLin(mod);
90  declareGtransfoLinShift(mod);
91  declareGtransfoLinRot(mod);
92  declareGtransfoLinScale(mod);
93  declareBaseTanWcs(mod);
94  declareTanPix2RaDec(mod);
95  declareTanRaDec2Pix(mod);
96  declareTanSipPix2RaDec(mod);
97 
98  // utility functions
99  mod.def("gtransfoToTanWcs", &gtransfoToTanWcs, py::return_value_policy::move); // from SipToGtransfo.h
100 
101  return mod.ptr();
102 }
103 } // namespace
104 } // namespace jointcal
105 } // namespace lsst
boost::shared_ptr< lsst::afw::image::TanWcs > gtransfoToTanWcs(const lsst::jointcal::TanSipPix2RaDec wcsTransfo, const lsst::jointcal::Frame &ccdFrame, const bool noLowOrderSipTerms=false)
Transform the other way around.