LSST Applications g1653933729+34a971ddd9,g1a997c3884+34a971ddd9,g28da252d5a+32b12a4112,g2bbee38e9b+ffc559ee46,g2bc492864f+ffc559ee46,g2cdde0e794+704103fe75,g3156d2b45e+6e87dc994a,g347aa1857d+ffc559ee46,g35bb328faa+34a971ddd9,g3a166c0a6a+ffc559ee46,g3e281a1b8c+8ec26ec694,g4005a62e65+ba0306790b,g414038480c+9f5be647b3,g41af890bb2+686ab7cd58,g4e1a3235cc+1fd785b14f,g7b55021d1b+da0d0eec6b,g80478fca09+6e21f9dc20,g82479be7b0+6fa35d7547,g858d7b2824+356eaf3287,g9125e01d80+34a971ddd9,ga5288a1d22+ba1f9bb3ef,gae0086650b+34a971ddd9,gb4748cc0e8+fd26a265a0,gb4ec7eb0ab+356eaf3287,gb58c049af0+ace264a4f2,gc081298178+30f12d1e69,gc28159a63d+ffc559ee46,gcf0d15dbbd+4adb3139bd,gd6b7c0dfd1+aae9efebf5,gda3e153d99+356eaf3287,gda6a2b7d83+4adb3139bd,gdaeeff99f8+7774323b41,gdd5a9049c5+ea78b51778,ge2409df99d+fa478de0b0,ge33fd446bb+356eaf3287,ge79ae78c31+ffc559ee46,gf0baf85859+890af219f9,gf5289d68f6+e11c78aeea,w.2024.41
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