LSSTApplications  17.0+115,17.0+12,17.0+65,18.0.0+14,18.0.0+29,18.0.0+6,18.0.0+70,18.0.0-4-g68ffd23+1,18.1.0-1-g0001055+9,18.1.0-1-g03d53ef+2,18.1.0-1-g1349e88+44,18.1.0-1-g2505f39+35,18.1.0-1-g5315e5e+2,18.1.0-1-g5e4b7ea+11,18.1.0-1-g7e8fceb+2,18.1.0-1-g85f8cd4+38,18.1.0-1-gd55f500+25,18.1.0-13-gfe4edf0b,18.1.0-14-g259bd21+9,18.1.0-14-gd04256d+35,18.1.0-2-g4903023+12,18.1.0-2-g5f9922c+13,18.1.0-2-gd3b74e5+3,18.1.0-2-gfbf3545+22,18.1.0-2-gfefb8b5+34,18.1.0-22-g936f6a9b4,18.1.0-23-g364d03b8,18.1.0-23-g52ab674,18.1.0-3-g52aa583+17,18.1.0-3-g8f4a2b1+32,18.1.0-3-gb69f684+30,18.1.0-4-g1ee41a7+2,18.1.0-5-g6dbcb01+31,18.1.0-5-gc286bb7+4,18.1.0-6-g857e778+4,18.1.0-7-gae09a6d+18,18.1.0-8-g42b2ab3+10,18.1.0-8-gc69d46e+17,18.1.0-9-gee19f03+2,w.2019.44
LSSTDataManagementBasePackage
_ampInfo.cc
Go to the documentation of this file.
1 /*
2  * This file is part of afw.
3  *
4  * Developed for the LSST Data Management System.
5  * This product includes software developed by the LSST Project
6  * (https://www.lsst.org).
7  * See the COPYRIGHT file at the top-level directory of this distribution
8  * for details of code ownership.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
24 #include "pybind11/pybind11.h"
25 #include "pybind11/stl.h"
26 
27 #include <memory>
28 
29 #include "lsst/utils/python.h"
30 
31 #include "lsst/afw/table/Catalog.h"
32 #include "lsst/afw/table/AmpInfo.h"
35 
36 namespace py = pybind11;
37 using namespace pybind11::literals;
38 
39 namespace lsst {
40 namespace afw {
41 namespace table {
42 
43 using utils::python::WrapperCollection;
44 
45 namespace {
46 
47 using PyAmpInfoRecord = py::class_<AmpInfoRecord, std::shared_ptr<AmpInfoRecord>, BaseRecord>;
48 using PyAmpInfoTable = py::class_<AmpInfoTable, std::shared_ptr<AmpInfoTable>, BaseTable>;
49 
50 static PyAmpInfoRecord declareAmpInfoRecord(WrapperCollection &wrappers) {
51  return wrappers.wrapType(PyAmpInfoRecord(wrappers.module, "AmpInfoRecord"), [](auto &mod, auto &cls) {
52  cls.def("getName", &AmpInfoRecord::getName);
53  cls.def("setName", &AmpInfoRecord::setName, "name"_a, "Set name of amplifier location in camera");
54  cls.def("getTable", &AmpInfoRecord::getTable);
55  cls.def_property_readonly("table", &AmpInfoRecord::getTable);
56  cls.def("getBBox", &AmpInfoRecord::getBBox);
57  cls.def("setBBox", &AmpInfoRecord::setBBox, "bbox"_a);
58  cls.def("getGain", &AmpInfoRecord::getGain);
59  cls.def("setGain", &AmpInfoRecord::setGain, "gain"_a, "Set amplifier gain in electron/adu");
60  cls.def("getReadNoise", &AmpInfoRecord::getReadNoise);
61  cls.def("setReadNoise", &AmpInfoRecord::setReadNoise, "readNoise"_a, "Set read noise in electron");
62  cls.def("getSaturation", &AmpInfoRecord::getSaturation);
63  cls.def("setSaturation", &AmpInfoRecord::setSaturation, "saturation"_a,
64  "Set level in ADU above which pixels are considered saturated; "
65  "use `nan` if no such level applies");
66  cls.def("getSuspectLevel", &AmpInfoRecord::getSuspectLevel);
67  cls.def("setSuspectLevel", &AmpInfoRecord::setSuspectLevel, "suspectLevel"_a,
68  "Set level in ADU above which pixels are considered suspicious; "
69  "use `nan` if no such level applies");
70  cls.def("getReadoutCorner", &AmpInfoRecord::getReadoutCorner);
71  cls.def("setReadoutCorner", &AmpInfoRecord::setReadoutCorner, "corner"_a);
72  cls.def("getLinearityCoeffs", &AmpInfoRecord::getLinearityCoeffs);
73  cls.def("setLinearityCoeffs", &AmpInfoRecord::setLinearityCoeffs, "coeffs"_a);
74  cls.def("getLinearityType", &AmpInfoRecord::getLinearityType);
75  cls.def("setLinearityType", &AmpInfoRecord::setLinearityType, "type"_a);
76  cls.def("getHasRawInfo", &AmpInfoRecord::getHasRawInfo);
77  cls.def("setHasRawInfo", &AmpInfoRecord::setHasRawInfo, "hasRawInfo"_a);
78  cls.def("getRawBBox", &AmpInfoRecord::getRawBBox);
79  cls.def("setRawBBox", &AmpInfoRecord::setRawBBox, "bbox"_a);
80  cls.def("getRawDataBBox", &AmpInfoRecord::getRawDataBBox);
81  cls.def("setRawDataBBox", &AmpInfoRecord::setRawDataBBox, "bbox"_a);
82  cls.def("getRawFlipX", &AmpInfoRecord::getRawFlipX);
83  cls.def("setRawFlipX", &AmpInfoRecord::setRawFlipX, "rawFlipX"_a);
84  cls.def("getRawFlipY", &AmpInfoRecord::getRawFlipY);
85  cls.def("setRawFlipY", &AmpInfoRecord::setRawFlipY, "rawFlipY"_a);
86  cls.def("getRawXYOffset", &AmpInfoRecord::getRawXYOffset);
87  cls.def("setRawXYOffset", &AmpInfoRecord::setRawXYOffset, "offset"_a);
88  cls.def("getRawHorizontalOverscanBBox", &AmpInfoRecord::getRawHorizontalOverscanBBox);
89  cls.def("setRawHorizontalOverscanBBox", &AmpInfoRecord::setRawHorizontalOverscanBBox, "bbox"_a);
90  cls.def("getRawVerticalOverscanBBox", &AmpInfoRecord::getRawVerticalOverscanBBox);
91  cls.def("setRawVerticalOverscanBBox", &AmpInfoRecord::setRawVerticalOverscanBBox, "bbox"_a);
92  cls.def("getRawPrescanBBox", &AmpInfoRecord::getRawPrescanBBox);
93  cls.def("setRawPrescanBBox", &AmpInfoRecord::setRawPrescanBBox, "bbox"_a);
94  });
95 }
96 
97 static PyAmpInfoTable declareAmpInfoTable(WrapperCollection &wrappers) {
98  return wrappers.wrapType(PyAmpInfoTable(wrappers.module, "AmpInfoTable"), [](auto &mod, auto &cls) {
99  cls.def_static("make", &AmpInfoTable::make);
100  cls.def_static("makeMinimalSchema", &AmpInfoTable::makeMinimalSchema);
101  cls.def_static("checkSchema", &AmpInfoTable::checkSchema, "other"_a);
102  cls.def_static("getNameKey", &AmpInfoTable::getNameKey);
103  cls.def_static("getBBoxMinKey", &AmpInfoTable::getBBoxMinKey);
104  cls.def_static("getBBoxExtentKey", &AmpInfoTable::getBBoxExtentKey);
105  cls.def_static("getGainKey", &AmpInfoTable::getGainKey);
106  cls.def_static("getReadNoiseKey", &AmpInfoTable::getReadNoiseKey);
107  cls.def_static("getSaturationKey", &AmpInfoTable::getSaturationKey);
108  cls.def_static("getSuspectLevelKey", &AmpInfoTable::getSuspectLevelKey);
109  cls.def_static("getReadoutCornerKey", &AmpInfoTable::getReadoutCornerKey);
110  cls.def_static("getLinearityCoeffsKey", &AmpInfoTable::getLinearityCoeffsKey);
111  cls.def_static("getLinearityTypeKey", &AmpInfoTable::getLinearityTypeKey);
112  cls.def_static("getHasRawInfoKey", &AmpInfoTable::getHasRawInfoKey);
113  cls.def_static("getRawBBoxMinKey", &AmpInfoTable::getRawBBoxMinKey);
114  cls.def_static("getRawBBoxExtentKey", &AmpInfoTable::getRawBBoxExtentKey);
115  cls.def_static("getRawDataBBoxMinKey", &AmpInfoTable::getRawDataBBoxMinKey);
116  cls.def_static("getRawDataBBoxExtentKey", &AmpInfoTable::getRawDataBBoxExtentKey);
117  cls.def_static("getRawFlipXKey", &AmpInfoTable::getRawFlipXKey);
118  cls.def_static("getRawFlipYKey", &AmpInfoTable::getRawFlipYKey);
119  cls.def_static("getRawXYOffsetKey", &AmpInfoTable::getRawXYOffsetKey);
120  cls.def_static("getRawHorizontalOverscanBBoxMinKey",
121  &AmpInfoTable::getRawHorizontalOverscanBBoxMinKey);
122  cls.def_static("getRawHorizontalOverscanBBoxExtentKey",
123  &AmpInfoTable::getRawHorizontalOverscanBBoxExtentKey);
124  cls.def_static("getRawVerticalOverscanBBoxMinKey", &AmpInfoTable::getRawVerticalOverscanBBoxMinKey);
125  cls.def_static("getRawVerticalOverscanBBoxExtentKey",
126  &AmpInfoTable::getRawVerticalOverscanBBoxExtentKey);
127  cls.def_static("getRawPrescanBBoxMinKey", &AmpInfoTable::getRawPrescanBBoxMinKey);
128  cls.def_static("getRawPrescanBBoxExtentKey", &AmpInfoTable::getRawPrescanBBoxExtentKey);
129 
130  cls.def("clone", &AmpInfoTable::clone);
131  cls.def("makeRecord", &AmpInfoTable::makeRecord);
132  cls.def("copyRecord",
133  (std::shared_ptr<AmpInfoRecord>(AmpInfoTable::*)(BaseRecord const &)) &
134  AmpInfoTable::copyRecord,
135  "other"_a);
136  cls.def("copyRecord",
137  (std::shared_ptr<AmpInfoRecord>(AmpInfoTable::*)(BaseRecord const &, SchemaMapper const &)) &
138  AmpInfoTable::copyRecord,
139  "other"_a, "mapper"_a);
140  });
141 }
142 
143 } // namespace
144 
146  wrappers.wrapType(py::enum_<ReadoutCorner>(wrappers.module, "ReadoutCorner"), [](auto &mod, auto &enm) {
147  enm.value("LL", ReadoutCorner::LL);
148  enm.value("LR", ReadoutCorner::LR);
149  enm.value("UR", ReadoutCorner::UR);
150  enm.value("UL", ReadoutCorner::UL);
151  enm.export_values();
152  });
153 
154  auto clsAmpInfoRecord = declareAmpInfoRecord(wrappers);
155  auto clsAmpInfoTable = declareAmpInfoTable(wrappers);
156  auto clsAmpInfoColumnView = table::python::declareColumnView<AmpInfoRecord>(wrappers, "AmpInfo");
157  auto clsAmpInfoCatalog = table::python::declareCatalog<AmpInfoRecord>(wrappers, "AmpInfo");
158 
159  clsAmpInfoRecord.attr("Table") = clsAmpInfoTable;
160  clsAmpInfoRecord.attr("ColumnView") = clsAmpInfoColumnView;
161  clsAmpInfoRecord.attr("Catalog") = clsAmpInfoCatalog;
162  clsAmpInfoTable.attr("Record") = clsAmpInfoRecord;
163  clsAmpInfoTable.attr("ColumnView") = clsAmpInfoColumnView;
164  clsAmpInfoTable.attr("Catalog") = clsAmpInfoCatalog;
165  clsAmpInfoCatalog.attr("Record") = clsAmpInfoRecord;
166  clsAmpInfoCatalog.attr("Table") = clsAmpInfoTable;
167  clsAmpInfoCatalog.attr("ColumnView") = clsAmpInfoColumnView;
168 }
169 
170 } // namespace table
171 } // namespace afw
172 } // namespace lsst
void wrapAmpInfo(WrapperCollection &wrappers)
Definition: _ampInfo.cc:145
pybind11::module module
The module object passed to the PYBIND11_MODULE block that contains this WrapperCollection.
Definition: python.h:448
A base class for image defects.
A helper class for subdividing pybind11 module across multiple translation units (i.e.
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