lsst.afw  13.0-98-g5a654715e+2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tanWcs.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 "numpy/arrayobject.h"
26 #include "ndarray/pybind11.h"
27 
28 #include "lsst/afw/image/TanWcs.h"
29 #include "lsst/afw/image/Wcs.h"
31 
33 
34 namespace py = pybind11;
35 using namespace py::literals;
36 
37 namespace lsst {
38 namespace afw {
39 namespace image {
40 
41 using PyTanWcs = py::class_<TanWcs, std::shared_ptr<TanWcs>, table::io::PersistableFacade<TanWcs>, Wcs>;
42 
43 PYBIND11_PLUGIN(tanWcs) {
44  py::module mod("tanWcs");
45 
46  py::module::import("lsst.afw.image.wcs");
47 
48  if (_import_array() < 0) {
49  PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
50  return nullptr;
51  }
52 
53  table::io::python::declarePersistableFacade<TanWcs>(mod, "TanWcs");
54 
55  PyTanWcs cls(mod, "TanWcs");
56 
57  cls.def(py::init<geom::Point2D const &, geom::Point2D const &, Eigen::Matrix2d const &, double,
58  std::string const &, std::string const &, std::string const &>(),
59  "crval"_a, "crpix"_a, "cd"_a, "equinox"_a = 2000, "raDecSys"_a = "FK5", "crunits1"_a = "deg",
60  "crunits2"_a = "deg");
61  cls.def(py::init<geom::Point2D const &, geom::Point2D const &, Eigen::Matrix2d const &,
62  Eigen::MatrixXd const &, Eigen::MatrixXd const &, Eigen::MatrixXd const &,
63  Eigen::MatrixXd const &, double, std::string const &, std::string const &,
64  std::string const &>(),
65  "crval"_a, "crpix"_a, "cd"_a, "sipA"_a, "sipB"_a, "sipAp"_a, "sipBp"_a, "equinox"_a = 2000,
66  "raDecSys"_a = "FK5", "cunits1"_a = "deg", "cunits2"_a = "deg");
67 
68  /* Operators */
69  cls.def("__eq__", &TanWcs::operator==, py::is_operator());
70  cls.def("__ne__", &TanWcs::operator!=, py::is_operator());
71 
72  /* Members */
73  cls.def_static("decodeSipHeader", TanWcs::decodeSipHeader);
74  cls.def("clone", &TanWcs::clone);
75  cls.def("pixelScale", &TanWcs::pixelScale);
76  cls.def("distortPixel", &TanWcs::distortPixel);
77  cls.def("undistortPixel", &TanWcs::undistortPixel);
78  cls.def("hasDistortion", &TanWcs::hasDistortion);
79  cls.def("getFitsMetadata", &TanWcs::getFitsMetadata);
80  cls.def("setDistortionMatrices", &TanWcs::setDistortionMatrices);
81  cls.def("getSipA", &TanWcs::getSipA, py::return_value_policy::copy);
82  cls.def("getSipB", &TanWcs::getSipB, py::return_value_policy::copy);
83  cls.def("getSipAp", &TanWcs::getSipAp, py::return_value_policy::copy);
84  cls.def("getSipBp", &TanWcs::getSipBp, py::return_value_policy::copy);
85  cls.def("isPersistable", &TanWcs::isPersistable);
86 
87  return mod.ptr();
88 }
89 }
90 }
91 } // lsst::afw::image
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:104
PYBIND11_PLUGIN(_cameraPoint)
Definition: cameraPoint.cc:35
double const _a
Definition: RandomImage.cc:77
py::class_< TanWcs, std::shared_ptr< TanWcs >, table::io::PersistableFacade< TanWcs >, Wcs > PyTanWcs
Definition: tanWcs.cc:41
afw::table::Key< afw::table::Array< ImagePixelT > > image