23 #include "pybind11/pybind11.h"
24 #include "pybind11/stl.h"
28 #include "ndarray/pybind11.h"
40 using namespace pybind11::literals;
48 py::class_<Measurement, std::shared_ptr<Measurement>>
cls(mod,
"Measurement");
50 cls.def(py::init<double, double>(),
"value"_a,
"error"_a);
51 cls.def_readonly(
"value", &Measurement::value);
55 cls.def(
"__repr__", [](Measurement
const &
self) {
57 os <<
"Measurement(" <<
self <<
")";
63 py::module::import(
"lsst.afw.typehandling");
65 declareMeasurement(mod);
67 py::class_<PhotoCalib, std::shared_ptr<PhotoCalib>, typehandling::Storable>
cls(mod,
"PhotoCalib");
70 cls.def(py::init<>());
71 cls.def(py::init<double, double, lsst::geom::Box2I>(),
"calibrationMean"_a,
"calibrationErr"_a = 0.0,
74 "calibrationErr"_a = 0.0);
76 "calibrationErr"_a,
"calibration"_a,
"isConstant"_a);
78 table::io::python::addPersistableMethods<PhotoCalib>(
cls);
81 cls.def(
"instFluxToNanojansky",
83 PhotoCalib::instFluxToNanojansky,
84 "instFlux"_a,
"point"_a);
85 cls.def(
"instFluxToNanojansky", (
double (PhotoCalib::*)(
double)
const) & PhotoCalib::instFluxToNanojansky,
88 cls.def(
"instFluxToNanojansky",
90 PhotoCalib::instFluxToNanojansky,
91 "instFlux"_a,
"instFluxErr"_a,
"point"_a);
92 cls.def(
"instFluxToNanojansky",
93 (Measurement(PhotoCalib::*)(
double,
double)
const) & PhotoCalib::instFluxToNanojansky,
94 "instFlux"_a,
"instFluxErr"_a);
96 cls.def(
"instFluxToNanojansky",
97 (Measurement(PhotoCalib::*)(afw::table::SourceRecord
const &,
std::string const &)
const) &
98 PhotoCalib::instFluxToNanojansky,
99 "sourceRecord"_a,
"instFluxField"_a);
101 cls.def(
"instFluxToNanojansky",
104 PhotoCalib::instFluxToNanojansky,
105 "sourceCatalog"_a,
"instFluxField"_a);
107 cls.def(
"instFluxToNanojansky",
110 PhotoCalib::instFluxToNanojansky,
111 "sourceCatalog"_a,
"instFluxField"_a,
"outField"_a);
114 cls.def(
"instFluxToMagnitude",
116 PhotoCalib::instFluxToMagnitude,
117 "instFlux"_a,
"point"_a);
118 cls.def(
"instFluxToMagnitude", (
double (PhotoCalib::*)(
double)
const) & PhotoCalib::instFluxToMagnitude,
121 cls.def(
"instFluxToMagnitude",
123 PhotoCalib::instFluxToMagnitude,
124 "instFlux"_a,
"instFluxErr"_a,
"point"_a);
125 cls.def(
"instFluxToMagnitude",
126 (Measurement(PhotoCalib::*)(
double,
double)
const) & PhotoCalib::instFluxToMagnitude,
127 "instFlux"_a,
"instFluxErr"_a);
129 cls.def(
"instFluxToMagnitude",
130 (Measurement(PhotoCalib::*)(afw::table::SourceRecord
const &,
std::string const &)
const) &
131 PhotoCalib::instFluxToMagnitude,
132 "sourceRecord"_a,
"instFluxField"_a);
134 cls.def(
"instFluxToMagnitude",
137 PhotoCalib::instFluxToMagnitude,
138 "sourceCatalog"_a,
"instFluxField"_a);
140 cls.def(
"instFluxToMagnitude",
143 PhotoCalib::instFluxToMagnitude,
144 "sourceCatalog"_a,
"instFluxField"_a,
"outField"_a);
147 cls.def(
"magnitudeToInstFlux",
150 "instFlux"_a,
"point"_a);
151 cls.def(
"magnitudeToInstFlux", py::overload_cast<double>(&PhotoCalib::magnitudeToInstFlux, py::const_),
155 cls.def(
"getCalibrationMean", &PhotoCalib::getCalibrationMean);
156 cls.def(
"getCalibrationErr", &PhotoCalib::getCalibrationErr);
157 cls.def(
"getInstFluxAtZeroMagnitude", &PhotoCalib::getInstFluxAtZeroMagnitude);
158 cls.def(
"getLocalCalibration", &PhotoCalib::getLocalCalibration,
"point"_a);
160 cls.def(
"computeScaledCalibration", &PhotoCalib::computeScaledCalibration);
161 cls.def(
"computeScalingTo", &PhotoCalib::computeScalingTo);
163 cls.def(
"calibrateImage", &PhotoCalib::calibrateImage,
"maskedImage"_a,
164 "includeScaleUncertainty"_a =
true);
166 cls.def(
"calibrateCatalog",
168 &PhotoCalib::calibrateCatalog, py::const_),
169 "maskedImage"_a,
"fluxFields"_a);
170 cls.def(
"calibrateCatalog",
171 py::overload_cast<afw::table::SourceCatalog const &>(&PhotoCalib::calibrateCatalog, py::const_),
175 cls.def(
"__eq__", &PhotoCalib::operator==, py::is_operator());
176 cls.def(
"__ne__", &PhotoCalib::operator!=, py::is_operator());
179 mod.def(
"makePhotoCalibFromMetadata",
182 mod.def(
"makePhotoCalibFromCalibZeroPoint",
184 "instFluxMag0Err"_a =
false);
187 cls.def(
"__repr__", [](PhotoCalib
const &
self) {
189 os <<
"PhotoCalib(" <<
self <<
")";