lsst.afw  14.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
transformBoundedField.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 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 "numpy/arrayobject.h"
27 #include "ndarray/pybind11.h"
28 #include "ndarray/converter.h"
29 
30 #include "lsst/pex/config/python.h" // defines LSST_DECLARE_CONTROL_FIELD
32 
36 
37 namespace py = pybind11;
38 using namespace py::literals;
39 
40 namespace lsst {
41 namespace afw {
42 namespace math {
43 namespace {
44 
45 using ClsField = py::class_<TransformBoundedField, std::shared_ptr<TransformBoundedField>, BoundedField,
47 
48 PYBIND11_PLUGIN(_transformBoundedField) {
49  py::module mod("_transformBoundedField");
50 
51  if (_import_array() < 0) {
52  PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
53  return nullptr;
54  };
55 
56  /* Module level */
57  lsst::afw::table::io::python::declarePersistableFacade<TransformBoundedField>(mod,
58  "TransformBoundedField");
59  ClsField cls(mod, "TransformBoundedField");
60 
61  cls.def(py::init<lsst::afw::geom::Box2I const &, TransformBoundedField::Transform const &>(), "bbox"_a,
62  "transform"_a);
63 
64  cls.def("__mul__", &TransformBoundedField::operator*, py::is_operator());
65  cls.def("__eq__", &TransformBoundedField::operator==, py::is_operator());
66 
67  cls.def("getTransform", &TransformBoundedField::getTransform);
68  cls.def("evaluate", (double (BoundedField::*)(double, double) const) & BoundedField::evaluate);
69  cls.def("evaluate",
70  (ndarray::Array<double, 1, 1>(TransformBoundedField::*)(
71  ndarray::Array<double const, 1> const &, ndarray::Array<double const, 1> const &) const) &
72  TransformBoundedField::evaluate);
73  cls.def("evaluate", (double (TransformBoundedField::*)(lsst::afw::geom::Point2D const &) const) &
74  TransformBoundedField::evaluate);
75 
76  return mod.ptr();
77 }
78 
79 } // namespace
80 } // namespace math
81 } // namespace afw
82 } // namespace lsst
PYBIND11_PLUGIN(_cameraPoint)
Definition: cameraPoint.cc:35
double const _a
Definition: RandomImage.cc:77
py::class_< ChebyshevBoundedField, std::shared_ptr< ChebyshevBoundedField >, BoundedField > ClsField