LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
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"
25#include "lsst/utils/python.h"
26
27#include <memory>
28#include <limits>
29#include <sstream>
30
31#include "lsst/utils/python.h"
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
57void declareVisitInfo(lsst::utils::python::WrapperCollection &wrappers) {
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 utils::python::addOutputOp(cls, "__repr__");
146 });
147}
148void declareRotType(lsst::utils::python::WrapperCollection &wrappers) {
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
158void wrapVisitInfo(lsst::utils::python::WrapperCollection &wrappers) {
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 class representing an angle.
Definition Angle.h:128
void declareVisitInfo(lsst::utils::python::WrapperCollection &wrappers)
Definition _visitInfo.cc:57
void declareRotType(lsst::utils::python::WrapperCollection &wrappers)
void wrapVisitInfo(lsst::utils::python::WrapperCollection &)
T nan(T... args)