LSST Applications g063fba187b+cac8b7c890,g0f08755f38+6aee506743,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+b4475c5878,g1dcb35cd9c+8f9bc1652e,g20f6ffc8e0+6aee506743,g217e2c1bcf+73dee94bd0,g28da252d5a+1f19c529b9,g2bbee38e9b+3f2625acfc,g2bc492864f+3f2625acfc,g3156d2b45e+6e55a43351,g32e5bea42b+1bb94961c2,g347aa1857d+3f2625acfc,g35bb328faa+a8ce1bb630,g3a166c0a6a+3f2625acfc,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+8a9e676b2a,g7af13505b9+809c143d88,g80478fca09+6ef8b1810f,g82479be7b0+f568feb641,g858d7b2824+6aee506743,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+2903d499ea,gb58c049af0+d64f4d3760,gc28159a63d+3f2625acfc,gcab2d0539d+b12535109e,gcf0d15dbbd+46a3f46ba9,gda6a2b7d83+46a3f46ba9,gdaeeff99f8+1711a396fd,ge79ae78c31+3f2625acfc,gef2f8181fd+0a71e47438,gf0baf85859+c1f95f4921,gfa517265be+6aee506743,gfa999e8aa5+17cd334064,w.2024.51
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