lsst.afw  13.0-92-g8ecf155+1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
psf.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2008-2016 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 <memory>
24 
25 #include <pybind11/pybind11.h>
26 //#include <pybind11/stl.h>
27 
28 #include "lsst/daf/base/Citizen.h"
29 #include "lsst/daf/base/Persistable.h"
30 #include "lsst/afw/geom/Point.h"
31 #include "lsst/afw/image/Color.h"
33 #include "lsst/afw/table/io/python.h" // for declarePersistableFacade
34 #include "lsst/afw/detection/Psf.h"
35 
36 namespace py = pybind11;
37 using namespace pybind11::literals;
38 
39 namespace lsst {
40 namespace afw {
41 namespace detection {
42 
43 namespace {
44 auto const NullPoint = geom::Point2D(std::numeric_limits<double>::quiet_NaN());
45 }
46 
48  py::module mod("_psf", "Python wrapper for afw _psf library");
49 
50  /* Module level */
51  table::io::python::declarePersistableFacade<Psf>(mod, "Psf");
52  py::class_<Psf, std::shared_ptr<Psf>, daf::base::Persistable, afw::table::io::Persistable,
53  table::io::PersistableFacade<Psf>, daf::base::Citizen>
54  cls(mod, "Psf");
55 
56  /* Member types and enums */
57  py::enum_<Psf::ImageOwnerEnum>(cls, "ImageOwnerEnum")
58  .value("COPY", Psf::ImageOwnerEnum::COPY)
59  .value("INTERNAL", Psf::ImageOwnerEnum::INTERNAL)
60  .export_values();
61 
62  /* Constructors */
63 
64  /* Operators */
65 
66  /* Members */
67  cls.def("clone", &Psf::clone);
68  cls.def("resized", &Psf::resized, "width"_a, "height"_a);
69  cls.def("computeImage", &Psf::computeImage, "position"_a = NullPoint, "color"_a = image::Color(),
70  "owner"_a = Psf::ImageOwnerEnum::COPY);
71  cls.def("computeKernelImage", &Psf::computeKernelImage, "position"_a = NullPoint,
72  "color"_a = image::Color(), "owner"_a = Psf::ImageOwnerEnum::COPY);
73  cls.def("computePeak", &Psf::computePeak, "position"_a = NullPoint, "color"_a = image::Color());
74  cls.def("computeApertureFlux", &Psf::computeApertureFlux, "radius"_a, "position"_a = NullPoint,
75  "color"_a = image::Color());
76  cls.def("computeShape", &Psf::computeShape, "position"_a = NullPoint, "color"_a = image::Color());
77  cls.def("computeBBox", &Psf::computeBBox, "position"_a = NullPoint, "color"_a = image::Color());
78  cls.def("getLocalKernel", &Psf::getLocalKernel, "position"_a = NullPoint, "color"_a = image::Color());
79  cls.def("getAverageColor", &Psf::getAverageColor);
80  cls.def("getAveragePosition", &Psf::getAveragePosition);
81  cls.def_static("recenterKernelImage", &Psf::recenterKernelImage, "im"_a, "position"_a,
82  "warpAlgorithm"_a = "lanczos5", "warpBuffer"_a = 5);
83 
84  return mod.ptr();
85 }
86 }
87 }
88 } // namespace lsst::afw::detection;
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:73
PYBIND11_PLUGIN(_cameraPoint)
Definition: cameraPoint.cc:35
Point< double, 2 > Point2D
Definition: Point.h:273
double const _a
Definition: RandomImage.cc:77
Describe the colour of a source.
Definition: Color.h:26