LSST Applications 26.0.0,g0265f82a02+6660c170cc,g07994bdeae+30b05a742e,g0a0026dc87+17526d298f,g0a60f58ba1+17526d298f,g0e4bf8285c+96dd2c2ea9,g0ecae5effc+c266a536c8,g1e7d6db67d+6f7cb1f4bb,g26482f50c6+6346c0633c,g2bbee38e9b+6660c170cc,g2cc88a2952+0a4e78cd49,g3273194fdb+f6908454ef,g337abbeb29+6660c170cc,g337c41fc51+9a8f8f0815,g37c6e7c3d5+7bbafe9d37,g44018dc512+6660c170cc,g4a941329ef+4f7594a38e,g4c90b7bd52+5145c320d2,g58be5f913a+bea990ba40,g635b316a6c+8d6b3a3e56,g67924a670a+bfead8c487,g6ae5381d9b+81bc2a20b4,g93c4d6e787+26b17396bd,g98cecbdb62+ed2cb6d659,g98ffbb4407+81bc2a20b4,g9ddcbc5298+7f7571301f,ga1e77700b3+99e9273977,gae46bcf261+6660c170cc,gb2715bf1a1+17526d298f,gc86a011abf+17526d298f,gcf0d15dbbd+96dd2c2ea9,gdaeeff99f8+0d8dbea60f,gdb4ec4c597+6660c170cc,ge23793e450+96dd2c2ea9,gf041782ebf+171108ac67
LSST Data Management Base Package
Loading...
Searching...
No Matches
_cameraSys.cc
Go to the documentation of this file.
1/*
2 * This file is part of afw.
3 *
4 * Developed for the LSST Data Management System.
5 * This product includes software developed by the LSST Project
6 * (https://www.lsst.org).
7 * See the COPYRIGHT file at the top-level directory of this distribution
8 * for details of code ownership.
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#include <string>
25
26#include <pybind11/pybind11.h>
27#include <lsst/utils/python.h>
28
29#include "lsst/utils/python.h"
30
32
33namespace py = pybind11;
34using namespace py::literals;
35
36namespace lsst {
37namespace afw {
38namespace cameraGeom {
39
40namespace {
47template <typename CppClass, typename PyClass>
48void declareCommonSysMethods(PyClass &cls) {
49 /* Operators */
50 cls.def(
51 "__eq__", [](CppClass const &self, CppClass const &other) { return self == other; },
52 py::is_operator());
53 cls.def(
54 "__ne__", [](CppClass const &self, CppClass const &other) { return self != other; },
55 py::is_operator());
56 utils::python::addOutputOp(cls, "__str__");
57 utils::python::addOutputOp(cls, "__repr__");
58 utils::python::addHash(cls);
59
60 /* Methods */
61 cls.def("getSysName", &CppClass::getSysName);
62}
63} // namespace
64
65void wrapCameraSys(lsst::utils::python::WrapperCollection &wrappers) {
66 /* Module level */
67 wrappers.wrapType(py::class_<CameraSysPrefix>(wrappers.module, "CameraSysPrefix"),
68 [](auto &mod, auto &cls) {
69 declareCommonSysMethods<CameraSysPrefix>(cls);
70 cls.def(py::init<std::string const &>(), "sysName"_a);
71 });
72 wrappers.wrapType(py::class_<CameraSys>(wrappers.module, "CameraSys"), [](auto &mod, auto &cls) {
73 declareCommonSysMethods<CameraSys>(cls);
74 /* Constructors */
75 cls.def(py::init<std::string const &>(), "sysName"_a);
76 cls.def(py::init<std::string const &, std::string const &>(), "sysName"_a, "detectorName"_a = "");
77 cls.def(py::init<CameraSysPrefix const &, std::string const &>(), "sysPrefix"_a,
78 "detectorName"_a = "");
79 /* Members */
80 cls.def("getDetectorName", &CameraSys::getDetectorName);
81 cls.def("hasDetectorName", &CameraSys::hasDetectorName);
82 });
83
84 // The following must come after the associated pybind11 class is declared
85 // (e.g. FOCAL_PLANE is a CameraSys, so clsCameraSys must have been declared
86 wrappers.wrap([](auto &mod) {
87 mod.attr("FOCAL_PLANE") = py::cast(FOCAL_PLANE);
88 mod.attr("FIELD_ANGLE") = py::cast(FIELD_ANGLE);
89 mod.attr("PIXELS") = py::cast(PIXELS);
90 mod.attr("TAN_PIXELS") = py::cast(TAN_PIXELS);
91 mod.attr("ACTUAL_PIXELS") = py::cast(ACTUAL_PIXELS);
92 });
93}
94} // namespace cameraGeom
95} // namespace afw
96} // namespace lsst
CameraSys const FIELD_ANGLE
Field angle coordinates: Angle of a principal ray relative to the optical axis (x,...
Definition CameraSys.cc:32
CameraSysPrefix const TAN_PIXELS
Tangent-plane pixels on the detector (x, y unbinned pixels)
Definition CameraSys.cc:36
void wrapCameraSys(lsst::utils::python::WrapperCollection &)
Definition _cameraSys.cc:65
CameraSys const FOCAL_PLANE
Focal plane coordinates: Position on a 2-d planar approximation to the focal plane (x,...
Definition CameraSys.cc:30
CameraSysPrefix const PIXELS
Pixel coordinates: Nominal position on the entry surface of a given detector (x, y unbinned pixels).
Definition CameraSys.cc:34
CameraSysPrefix const ACTUAL_PIXELS
The actual pixels where the photon lands and electrons are generated (x,y unbinned) This takes into a...
Definition CameraSys.cc:38