Loading [MathJax]/extensions/tex2jax.js
LSST Applications g0fba68d861+05816baf74,g1ec0fe41b4+f536777771,g1fd858c14a+a9301854fb,g35bb328faa+fcb1d3bbc8,g4af146b050+a5c07d5b1d,g4d2262a081+6e5fcc2a4e,g53246c7159+fcb1d3bbc8,g56a49b3a55+9c12191793,g5a012ec0e7+3632fc3ff3,g60b5630c4e+ded28b650d,g67b6fd64d1+ed4b5058f4,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g8352419a5c+fcb1d3bbc8,g87b7deb4dc+7b42cf88bf,g8852436030+e5453db6e6,g89139ef638+ed4b5058f4,g8e3bb8577d+d38d73bdbd,g9125e01d80+fcb1d3bbc8,g94187f82dc+ded28b650d,g989de1cb63+ed4b5058f4,g9d31334357+ded28b650d,g9f33ca652e+50a8019d8c,gabe3b4be73+1e0a283bba,gabf8522325+fa80ff7197,gb1101e3267+d9fb1f8026,gb58c049af0+f03b321e39,gb665e3612d+2a0c9e9e84,gb89ab40317+ed4b5058f4,gcf25f946ba+e5453db6e6,gd6cbbdb0b4+bb83cc51f8,gdd1046aedd+ded28b650d,gde0f65d7ad+941d412827,ge278dab8ac+d65b3c2b70,ge410e46f29+ed4b5058f4,gf23fb2af72+b7cae620c0,gf5e32f922b+fcb1d3bbc8,gf67bdafdda+ed4b5058f4,w.2025.16
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
isr.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 <memory>
26
27#include "lsst/ip/isr/isr.h"
28
29namespace py = pybind11;
30using namespace pybind11::literals;
31
32namespace lsst {
33namespace ip {
34namespace isr {
35
36namespace {
37
38template <typename PixelT>
39static void declareCountMaskedPixels(py::module& mod, std::string const& suffix) {
40 py::class_<CountMaskedPixels<PixelT>, std::shared_ptr<CountMaskedPixels<PixelT>>> cls(
41 mod, ("CountMaskedPixels" + suffix).c_str());
42
43 cls.def("reset", &CountMaskedPixels<PixelT>::reset);
44 cls.def("apply", &CountMaskedPixels<PixelT>::apply, "image"_a, "bitmask"_a);
45 cls.def("getCount", &CountMaskedPixels<PixelT>::getCount);
46}
47
58template <typename PixelT>
59static void declareAll(py::module& mod, std::string const& suffix) {
60 declareCountMaskedPixels<PixelT>(mod, suffix);
61
62 mod.def("maskNans", &maskNans<PixelT>, "maskedImage"_a, "maskVal"_a, "allow"_a = 0);
63 mod.def("fitOverscanImage", &fitOverscanImage<PixelT>,
64 "maskedImage"_a, "badPixelMask"_a, "isTransposed"_a);
65 mod.def("fitOverscanImageMean", &fitOverscanImageMean<PixelT>,
66 "maskedImage"_a, "badPixelMask"_a, "isTransposed"_a);
67}
68
69} // namespace lsst::ip::isr::<anonymous>
70
72 declareAll<float>(mod, "F");
73 declareAll<double>(mod, "D");
74 declareAll<int>(mod, "I");
75}
76
77} // isr
78} // ip
79} // lsst
void apply(lsst::afw::image::MaskedImage< ImageT > const &image, MaskT bitmask)
Definition isr.h:62
std::vector< double > fitOverscanImageMean(lsst::afw::image::MaskedImage< ImagePixelT > const &overscan, std::vector< std::string > badPixelMask, bool isTransposed)
Definition Isr.cc:99
size_t maskNans(afw::image::MaskedImage< PixelT > const &mi, afw::image::MaskPixel maskVal, afw::image::MaskPixel allow=0)
Mask NANs in an image.
Definition Isr.cc:35
std::vector< double > fitOverscanImage(lsst::afw::image::MaskedImage< ImagePixelT > const &overscan, std::vector< std::string > badPixelMask, bool isTransposed)
Definition Isr.cc:53
PYBIND11_MODULE(applyLookupTable, mod)