LSST Applications g180d380827+78227d2bc4,g2079a07aa2+86d27d4dc4,g2305ad1205+bdd7851fe3,g2bbee38e9b+c6a8a0fb72,g337abbeb29+c6a8a0fb72,g33d1c0ed96+c6a8a0fb72,g3a166c0a6a+c6a8a0fb72,g3d1719c13e+260d7c3927,g3ddfee87b4+723a6db5f3,g487adcacf7+29e55ea757,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+9443c4b912,g62aa8f1a4b+7e2ea9cd42,g858d7b2824+260d7c3927,g864b0138d7+8498d97249,g95921f966b+dffe86973d,g991b906543+260d7c3927,g99cad8db69+4809d78dd9,g9c22b2923f+e2510deafe,g9ddcbc5298+9a081db1e4,ga1e77700b3+03d07e1c1f,gb0e22166c9+60f28cb32d,gb23b769143+260d7c3927,gba4ed39666+c2a2e4ac27,gbb8dafda3b+e22341fd87,gbd998247f1+585e252eca,gc120e1dc64+713f94b854,gc28159a63d+c6a8a0fb72,gc3e9b769f7+385ea95214,gcf0d15dbbd+723a6db5f3,gdaeeff99f8+f9a426f77a,ge6526c86ff+fde82a80b9,ge79ae78c31+c6a8a0fb72,gee10cc3b42+585e252eca,w.2024.18
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)