lsst.shapelet  13.0-4-g5a043c4+15
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
multiShapeletBasis.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 
24 #include "numpy/arrayobject.h"
25 #include "ndarray/pybind11.h"
26 
28 
29 namespace py = pybind11;
30 using namespace pybind11::literals;
31 
32 namespace lsst {
33 namespace shapelet {
34 
35 PYBIND11_PLUGIN(multiShapeletBasis) {
36  py::module mod("multiShapeletBasis");
37 
38  if (_import_array() < 0) {
39  PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
40  return nullptr;
41  }
42 
43  py::class_<MultiShapeletBasisComponent, std::shared_ptr<MultiShapeletBasisComponent>>
44  clsMultiShapeletBasisComponent(mod, "MultiShapeletBasisComponent");
45 
46  clsMultiShapeletBasisComponent.def(py::init<double, int, ndarray::Array<double const, 2, 2> const &>(),
47  "radius"_a, "order"_a, "matrix"_a);
48 
49  clsMultiShapeletBasisComponent.def("getRadius", &MultiShapeletBasisComponent::getRadius);
50  clsMultiShapeletBasisComponent.def("getOrder", &MultiShapeletBasisComponent::getOrder);
51  clsMultiShapeletBasisComponent.def("getMatrix", &MultiShapeletBasisComponent::getMatrix);
52 
53  py::class_<MultiShapeletBasis, std::shared_ptr<MultiShapeletBasis>> clsMultiShapeletBasis(
54  mod, "MultiShapeletBasis");
55 
56  clsMultiShapeletBasis.attr("Component") = clsMultiShapeletBasisComponent;
57 
58  clsMultiShapeletBasis.def(py::init<int>());
59  clsMultiShapeletBasis.def(py::init<MultiShapeletBasis const &>());
60 
61  clsMultiShapeletBasis.def("getSize", &MultiShapeletBasis::getSize);
62  clsMultiShapeletBasis.def("getComponentCount", &MultiShapeletBasis::getComponentCount);
63  clsMultiShapeletBasis.def("addComponent", &MultiShapeletBasis::addComponent);
64  clsMultiShapeletBasis.def("scale", &MultiShapeletBasis::scale);
65  clsMultiShapeletBasis.def("normalize", &MultiShapeletBasis::normalize);
66  clsMultiShapeletBasis.def("merge", &MultiShapeletBasis::merge);
67  clsMultiShapeletBasis.def("makeFunction", &MultiShapeletBasis::makeFunction);
68 
69  return mod.ptr();
70 }
71 
72 } // shapelet
73 } // lsst
PYBIND11_PLUGIN(basisEvaluator)