25 #include <pybind11/pybind11.h> 32 namespace py = pybind11;
37 namespace cameraGeom {
46 template <
typename CppClass,
typename PyClass>
47 void declareCommonSysMethods(PyClass &
cls) {
49 cls.def(
"__eq__", [](CppClass
const &
self, CppClass
const &other) {
return self == other; },
51 cls.def(
"__ne__", [](CppClass
const &
self, CppClass
const &other) {
return self != other; },
53 cls.def(
"__str__", [](CppClass
const &
self) {
54 std::ostringstream os;
58 cls.def(
"__repr__", [](CppClass
const &
self) {
59 std::ostringstream os;
65 cls.def(
"getSysName", &CppClass::getSysName);
70 py::module mod(
"_cameraSys",
"Python wrapper for afw _cameraSys library");
73 py::class_<CameraSysPrefix> clsCameraSysPrefix(mod,
"CameraSysPrefix");
74 py::class_<CameraSys> clsCameraSys(mod,
"CameraSys");
76 geom::python::declareTransformMap<CameraSys>(mod,
"Camera");
81 mod.attr(
"PUPIL") = py::cast(
PUPIL);
82 mod.attr(
"PIXELS") = py::cast(
PIXELS);
87 declareCommonSysMethods<CameraSysPrefix>(clsCameraSysPrefix);
88 declareCommonSysMethods<CameraSys>(clsCameraSys);
91 clsCameraSysPrefix.def(py::init<std::string const &>(),
"sysName"_a);
92 clsCameraSys.def(py::init<std::string const &, std::string const &>(),
"sysName"_a,
93 "detectorName"_a =
"");
94 clsCameraSys.def(py::init<CameraSysPrefix const &, std::string const &>(),
"sysPrefix"_a,
95 "detectorName"_a =
"");
100 clsCameraSys.def(
"getDetectorName", &CameraSys::getDetectorName);
101 clsCameraSys.def(
"hasDetectorName", &CameraSys::hasDetectorName);
CameraSysPrefix const PIXELS
Nominal pixels on the detector (unbinned) This ignores manufacturing imperfections, "tree ring" distortions and all other such effects.
CameraSys const PUPIL
Pupil coordinates: Angular x,y offset from the vertex at the pupil (radians).
CameraSysPrefix const ACTUAL_PIXELS
The actual pixels where the photon lands and electrons are generated (unbinned) This takes into accou...
PYBIND11_PLUGIN(_cameraSys)
A base class for image defects.
CameraSysPrefix const TAN_PIXELS
Tangent-plane pixels on the detector (unbinned)
CameraSys const FOCAL_PLANE
Focal plane coordinates: Rectilinear x, y (and z when talking about the location of a detector) on th...