lsst.shapelet  13.0-3-g20b541e+9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
functorKeys.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 #include "pybind11/pybind11.h"
23 #include "pybind11/stl.h"
24 
25 #include "lsst/afw/table/BaseRecord.h"
27 
28 namespace py = pybind11;
29 using namespace pybind11::literals;
30 
31 namespace lsst {
32 namespace shapelet {
33 
34 PYBIND11_PLUGIN(functorKeys) {
35  py::module::import("lsst.afw.table");
36  py::module mod("functorKeys");
37 
38  py::class_<ShapeletFunctionKey, std::shared_ptr<ShapeletFunctionKey>> clsShapeletFunctionKey(
39  mod, "ShapeletFunctionKey");
40 
41  clsShapeletFunctionKey.def(py::init<>());
42  clsShapeletFunctionKey.def(
43  py::init<afw::table::EllipseKey const &, afw::table::ArrayKey<double> const &, BasisTypeEnum>(),
44  "ellipse"_a, "coefficients"_a, "basisType"_a = HERMITE);
45  clsShapeletFunctionKey.def(py::init<afw::table::SubSchema const &, BasisTypeEnum>(), "s"_a,
46  "basisType"_a = HERMITE);
47 
48  clsShapeletFunctionKey.def("__eq__", &ShapeletFunctionKey::operator==, py::is_operator());
49  clsShapeletFunctionKey.def("__ne__", &ShapeletFunctionKey::operator!=, py::is_operator());
50 
51  clsShapeletFunctionKey.def_static("addFields", &ShapeletFunctionKey::addFields, "schema"_a, "name"_a,
52  "doc"_a, "ellipseUnit"_a, "coeffUnit"_a, "order"_a,
53  "basisType"_a = HERMITE);
54 
55  clsShapeletFunctionKey.def("get", &ShapeletFunctionKey::get);
56  clsShapeletFunctionKey.def("set", &ShapeletFunctionKey::set);
57  clsShapeletFunctionKey.def("isValid", &ShapeletFunctionKey::isValid);
58  clsShapeletFunctionKey.def("getEllipse", &ShapeletFunctionKey::getEllipse);
59  clsShapeletFunctionKey.def("getCoefficients", &ShapeletFunctionKey::getCoefficients);
60  clsShapeletFunctionKey.def("getOrder", &ShapeletFunctionKey::getOrder);
61  clsShapeletFunctionKey.def("getBasisType", &ShapeletFunctionKey::getBasisType);
62 
63  py::class_<MultiShapeletFunctionKey, std::shared_ptr<MultiShapeletFunctionKey>>
64  clsMultiShapeletFunctionKey(mod, "MultiShapeletFunctionKey");
65 
66  clsMultiShapeletFunctionKey.def(py::init<>());
67  clsMultiShapeletFunctionKey.def(py::init<afw::table::SubSchema const &, BasisTypeEnum>(), "s"_a,
68  "basisType"_a = HERMITE);
69  clsMultiShapeletFunctionKey.def(py::init<std::vector<PTR(ShapeletFunctionKey)> const &>(),
70  "components"_a);
71 
72  clsMultiShapeletFunctionKey.def_static("addFields", MultiShapeletFunctionKey::addFields, "schema"_a,
73  "name"_a, "doc"_a, "ellipseUnit"_a, "coeffUnit"_a, "orders"_a,
74  "basisType"_a = HERMITE);
75 
76  clsMultiShapeletFunctionKey.def("__eq__", &MultiShapeletFunctionKey::operator==, py::is_operator());
77  clsMultiShapeletFunctionKey.def("__ne__", &MultiShapeletFunctionKey::operator!=, py::is_operator());
78  clsMultiShapeletFunctionKey.def("__getitem__",
79  [](MultiShapeletFunctionKey &self, int i) { return self[i]; });
80 
81  clsMultiShapeletFunctionKey.def("get", &MultiShapeletFunctionKey::get);
82  clsMultiShapeletFunctionKey.def("set", &MultiShapeletFunctionKey::set);
83  clsMultiShapeletFunctionKey.def("isValid", &MultiShapeletFunctionKey::isValid);
84 
85  return mod.ptr();
86 }
87 
88 } // shapelet
89 } // lsst
Class that maps ShapeletFunction objects to fields in afw::table objects.
Definition: FunctorKeys.h:45
Class that maps MultiShapeletFunction objects to fields in afw::table objects.
Definition: FunctorKeys.h:161
PYBIND11_PLUGIN(basisEvaluator)
Cartesian shapelets or Gauss-Hermite functions, as defined in Refregier, 2003.
Definition: constants.h:53
BasisTypeEnum
An enum that sets whether to use real-valued polar shapelets or Cartesian shapelets.
Definition: constants.h:52