LSST Applications g034a557a3c+dd8dd8f11d,g0afe43252f+b86e4b8053,g11f7dcd041+017865fdd3,g1cd03abf6b+8446defddb,g1ce3e0751c+f991eae79d,g28da252d5a+ca8a1a9fb3,g2bbee38e9b+b6588ad223,g2bc492864f+b6588ad223,g2cdde0e794+8523d0dbb4,g347aa1857d+b6588ad223,g35bb328faa+b86e4b8053,g3a166c0a6a+b6588ad223,g461a3dce89+b86e4b8053,g52b1c1532d+b86e4b8053,g7f3b0d46df+ad13c1b82d,g80478fca09+f29c5d6c70,g858d7b2824+293f439f82,g8cd86fa7b1+af721d2595,g965a9036f2+293f439f82,g979bb04a14+51ed57f74c,g9ddcbc5298+f24b38b85a,gae0086650b+b86e4b8053,gbb886bcc26+b97e247655,gc28159a63d+b6588ad223,gc30aee3386+a2f0f6cab9,gcaf7e4fdec+293f439f82,gcd45df26be+293f439f82,gcdd4ae20e8+70b5def7e6,gce08ada175+da9c58a417,gcf0d15dbbd+70b5def7e6,gdaeeff99f8+006e14e809,gdbce86181e+6a170ce272,ge3d4d395c2+224150c836,ge5f7162a3a+bb2241c923,ge6cb8fbbf7+d119aed356,ge79ae78c31+b6588ad223,gf048a9a2f4+40ffced2b8,gf0baf85859+b4cca3d10f,w.2024.30
LSST Data Management Base Package
Loading...
Searching...
No Matches
psf.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"
25
26
27#include "ndarray/pybind11.h"
28
29#include "lsst/meas/extensions/psfex/psf.hh"
30
31namespace py = pybind11;
32using namespace pybind11::literals;
33
34namespace lsst {
35namespace meas {
36namespace extensions {
37namespace psfex {
38
40 using PyContext = py::class_<Context>;
41
42 wrappers.wrapType(PyContext(wrappers.module, "Context"), [](auto &mod, auto &clsContext) {
43
44 clsContext.attr("KEEPHIDDEN") = py::cast(static_cast<int>(Context::KEEPHIDDEN));
45 clsContext.attr("REMOVEHIDDEN") = py::cast(static_cast<int>(Context::REMOVEHIDDEN));
46
47 clsContext.def(
48 py::init<std::vector<std::string> const &, std::vector<int> const &, std::vector<int> const &, bool>(),
49 "names"_a, "group"_a, "degree"_a, "pcexflag"_a);
50
51 clsContext.def("getName", &Context::getName);
52 clsContext.def("getNpc", &Context::getNpc);
53 clsContext.def("getPcflag", &Context::getPcflag);
54 clsContext.def("getPc", &Context::getPc);
55 });
56
57 using PySample = py::class_<Sample>;
58 wrappers.wrapType(PySample(wrappers.module, "Sample"), [](auto &mod, auto &clsSample) {
59
60 clsSample.def("getCatindex", &Sample::getCatindex);
61 clsSample.def("setCatindex", &Sample::setCatindex);
62 clsSample.def("getObjindex", &Sample::getObjindex);
63 clsSample.def("setObjindex", &Sample::setObjindex);
64 clsSample.def("getExtindex", &Sample::getExtindex);
65 clsSample.def("setExtindex", &Sample::setExtindex);
66 clsSample.def("setVig", &Sample::setVig);
67 clsSample.def("setNorm", &Sample::setNorm);
68 clsSample.def("setBacknoise2", &Sample::setBacknoise2);
69 clsSample.def("setGain", &Sample::setGain);
70 clsSample.def("setX", &Sample::setX);
71 clsSample.def("setY", &Sample::setY);
72 clsSample.def("setContext", &Sample::setContext);
73 clsSample.def("setFluxrad", &Sample::setFluxrad);
74 clsSample.def("getVig", &Sample::getVig);
75 clsSample.def("getVigResi", &Sample::getVigResi);
76 clsSample.def("getVigChi", &Sample::getVigChi);
77 clsSample.def("getVigWeight", &Sample::getVigWeight);
78 clsSample.def("getXY", &Sample::getXY);
79 clsSample.def("getNorm", &Sample::getNorm);
80 });
81
82 using PySet = py::class_<Set, std::shared_ptr<Set>>;
83 wrappers.wrapType(PySet(wrappers.module, "Set"), [](auto &mod, auto &clsSet) {
84 clsSet.def(py::init<Context &>());
85
86 clsSet.def("newSample", &Set::newSample);
87 clsSet.def("trimMemory", &Set::trimMemory);
88 clsSet.def("getFwhm", &Set::getFwhm);
89 clsSet.def("setFwhm", &Set::setFwhm);
90 clsSet.def("getNcontext", &Set::getNcontext);
91 clsSet.def("getNsample", &Set::getNsample);
92 clsSet.def("getContextOffset", &Set::getContextOffset);
93 clsSet.def("setContextOffset", &Set::setContextOffset);
94 clsSet.def("getContextScale", &Set::getContextScale);
95 clsSet.def("setContextScale", &Set::setContextScale);
96 clsSet.def("getRecentroid", &Set::getRecentroid);
97 clsSet.def("setRecentroid", &Set::setRecentroid);
98 clsSet.def("setVigSize", &Set::setVigSize);
99 clsSet.def("finiSample", &Set::finiSample);
100 clsSet.def("empty", &Set::empty);
101 clsSet.def("getContextNames", &Set::getContextNames);
102 clsSet.def("setContextname", &Set::setContextname);
103 clsSet.def("setBadFlags", &Set::setBadFlags);
104 clsSet.def("getBadFlags", &Set::getBadFlags);
105 clsSet.def("setBadSN", &Set::setBadSN);
106 clsSet.def("getBadSN", &Set::getBadSN);
107 clsSet.def("setBadFrmin", &Set::setBadFrmin);
108 clsSet.def("getBadFrmin", &Set::getBadFrmin);
109 clsSet.def("setBadFrmax", &Set::setBadFrmax);
110 clsSet.def("getBadFrmax", &Set::getBadFrmax);
111 clsSet.def("setBadElong", &Set::setBadElong);
112 clsSet.def("getBadElong", &Set::getBadElong);
113 clsSet.def("setBadPix", &Set::setBadPix);
114 clsSet.def("getBadPix", &Set::getBadPix);
115 clsSet.def("getSample", &Set::getSample);
116 });
117
118 using PyPsf = py::class_<Psf>;
119 wrappers.wrapType(PyPsf(wrappers.module, "Psf"), [](auto &mod, auto &clsPsf) {
120 clsPsf.def(py::init<>());
121
122 clsPsf.def("getLoc", &Psf::getLoc);
123 clsPsf.def("getResi", &Psf::getResi);
124 clsPsf.def("build", &Psf::build,
125 "x"_a, "y"_a, "other"_a = std::vector<double>());
126 clsPsf.def("clip", &Psf::clip);
127 });
128}
129
130} // psfex
131} // extensions
132} // meas
133} // lsst
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
void wrapPsf(WrapperCollection &wrappers)
Definition psf.cc:39