LSST Applications g04e9c324dd+8c5ae1fdc5,g0644efc3f0+09e1198e5e,g123d84c11c+8c5ae1fdc5,g1ec0fe41b4+6ec6b74de1,g1fd858c14a+3ffa984376,g3533f9d6cb+09e1198e5e,g35bb328faa+8c5ae1fdc5,g35ef7ab7cf+266198310b,g495290aba3+89f6b6dd9e,g53246c7159+8c5ae1fdc5,g60b5630c4e+09e1198e5e,g663da51e9b+8d6ae63d30,g6735e52a0d+29de3d959a,g67b6fd64d1+57193d00fb,g6c75a56628+7a48c497dd,g78460c75b0+7e33a9eb6d,g786e29fd12+668abc6043,g844c57033c+03ddc13274,g8852436030+08a5a9c358,g89139ef638+57193d00fb,g989de1cb63+57193d00fb,g9f33ca652e+945cd5ea73,ga1e959baac+5fbc491aed,ga2f891cd6c+09e1198e5e,gabe3b4be73+8856018cbb,gabf8522325+cc757f8247,gac2eed3f23+57193d00fb,gb1101e3267+9443485152,gb89ab40317+57193d00fb,gcf25f946ba+08a5a9c358,gd107969129+a4cb2c4ed1,gd6cbbdb0b4+8e46defd2a,gde0f65d7ad+31a6a3d176,ge278dab8ac+2322f1d6ea,ge410e46f29+57193d00fb,gf30d85a44d+f9c24d3818,gf5e32f922b+8c5ae1fdc5,gff02db199a+041df0bfe7,w.2025.28
LSST Data Management Base Package
Loading...
Searching...
No Matches
psfCandidate.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"
24
26
27namespace py = pybind11;
28using namespace pybind11::literals;
29
30namespace lsst {
31namespace meas {
32namespace algorithms {
33namespace {
34
35template <typename PixelT>
36void declarePsfCandidate(lsst::cpputils::python::WrapperCollection &wrappers, std::string const& suffix) {
37 using Class = PsfCandidate<PixelT>;
38 using PyClass = py::class_<Class, std::shared_ptr<Class>, afw::math::SpatialCellImageCandidate>;
39 std::string name = "PsfCandidate" + suffix;
40
41 wrappers.wrapType(PyClass(wrappers.module, name.c_str()), [](auto &mod, auto &cls) {
42 cls.def(py::init<std::shared_ptr<afw::table::SourceRecord> const &,
43 std::shared_ptr<afw::image::Exposure<PixelT> const>>(),
44 "source"_a, "parentExposure"_a);
45 cls.def(py::init<std::shared_ptr<afw::table::SourceRecord> const &,
46 std::shared_ptr<afw::image::Exposure<PixelT> const>, double, double>(),
47 "source"_a, "parentExposure"_a, "xCenter"_a, "yCenter"_a);
48
49 /* SpatialCellCandidate.getCandidateRating is defined in Python.
50 * Therefore we cannot override it from the C++ wrapper.
51 * Instead we give it a temporary name here, and assign it to the
52 * class from Python. */
53 cls.def("_getCandidateRating", &Class::getCandidateRating);
54 cls.def("getSource", &Class::getSource);
55 cls.def("getAmplitude", &Class::getAmplitude);
56 cls.def("setAmplitude", &Class::setAmplitude);
57 cls.def("getVar", &Class::getVar);
58 cls.def("setVar", &Class::setVar);
59 cls.def("getPsfColorValue", &Class::getPsfColorValue);
60 cls.def("setPsfColorValue", &Class::setPsfColorValue);
61 cls.def("getPsfColorType", &Class::getPsfColorType);
62 cls.def("setPsfColorType", &Class::setPsfColorType);
63 cls.def("getMaskedImage", (std::shared_ptr<afw::image::MaskedImage<PixelT> const>(Class::*)() const) &
64 Class::getMaskedImage);
65 cls.def("getMaskedImage",
66 (std::shared_ptr<afw::image::MaskedImage<PixelT> const>(Class::*)(int, int) const) &
67 Class::getMaskedImage,
68 "width"_a, "height"_a);
69 cls.def("getOffsetImage", &Class::getOffsetImage);
70 cls.def_static("getBorderWidth", &Class::getBorderWidth);
71 cls.def_static("setBorderWidth", &Class::setBorderWidth);
72 cls.def_static("setPixelThreshold", &Class::setPixelThreshold);
73 cls.def_static("getPixelThreshold", &Class::getPixelThreshold);
74 cls.def_static("setMaskBlends", &Class::setMaskBlends);
75 cls.def_static("getMaskBlends", &Class::getMaskBlends);
76
77 mod.def("makePsfCandidate", makePsfCandidate<PixelT>, "source"_a, "image"_a);
78 });
79}
80
81} // namespace
82
84 declarePsfCandidate<float>(wrappers, "F");
85}
86
87} // namespace algorithms
88} // namespace meas
89} // namespace lsst
Class used by SpatialCell for spatial PSF fittig.
A helper class for subdividing pybind11 module across multiple translation units (i....
Definition python.h:242
PyType wrapType(PyType cls, ClassWrapperCallback function, bool setModuleName=true)
Add a type (class or enum) wrapper, deferring method and other attribute definitions until finish() i...
Definition python.h:391
pybind11::module module
The module object passed to the PYBIND11_MODULE block that contains this WrapperCollection.
Definition python.h:448
Class stored in SpatialCells for spatial Psf fitting.
py::class_< PixelAreaBoundedField, std::shared_ptr< PixelAreaBoundedField >, BoundedField > PyClass
void wrapPsfCandidate(WrapperCollection &wrappers)