LSST Applications g0f08755f38+82efc23009,g12f32b3c4e+e7bdf1200e,g1653933729+a8ce1bb630,g1a0ca8cf93+50eff2b06f,g28da252d5a+52db39f6a5,g2bbee38e9b+37c5a29d61,g2bc492864f+37c5a29d61,g2cdde0e794+c05ff076ad,g3156d2b45e+41e33cbcdc,g347aa1857d+37c5a29d61,g35bb328faa+a8ce1bb630,g3a166c0a6a+37c5a29d61,g3e281a1b8c+fb992f5633,g414038480c+7f03dfc1b0,g41af890bb2+11b950c980,g5fbc88fb19+17cd334064,g6b1c1869cb+12dd639c9a,g781aacb6e4+a8ce1bb630,g80478fca09+72e9651da0,g82479be7b0+04c31367b4,g858d7b2824+82efc23009,g9125e01d80+a8ce1bb630,g9726552aa6+8047e3811d,ga5288a1d22+e532dc0a0b,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+37c5a29d61,gcf0d15dbbd+2acd6d4d48,gd7358e8bfb+778a810b6e,gda3e153d99+82efc23009,gda6a2b7d83+2acd6d4d48,gdaeeff99f8+1711a396fd,ge2409df99d+6b12de1076,ge79ae78c31+37c5a29d61,gf0baf85859+d0a5978c5a,gf3967379c6+4954f8c433,gfb92a5be7c+82efc23009,gfec2e1e490+2aaed99252,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
_visitInfo.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 "pybind11/pybind11.h"
26
27#include <memory>
28#include <limits>
29#include <sstream>
30
32
36#include "lsst/geom/Angle.h"
38#include "lsst/afw/table/io/python.h" // for addPersistableMethods
39#include "lsst/afw/table/misc.h"
42
43namespace py = pybind11;
44using namespace pybind11::literals;
45
46namespace lsst {
47namespace afw {
48namespace image {
49
50namespace {
51
52static double const nan(std::numeric_limits<double>::quiet_NaN());
53static lsst::geom::Angle const nanAngle(nan);
54
55} // namespace
56
58 wrappers.wrapType(
60 "VisitInfo"),
61 [](auto &mod, auto &cls) {
62 /* Constructors */
63 cls.def(py::init<double, double, daf::base::DateTime const &, double,
64 lsst::geom::Angle const &, lsst::geom::SpherePoint const &,
65 lsst::geom::SpherePoint const &, double, lsst::geom::Angle const &,
66 RotType const &, coord::Observatory const &, coord::Weather const &,
67 std::string const &, table::RecordId const &, double, std::string const &,
68 std::string const &, std::string const &, std::string const &, bool>(),
69 "exposureTime"_a = nan, "darkTime"_a = nan, "date"_a = daf::base::DateTime(),
70 "ut1"_a = nan, "era"_a = nanAngle,
71 "boresightRaDec"_a = lsst::geom::SpherePoint(nanAngle, nanAngle),
72 "boresightAzAlt"_a = lsst::geom::SpherePoint(nanAngle, nanAngle),
73 "boresightAirmass"_a = nan, "boresightRotAngle"_a = nanAngle,
74 "rotType"_a = RotType::UNKNOWN,
75 "observatory"_a = coord::Observatory(nanAngle, nanAngle, nan),
76 "weather"_a = coord::Weather(nan, nan, nan), "instrumentLabel"_a = "", "id"_a = 0,
77 "focusZ"_a = nan, "observationType"_a = "", "scienceProgram"_a = "",
78 // default hasSimulatedContent=false for backwards compatibility
79 "observationReason"_a = "", "object"_a = "", "hasSimulatedContent"_a = false);
80 cls.def(py::init<daf::base::PropertySet const &>(), "metadata"_a);
81 cls.def(py::init<VisitInfo const &>(), "visitInfo"_a);
82
83 table::io::python::addPersistableMethods<VisitInfo>(cls);
84
85 /* Operators */
86 cls.def(
87 "__eq__", [](VisitInfo const &self, VisitInfo const &other) { return self == other; },
88 py::is_operator());
89 cls.def(
90 "__ne__", [](VisitInfo const &self, VisitInfo const &other) { return self != other; },
91 py::is_operator());
92
93 /* Members */
94 cls.def("getExposureTime", &VisitInfo::getExposureTime);
95 cls.def("getDarkTime", &VisitInfo::getDarkTime);
96 cls.def("getDate", &VisitInfo::getDate);
97 cls.def("getUt1", &VisitInfo::getUt1);
98 cls.def("getEra", &VisitInfo::getEra);
99 cls.def("getBoresightRaDec", &VisitInfo::getBoresightRaDec);
100 cls.def("getBoresightAzAlt", &VisitInfo::getBoresightAzAlt);
101 cls.def("getBoresightAirmass", &VisitInfo::getBoresightAirmass);
102 cls.def("getBoresightParAngle", &VisitInfo::getBoresightParAngle);
103 cls.def("getBoresightRotAngle", &VisitInfo::getBoresightRotAngle);
104 cls.def("getRotType", &VisitInfo::getRotType);
105 cls.def("getObservatory", &VisitInfo::getObservatory);
106 cls.def("getWeather", &VisitInfo::getWeather);
107 cls.def("isPersistable", &VisitInfo::isPersistable);
108 cls.def("getLocalEra", &VisitInfo::getLocalEra);
109 cls.def("getBoresightHourAngle", &VisitInfo::getBoresightHourAngle);
110 cls.def("getInstrumentLabel", &VisitInfo::getInstrumentLabel);
111 cls.def("getId", &VisitInfo::getId);
112 cls.def("getFocusZ", &VisitInfo::getFocusZ);
113 cls.def("getObservationType", &VisitInfo::getObservationType);
114 cls.def("getScienceProgram", &VisitInfo::getScienceProgram);
115 cls.def("getObservationReason", &VisitInfo::getObservationReason);
116 cls.def("getObject", &VisitInfo::getObject);
117 cls.def("getHasSimulatedContent", &VisitInfo::getHasSimulatedContent);
118
119 /* readonly property accessors */
120 cls.def_property_readonly("exposureTime", &VisitInfo::getExposureTime);
121 cls.def_property_readonly("darkTime", &VisitInfo::getDarkTime);
122 cls.def_property_readonly("date", &VisitInfo::getDate);
123 cls.def_property_readonly("ut1", &VisitInfo::getUt1);
124 cls.def_property_readonly("era", &VisitInfo::getEra);
125 cls.def_property_readonly("boresightRaDec", &VisitInfo::getBoresightRaDec);
126 cls.def_property_readonly("boresightAzAlt", &VisitInfo::getBoresightAzAlt);
127 cls.def_property_readonly("boresightAirmass", &VisitInfo::getBoresightAirmass);
128 cls.def_property_readonly("boresightParAngle", &VisitInfo::getBoresightParAngle);
129 cls.def_property_readonly("boresightRotAngle", &VisitInfo::getBoresightRotAngle);
130 cls.def_property_readonly("rotType", &VisitInfo::getRotType);
131 cls.def_property_readonly("observatory", &VisitInfo::getObservatory);
132 cls.def_property_readonly("weather", &VisitInfo::getWeather);
133 cls.def_property_readonly("isPersistable", &VisitInfo::isPersistable);
134 cls.def_property_readonly("localEra", &VisitInfo::getLocalEra);
135 cls.def_property_readonly("boresightHourAngle", &VisitInfo::getBoresightHourAngle);
136 cls.def_property_readonly("instrumentLabel", &VisitInfo::getInstrumentLabel);
137 cls.def_property_readonly("id", &VisitInfo::getId);
138 cls.def_property_readonly("focusZ", &VisitInfo::getFocusZ);
139 cls.def_property_readonly("observationType", &VisitInfo::getObservationType);
140 cls.def_property_readonly("scienceProgram", &VisitInfo::getScienceProgram);
141 cls.def_property_readonly("observationReason", &VisitInfo::getObservationReason);
142 cls.def_property_readonly("object", &VisitInfo::getObject);
143 cls.def_property_readonly("hasSimulatedContent", &VisitInfo::getHasSimulatedContent);
144
145 cpputils::python::addOutputOp(cls, "__repr__");
146 });
147}
149 wrappers.wrapType(py::enum_<RotType>(wrappers.module, "RotType"), [](auto &mod, auto &enm) {
150 enm.value("UNKNOWN", RotType::UNKNOWN);
151 enm.value("SKY", RotType::SKY);
152 enm.value("HORIZON", RotType::HORIZON);
153 enm.value("MOUNT", RotType::MOUNT);
154 enm.export_values();
155 });
156}
157
159 wrappers.addInheritanceDependency("lsst.daf.base");
160 wrappers.addInheritanceDependency("lsst.geom");
161 wrappers.addInheritanceDependency("lsst.afw.coord");
162 wrappers.addInheritanceDependency("lsst.afw.typehandling");
163 declareRotType(wrappers);
164 declareVisitInfo(wrappers);
165 wrappers.wrap([](auto &mod) {
166 /* Free Functions */
167 mod.def("setVisitInfoMetadata", &detail::setVisitInfoMetadata, "metadata"_a, "visitInfo"_a);
168 mod.def("stripVisitInfoKeywords", &detail::stripVisitInfoKeywords, "metadata"_a);
169 });
170}
171} // namespace image
172} // namespace afw
173} // namespace lsst
Information about a single exposure of an imaging camera.
Definition VisitInfo.h:68
daf::base::DateTime getDate() const
get uniform date and time at middle of exposure
Definition VisitInfo.h:150
coord::Weather getWeather() const
get basic weather information
Definition VisitInfo.h:185
lsst::geom::Angle getLocalEra() const
Definition VisitInfo.cc:612
double getUt1() const
get UT1 (universal time) MJD date at middle of exposure
Definition VisitInfo.h:153
double getBoresightAirmass() const
get airmass at the boresight, relative to zenith at sea level (and at the middle of the exposure,...
Definition VisitInfo.h:168
std::string getScienceProgram() const
Definition VisitInfo.h:203
lsst::geom::Angle getBoresightHourAngle() const
Definition VisitInfo.cc:614
lsst::geom::Angle getBoresightRotAngle() const
Get rotation angle at boresight at middle of exposure.
Definition VisitInfo.h:176
lsst::geom::Angle getEra() const
get earth rotation angle at middle of exposure
Definition VisitInfo.h:156
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition VisitInfo.h:187
table::RecordId getId() const
Definition VisitInfo.h:197
std::string getObservationReason() const
Definition VisitInfo.h:204
double getExposureTime() const
get exposure duration (shutter open time); (sec)
Definition VisitInfo.h:144
RotType getRotType() const
get rotation type of boresightRotAngle
Definition VisitInfo.h:179
lsst::geom::SpherePoint getBoresightAzAlt() const
get refracted apparent topocentric Az/Alt position at the boresight (and at the middle of the exposur...
Definition VisitInfo.h:164
std::string getObject() const
Definition VisitInfo.h:205
lsst::geom::SpherePoint getBoresightRaDec() const
get ICRS RA/Dec position at the boresight (and at the middle of the exposure, if it varies with time)
Definition VisitInfo.h:160
std::string getInstrumentLabel() const
Definition VisitInfo.h:195
bool getHasSimulatedContent() const
Definition VisitInfo.h:206
double getDarkTime() const
get time from CCD flush to exposure readout, including shutter open time (despite the name); (sec)
Definition VisitInfo.h:147
coord::Observatory getObservatory() const
get observatory longitude, latitude and elevation
Definition VisitInfo.h:182
lsst::geom::Angle getBoresightParAngle() const
Get parallactic angle at the boresight.
Definition VisitInfo.cc:616
std::string getObservationType() const
Definition VisitInfo.h:202
Interface supporting iteration over heterogenous containers.
Definition Storable.h:58
A helper class for subdividing pybind11 module across multiple translation units (i....
Definition python.h:242
void wrap(WrapperCallback function)
Add a set of wrappers without defining a class.
Definition python.h:369
void addInheritanceDependency(std::string const &name)
Indicate an external module that provides a base class for a subsequent addType call.
Definition python.h:343
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
A class representing an angle.
Definition Angle.h:128
void declareRotType(lsst::cpputils::python::WrapperCollection &wrappers)
void wrapVisitInfo(lsst::cpputils::python::WrapperCollection &)
void declareVisitInfo(lsst::cpputils::python::WrapperCollection &wrappers)
Definition _visitInfo.cc:57
void addOutputOp(PyClass &cls, std::string const &method)
Add __str__ or __repr__ method implemented by operator<<.
Definition python.h:87
T nan(T... args)