24 #include "pybind11/pybind11.h" 25 #include "pybind11/stl.h" 43 using utils::python::WrapperCollection;
47 using PyAmpInfoRecord = py::class_<AmpInfoRecord, std::shared_ptr<AmpInfoRecord>, BaseRecord>;
48 using PyAmpInfoTable = py::class_<AmpInfoTable, std::shared_ptr<AmpInfoTable>, BaseTable>;
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);
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);
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,
136 cls.def(
"copyRecord",
137 (std::shared_ptr<AmpInfoRecord>(AmpInfoTable::*)(BaseRecord const &, SchemaMapper const &)) &
138 AmpInfoTable::copyRecord,
139 "other"_a,
"mapper"_a);
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);
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");
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;
void wrapAmpInfo(WrapperCollection &wrappers)
pybind11::module module
The module object passed to the PYBIND11_MODULE block that contains this WrapperCollection.
A base class for image defects.
A helper class for subdividing pybind11 module across multiple translation units (i.e.
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...