lsst.meas.algorithms  13.0-23-gb99accf8+4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
interp.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/detection/Psf.h"
27 
28 namespace py = pybind11;
29 using namespace pybind11::literals;
30 
31 namespace lsst {
32 namespace meas {
33 namespace algorithms {
34 namespace {
35 
36 template <typename PixelT>
37 void declareInterpolateOverDefects(py::module& mod) {
38  mod.def("interpolateOverDefects",
39  interpolateOverDefects<lsst::afw::image::MaskedImage<PixelT, lsst::afw::image::MaskPixel,
40  lsst::afw::image::VariancePixel>>,
41  "image"_a, "psf"_a, "badList"_a, "fallBackValue"_a = 0.0, "useFallbackValueAtEdge"_a = false);
42 }
43 
44 } // <anonymous>
45 
46 PYBIND11_PLUGIN(interp) {
47  py::module::import("lsst.afw.image");
48 
49  py::module mod("interp");
50 
51  py::class_<Defect, std::shared_ptr<Defect>, lsst::afw::image::DefectBase> clsDefect(mod, "Defect");
52 
53  /* Member types and enums */
54  py::enum_<Defect::DefectPosition>(clsDefect, "DefectPosition")
55  .value("LEFT", Defect::DefectPosition::LEFT)
56  .value("NEAR_LEFT", Defect::DefectPosition::NEAR_LEFT)
57  .value("WIDE_LEFT", Defect::DefectPosition::WIDE_LEFT)
58  .value("MIDDLE", Defect::DefectPosition::MIDDLE)
59  .value("WIDE_NEAR_LEFT", Defect::DefectPosition::WIDE_NEAR_LEFT)
60  .value("WIDE", Defect::DefectPosition::WIDE)
61  .value("WIDE_NEAR_RIGHT", Defect::DefectPosition::WIDE_NEAR_RIGHT)
62  .value("NEAR_RIGHT", Defect::DefectPosition::NEAR_RIGHT)
63  .value("WIDE_RIGHT", Defect::DefectPosition::WIDE_RIGHT)
64  .value("RIGHT", Defect::DefectPosition::RIGHT)
65  .export_values();
66 
67  /* Constructors */
68  clsDefect.def(py::init<const lsst::afw::geom::BoxI&>(), "bbox"_a = lsst::afw::geom::BoxI());
69 
70  /* Members */
71  clsDefect.def("classify", &Defect::classify);
72  clsDefect.def("getType", &Defect::getType);
73  clsDefect.def("getPos", &Defect::getPos);
74 
75  declareInterpolateOverDefects<float>(mod);
76 
77  return mod.ptr();
78 }
79 
80 } // algorithms
81 } // meas
82 } // lsst
void interpolateOverDefects(MaskedImageT &image, lsst::afw::detection::Psf const &psf, std::vector< Defect::Ptr > &badList, double fallbackValue=0.0, bool useFallbackValueAtEdge=false)
Process a set of known bad pixels in an image.
Definition: Interp.cc:2057
PYBIND11_PLUGIN(binnedWcs)
Definition: binnedWcs.cc:33