LSST Applications g063fba187b+ea58ee1f2e,g0f08755f38+c959026f09,g12f32b3c4e+e8fc1d5a1e,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a0ca8cf93+2f198f2aa8,g28da252d5a+7e025d8f94,g2bbee38e9b+c076ca1133,g2bc492864f+c076ca1133,g3156d2b45e+41e33cbcdc,g347aa1857d+c076ca1133,g35bb328faa+a8ce1bb630,g3a166c0a6a+c076ca1133,g3e281a1b8c+b162652f75,g414038480c+6cfc39b08c,g41af890bb2+d4c324d475,g5fbc88fb19+17cd334064,g6b1c1869cb+878204452a,g781aacb6e4+a8ce1bb630,g7e767a00ed+7def0f636c,g80478fca09+a0d7f63753,g82479be7b0+60cf5d37e7,g8554a5dd34+0e332c04ee,g858d7b2824+c959026f09,g89c8672015+ff349045bf,g9125e01d80+a8ce1bb630,g9726552aa6+3a8748fa0c,ga5288a1d22+59736ba80c,gb58c049af0+d64f4d3760,gc28159a63d+c076ca1133,gcf0d15dbbd+efb7d8614d,gda3e153d99+c959026f09,gda6a2b7d83+efb7d8614d,gdaeeff99f8+1711a396fd,ge2409df99d+2c01d16122,ge79ae78c31+c076ca1133,gf0baf85859+50e8a91c63,gfb92a5be7c+c959026f09,w.2024.47
LSST Data Management Base Package
Loading...
Searching...
No Matches
frame.cc
Go to the documentation of this file.
1/*
2 * LSST Data Management System
3 *
4 * This product includes software developed by the
5 * LSST Project (http://www.lsst.org/).
6 * See the COPYRIGHT file
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the LSST License Statement and
19 * the GNU General Public License along with this program. If not,
20 * see <https://www.lsstcorp.org/LegalNotices/>.
21 */
22#include <pybind11/pybind11.h>
23#include <pybind11/stl.h>
25
26#include "astshim/CmpFrame.h"
27#include "astshim/Frame.h"
28#include "astshim/FrameSet.h"
29#include "astshim/Mapping.h"
30
31namespace py = pybind11;
32using namespace pybind11::literals;
33
34namespace ast {
35
37 wrappers.wrapType(py::class_<DirectionPoint>(wrappers.module, "DirectionPoint"), [](auto &mod, auto &cls) {
38 cls.def(py::init<double, PointD>(), "direction"_a, "point"_a);
39 cls.def_readwrite("direction", &DirectionPoint::direction);
40 cls.def_readwrite("point", &DirectionPoint::point);
41 });
42}
43
45 wrappers.wrapType(py::class_<NReadValue>(wrappers.module, "NReadValue"), [](auto &mod, auto &cls) {
46 cls.def(py::init<int, double>(), "nread"_a, "value"_a);
47 cls.def_readwrite("nread", &NReadValue::nread);
48 cls.def_readwrite("value", &NReadValue::value);
49 });
50}
51
53 wrappers.wrapType(py::class_<ResolvedPoint> (wrappers.module, "ResolvedPoint"), [](auto &mod, auto &cls) {
54 cls.def(py::init<int>(), "naxes"_a);
55 cls.def_readwrite("point", &ResolvedPoint::point);
56 cls.def_readwrite("d1", &ResolvedPoint::d1);
57 cls.def_readwrite("d2", &ResolvedPoint::d2);
58 });
59}
60
62 wrappers.wrapType(py::class_<FrameMapping>(wrappers.module, "FrameMapping"), [](auto &mod, auto &cls) {
63 cls.def(py::init<std::shared_ptr<Frame>, std::shared_ptr<Mapping>>(), "frame"_a, "mapping"_a);
64 cls.def_readwrite("frame", &FrameMapping::frame);
65 cls.def_readwrite("mapping", &FrameMapping::mapping);
66 });
67}
68
70 wrapDirectionPoint(wrappers);
71 wrapNReadValue(wrappers);
72 wrapResolvedPoint(wrappers);
73 wrapFrameMapping(wrappers);
74
75 using PyFrame = py::class_<Frame, std::shared_ptr<Frame>, Mapping>;
76 wrappers.wrapType(PyFrame(wrappers.module, "Frame"), [](auto &mod, auto &cls) {
77 cls.def(py::init<int, std::string const &>(), "naxes"_a, "options"_a = "");
78 cls.def(py::init<Frame const &>());
79
80 cls.def_property("activeUnit", &Frame::getActiveUnit, &Frame::setActiveUnit);
81 cls.def_property("alignSystem", &Frame::getAlignSystem, &Frame::setAlignSystem);
82 cls.def_property("domain", &Frame::getDomain, &Frame::setDomain);
83 cls.def_property("dut1", &Frame::getDut1, &Frame::setDut1);
84 cls.def_property("epoch", &Frame::getEpoch, py::overload_cast<double>(&Frame::setEpoch));
85 cls.def_property("matchEnd", &Frame::getMatchEnd, &Frame::setMatchEnd);
86 cls.def_property("maxAxes", &Frame::getMaxAxes, &Frame::setMaxAxes);
87 cls.def_property("minAxes", &Frame::getMinAxes, &Frame::setMinAxes);
88 cls.def_property_readonly("nAxes", &Frame::getNAxes);
89 cls.def_property("obsAlt", &Frame::getObsAlt, &Frame::setObsAlt);
90 cls.def_property("obsLat", &Frame::getObsLat, &Frame::setObsLat);
91 cls.def_property("obsLon", &Frame::getObsLon, &Frame::setObsLon);
92 cls.def_property("permute", &Frame::getPermute, &Frame::setPermute);
93 cls.def_property("preserveAxes", &Frame::getPreserveAxes, &Frame::setPreserveAxes);
94 cls.def_property("system", &Frame::getSystem, &Frame::setSystem);
95 cls.def_property("title", &Frame::getTitle, &Frame::setTitle);
96
97 cls.def("copy", &Frame::copy);
98 cls.def("angle", &Frame::angle, "a"_a, "b"_a, "c"_a);
99 cls.def("axAngle", &Frame::axAngle, "a"_a, "b"_a, "axis"_a);
100 cls.def("axDistance", &Frame::axDistance, "axis"_a, "v1"_a, "v2"_a);
101 cls.def("axOffset", &Frame::axOffset, "axis"_a, "v1"_a, "dist"_a);
102 cls.def("convert", &Frame::convert, "to"_a, "domainlist"_a = "");
103 cls.def("distance", &Frame::distance, "point1"_a, "point2"_a);
104 cls.def("findFrame", &Frame::findFrame, "template"_a, "domainlist"_a = "");
105 cls.def("format", &Frame::format, "axis"_a, "value"_a);
106 cls.def("getBottom", &Frame::getBottom, "axis"_a);
107 cls.def("getDigits", py::overload_cast<>(&Frame::getDigits, py::const_));
108 cls.def("getDigits", py::overload_cast<int>(&Frame::getDigits, py::const_), "axis"_a);
109 cls.def("getDirection", &Frame::getDirection, "axis"_a);
110 cls.def("getFormat", &Frame::getFormat, "axis"_a);
111 cls.def("getInternalUnit", &Frame::getInternalUnit);
112 cls.def("getLabel", &Frame::getLabel);
113 cls.def("getSymbol", &Frame::getSymbol, "axis"_a);
114 cls.def("getNormUnit", &Frame::getNormUnit, "axis"_a);
115 cls.def("getSymbol", &Frame::getSymbol, "axis"_a);
116 cls.def("getTop", &Frame::getTop, "axis"_a);
117 cls.def("getUnit", &Frame::getUnit, "axis"_a);
118 cls.def("intersect", &Frame::intersect, "a1"_a, "a2"_a, "b1"_a, "b2"_a);
119 cls.def("matchAxes", &Frame::matchAxes, "other"_a);
120 cls.def("under", &Frame::under, "next"_a);
121 cls.def("norm", &Frame::norm, "value"_a);
122 cls.def("offset", &Frame::offset, "point1"_a, "point2"_a, "offset"_a);
123 cls.def("offset2", &Frame::offset2, "point1"_a, "angle"_a, "offset"_a);
124 cls.def("permAxes", &Frame::permAxes, "perm"_a);
125 cls.def("pickAxes", &Frame::pickAxes, "axes"_a);
126 cls.def("resolve", &Frame::resolve, "point1"_a, "point2"_a, "point3"_a);
127 cls.def("setDigits", py::overload_cast<int>(&Frame::setDigits), "digits"_a);
128 cls.def("setDigits", py::overload_cast<int, int>(&Frame::setDigits), "axis"_a, "digits"_a);
129 cls.def("setDirection", &Frame::setDirection, "direction"_a, "axis"_a);
130
131 // keep setEpoch(string); use the epoch property to deal with it as a float
132 cls.def("setEpoch", py::overload_cast<std::string const &>(&Frame::setEpoch), "epoch"_a);
133 cls.def("setFormat", &Frame::setFormat, "axis"_a, "format"_a"format");
134 cls.def("setLabel", &Frame::setLabel, "axis"_a, "label"_a);
135 cls.def("setSymbol", &Frame::setSymbol, "axis"_a, "symbol"_a);
136 cls.def("setTop", &Frame::setTop, "axis"_a, "top"_a);
137 cls.def("setUnit", &Frame::setUnit, "axis"_a, "unit"_a);
138 cls.def("unformat", &Frame::unformat, "axis"_a, "str"_a);
139 });
140}
141
142} // namespace ast
An abstract base class for objects which transform one set of coordinates to another.
Definition Mapping.h:59
A helper class for subdividing pybind11 module across multiple translation units (i....
Definition python.h:242
PyType wrapType(PyType cls, ClassWrapperCallback function, bool setModuleName=true)
Add a type (class or enum) wrapper, deferring method and other attribute definitions until finish() i...
Definition python.h:391
AST wrapper classes and functions.
void wrapResolvedPoint(lsst::cpputils::python::WrapperCollection &wrappers)
Definition frame.cc:52
void wrapFrameMapping(lsst::cpputils::python::WrapperCollection &wrappers)
Definition frame.cc:61
void wrapNReadValue(lsst::cpputils::python::WrapperCollection &wrappers)
Definition frame.cc:44
void wrapDirectionPoint(lsst::cpputils::python::WrapperCollection &wrappers)
Definition frame.cc:36
void wrapFrame(WrapperCollection &)
Definition frame.cc:69