25 #include <pybind11/pybind11.h>
30 namespace py = pybind11;
31 using namespace py::literals;
35 namespace cameraGeom {
44 template <
typename CppClass,
typename PyClass>
45 void declareCommonSysMethods(PyClass &
cls) {
47 cls.def(
"__eq__", [](CppClass
const &
self, CppClass
const &other) {
return self == other; },
49 cls.def(
"__ne__", [](CppClass
const &
self, CppClass
const &other) {
return self != other; },
51 cls.def(
"__str__", [](CppClass
const &
self) {
52 std::ostringstream os;
56 cls.def(
"__repr__", [](CppClass
const &
self) {
57 std::ostringstream os;
61 cls.def(
"__hash__", [](CppClass
const &
self) {
63 return hash<CppClass>()(
self);
67 cls.def(
"getSysName", &CppClass::getSysName);
72 py::module mod(
"_cameraSys",
"Python wrapper for afw _cameraSys library");
75 py::class_<CameraSysPrefix> clsCameraSysPrefix(mod,
"CameraSysPrefix");
76 py::class_<CameraSys> clsCameraSys(mod,
"CameraSys");
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.
CameraSysPrefix const ACTUAL_PIXELS
The actual pixels where the photon lands and electrons are generated (unbinned) This takes into accou...
PYBIND11_PLUGIN(_cameraPoint)
CameraSys const FIELD_ANGLE
Field angle coordinates: Angular x,y offset from the optic axis (radians).
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...