LSST Applications g04e9c324dd+8c5ae1fdc5,g123d84c11c+8c5ae1fdc5,g1ec0fe41b4+6ec6b74de1,g1fd858c14a+3332b7fd5e,g29a0cc5914+63e6b38501,g32513d92db+32ea961568,g35bb328faa+8c5ae1fdc5,g46874a5070+b0fbcfa072,g4d44eb3520+57cbe129f8,g53246c7159+8c5ae1fdc5,g5c55814f68+d821c87bfa,g60b5630c4e+b0fbcfa072,g663da51e9b+005a425d83,g67b6fd64d1+d4e0e85a95,g67fd3c3899+b0fbcfa072,g71d780ea3c+e1dc163c68,g78460c75b0+7e33a9eb6d,g786e29fd12+668abc6043,g844c57033c+929b3e9e34,g851e132a97+e172830085,g8852436030+a7ec7e5967,g89139ef638+d4e0e85a95,g8d7436a09f+38661d0626,g989de1cb63+d4e0e85a95,g9f33ca652e+23636040bc,ga1e959baac+5fbc491aed,ga2f891cd6c+b0fbcfa072,gabe3b4be73+8856018cbb,gabf8522325+cc757f8247,gac2eed3f23+d4e0e85a95,gb1101e3267+68a34dc4ce,gb89ab40317+d4e0e85a95,gcf25f946ba+a7ec7e5967,gd107969129+28621171e6,gd6cbbdb0b4+8e46defd2a,ge410e46f29+d4e0e85a95,geaed405ab2+2322f1d6ea,gf5e32f922b+8c5ae1fdc5,w.2025.31
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
pybind11::module module
The module object passed to the PYBIND11_MODULE block that contains this WrapperCollection.
Definition python.h:448
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