lsst.meas.algorithms  13.0-13-gf5c99ad+4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
coaddBoundedField.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/io/python.h"
27 
28 namespace py = pybind11;
29 using namespace pybind11::literals;
30 
31 namespace lsst {
32 namespace meas {
33 namespace algorithms {
34 
35 PYBIND11_PLUGIN(coaddBoundedField) {
36  py::module mod("coaddBoundedField");
37 
38  py::class_<CoaddBoundedFieldElement> clsCoaddBoundedFieldElement(mod, "CoaddBoundedFieldElement");
39 
40  clsCoaddBoundedFieldElement.def(
41  py::init<std::shared_ptr<afw::math::BoundedField>, std::shared_ptr<afw::image::Wcs const>,
42  std::shared_ptr<afw::geom::polygon::Polygon const>, double>(),
43  "field"_a, "wcs"_a, "validPolygon"_a, "weight"_a = 1.0);
44 
45  clsCoaddBoundedFieldElement.def_readwrite("field", &CoaddBoundedFieldElement::field);
46  clsCoaddBoundedFieldElement.def_readwrite("wcs", &CoaddBoundedFieldElement::wcs);
47  clsCoaddBoundedFieldElement.def_readwrite("validPolygon", &CoaddBoundedFieldElement::validPolygon);
48  clsCoaddBoundedFieldElement.def_readwrite("weight", &CoaddBoundedFieldElement::weight);
49 
50  afw::table::io::python::declarePersistableFacade<CoaddBoundedField>(mod, "CoaddBoundedField");
51 
52  py::class_<CoaddBoundedField, std::shared_ptr<CoaddBoundedField>,
53  afw::table::io::PersistableFacade<CoaddBoundedField>, afw::math::BoundedField>
54  clsCoaddBoundedField(mod, "CoaddBoundedField");
55 
56  clsCoaddBoundedField.attr("Element") = clsCoaddBoundedFieldElement;
57 
58  /* Constructors */
59  clsCoaddBoundedField.def(py::init<afw::geom::Box2I const &, std::shared_ptr<afw::image::Wcs const>,
60  typename CoaddBoundedField::ElementVector const &>(),
61  "bbox"_a, "coaddWcs"_a, "elements"_a);
62  clsCoaddBoundedField.def(py::init<afw::geom::Box2I const &, std::shared_ptr<afw::image::Wcs const>,
63  typename CoaddBoundedField::ElementVector const &, double>(),
64  "bbox"_a, "coaddWcs"_a, "elements"_a, "default"_a);
65 
66  /* Operators */
67  clsCoaddBoundedField.def("__eq__", &CoaddBoundedField::operator==, py::is_operator());
68  clsCoaddBoundedField.def("__ne__", &CoaddBoundedField::operator!=, py::is_operator());
69  clsCoaddBoundedField.def("__imul__", &CoaddBoundedField::operator*);
70 
71  /* Members */
72  clsCoaddBoundedField.def("evaluate", &CoaddBoundedField::evaluate);
73  clsCoaddBoundedField.def("isPersistable", &CoaddBoundedField::isPersistable);
74 
75  return mod.ptr();
76 }
77 
78 } // algorithms
79 } // meas
80 } // lsst
tbl::Key< double > weight
tbl::Key< int > wcs
tbl::Key< int > validPolygon
PYBIND11_PLUGIN(binnedWcs)
Definition: binnedWcs.cc:33
tbl::Key< int > field