22 #include "pybind11/pybind11.h"
23 #include "pybind11/stl.h"
30 using namespace py::literals;
34 namespace cameraGeom {
36 using PyCamera = py::class_<Camera, DetectorCollection, std::shared_ptr<Camera>>;
37 using PyCameraBuilder = py::class_<Camera::Builder, DetectorCollectionBase<Detector::InCameraBuilder>,
49 cls.def(
"rebuild", &Camera::rebuild);
50 cls.def(
"getName", &Camera::getName);
51 cls.def(
"getPupilFactoryName", &Camera::getPupilFactoryName);
52 cls.def(
"findDetectors", &Camera::findDetectors,
"point"_a,
"cameraSys"_a);
53 cls.def(
"findDetectorsList", &Camera::findDetectorsList,
"pointList"_a,
"cameraSys"_a);
59 return self.getTransform(fromSys, toSys);
61 PyErr_SetString(PyExc_KeyError, err.
what());
62 throw py::error_already_set();
65 "fromSys"_a,
"toSys"_a
67 cls.def(
"getTransformMap", &Camera::getTransformMap);
77 return self.transform(point, fromSys, toSys);
79 PyErr_SetString(PyExc_KeyError, err.
what());
80 throw py::error_already_set();
83 "point"_a,
"fromSys"_a,
"toSys"_a
94 return self.transform(points, fromSys, toSys);
96 PyErr_SetString(PyExc_KeyError, err.
what());
97 throw py::error_already_set();
100 "points"_a,
"fromSys"_a,
"toSys"_a
107 cls.def(py::init<std::string const &>(),
"name"_a);
108 cls.def(py::init<Camera const &>(),
"camera"_a);
109 cls.def(
"finish", &Camera::Builder::finish);
110 cls.def(
"getName", &Camera::Builder::getName);
111 cls.def(
"setName", &Camera::Builder::setName);
112 cls.def(
"getPupilFactoryName", &Camera::Builder::getPupilFactoryName);
113 cls.def(
"setPupilFactoryName", &Camera::Builder::setPupilFactoryName);
114 cls.def(
"setPupilFactoryClass",
117 if (!pupilFactoryClass.is(py::none())) {
118 pupilFactoryName = py::str(
"{}.{}").format(
119 pupilFactoryClass.attr(
"__module__"),
120 pupilFactoryClass.attr(
"__name__")
125 cls.def(
"setTransformFromFocalPlaneTo", &Camera::Builder::setTransformFromFocalPlaneTo,
126 "toSys"_a,
"transform"_a);
127 cls.def(
"discardTransformFromFocalPlaneTo",&Camera::Builder::discardTransformFromFocalPlaneTo);
128 cls.def(
"add", &Camera::Builder::add);
129 cls.def(
"__delitem__", py::overload_cast<int>(&Camera::Builder::remove));
130 cls.def(
"__delitem__", py::overload_cast<std::string const &>(&Camera::Builder::remove));
134 py::module::import(
"lsst.afw.cameraGeom.detectorCollection");
135 py::module::import(
"lsst.afw.cameraGeom.detector");
136 py::module::import(
"lsst.afw.cameraGeom.transformMap");