LSST Applications g070148d5b3+33e5256705,g0d53e28543+25c8b88941,g0da5cf3356+2dd1178308,g1081da9e2a+62d12e78cb,g17e5ecfddb+7e422d6136,g1c76d35bf8+ede3a706f7,g295839609d+225697d880,g2e2c1a68ba+cc1f6f037e,g2ffcdf413f+853cd4dcde,g38293774b4+62d12e78cb,g3b44f30a73+d953f1ac34,g48ccf36440+885b902d19,g4b2f1765b6+7dedbde6d2,g5320a0a9f6+0c5d6105b6,g56b687f8c9+ede3a706f7,g5c4744a4d9+ef6ac23297,g5ffd174ac0+0c5d6105b6,g6075d09f38+66af417445,g667d525e37+2ced63db88,g670421136f+2ced63db88,g71f27ac40c+2ced63db88,g774830318a+463cbe8d1f,g7876bc68e5+1d137996f1,g7985c39107+62d12e78cb,g7fdac2220c+0fd8241c05,g96f01af41f+368e6903a7,g9ca82378b8+2ced63db88,g9d27549199+ef6ac23297,gabe93b2c52+e3573e3735,gb065e2a02a+3dfbe639da,gbc3249ced9+0c5d6105b6,gbec6a3398f+0c5d6105b6,gc9534b9d65+35b9f25267,gd01420fc67+0c5d6105b6,geee7ff78d7+a14128c129,gf63283c776+ede3a706f7,gfed783d017+0c5d6105b6,w.2022.47
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<table::RecordId, 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 "exposureId"_a = 0, "exposureTime"_a = nan, "darkTime"_a = nan,
70 "date"_a = daf::base::DateTime(), "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("getExposureId", &VisitInfo::getExposureId);
95 cls.def("getExposureTime", &VisitInfo::getExposureTime);
96 cls.def("getDarkTime", &VisitInfo::getDarkTime);
97 cls.def("getDate", &VisitInfo::getDate);
98 cls.def("getUt1", &VisitInfo::getUt1);
99 cls.def("getEra", &VisitInfo::getEra);
100 cls.def("getBoresightRaDec", &VisitInfo::getBoresightRaDec);
101 cls.def("getBoresightAzAlt", &VisitInfo::getBoresightAzAlt);
102 cls.def("getBoresightAirmass", &VisitInfo::getBoresightAirmass);
103 cls.def("getBoresightParAngle", &VisitInfo::getBoresightParAngle);
104 cls.def("getBoresightRotAngle", &VisitInfo::getBoresightRotAngle);
105 cls.def("getRotType", &VisitInfo::getRotType);
106 cls.def("getObservatory", &VisitInfo::getObservatory);
107 cls.def("getWeather", &VisitInfo::getWeather);
108 cls.def("isPersistable", &VisitInfo::isPersistable);
109 cls.def("getLocalEra", &VisitInfo::getLocalEra);
110 cls.def("getBoresightHourAngle", &VisitInfo::getBoresightHourAngle);
111 cls.def("getInstrumentLabel", &VisitInfo::getInstrumentLabel);
112 cls.def("getId", &VisitInfo::getId);
113 cls.def("getFocusZ", &VisitInfo::getFocusZ);
114 cls.def("getObservationType", &VisitInfo::getObservationType);
115 cls.def("getScienceProgram", &VisitInfo::getScienceProgram);
116 cls.def("getObservationReason", &VisitInfo::getObservationReason);
117 cls.def("getObject", &VisitInfo::getObject);
118 cls.def("getHasSimulatedContent", &VisitInfo::getHasSimulatedContent);
119
120 /* readonly property accessors */
121 cls.def_property_readonly("exposureTime", &VisitInfo::getExposureTime);
122 cls.def_property_readonly("darkTime", &VisitInfo::getDarkTime);
123 cls.def_property_readonly("date", &VisitInfo::getDate);
124 cls.def_property_readonly("ut1", &VisitInfo::getUt1);
125 cls.def_property_readonly("era", &VisitInfo::getEra);
126 cls.def_property_readonly("boresightRaDec", &VisitInfo::getBoresightRaDec);
127 cls.def_property_readonly("boresightAzAlt", &VisitInfo::getBoresightAzAlt);
128 cls.def_property_readonly("boresightAirmass", &VisitInfo::getBoresightAirmass);
129 cls.def_property_readonly("boresightParAngle", &VisitInfo::getBoresightParAngle);
130 cls.def_property_readonly("boresightRotAngle", &VisitInfo::getBoresightRotAngle);
131 cls.def_property_readonly("rotType", &VisitInfo::getRotType);
132 cls.def_property_readonly("observatory", &VisitInfo::getObservatory);
133 cls.def_property_readonly("weather", &VisitInfo::getWeather);
134 cls.def_property_readonly("isPersistable", &VisitInfo::isPersistable);
135 cls.def_property_readonly("localEra", &VisitInfo::getLocalEra);
136 cls.def_property_readonly("boresightHourAngle", &VisitInfo::getBoresightHourAngle);
137 cls.def_property_readonly("instrumentLabel", &VisitInfo::getInstrumentLabel);
138 cls.def_property_readonly("id", &VisitInfo::getId);
139 cls.def_property_readonly("focusZ", &VisitInfo::getFocusZ);
140 cls.def_property_readonly("observationType", &VisitInfo::getObservationType);
141 cls.def_property_readonly("scienceProgram", &VisitInfo::getScienceProgram);
142 cls.def_property_readonly("observationReason", &VisitInfo::getObservationReason);
143 cls.def_property_readonly("object", &VisitInfo::getObject);
144 cls.def_property_readonly("hasSimulatedContent", &VisitInfo::getHasSimulatedContent);
145
146 utils::python::addOutputOp(cls, "__repr__");
147 });
148}
149void declareRotType(lsst::utils::python::WrapperCollection &wrappers) {
150 wrappers.wrapType(py::enum_<RotType>(wrappers.module, "RotType"), [](auto &mod, auto &enm) {
151 enm.value("UNKNOWN", RotType::UNKNOWN);
152 enm.value("SKY", RotType::SKY);
153 enm.value("HORIZON", RotType::HORIZON);
154 enm.value("MOUNT", RotType::MOUNT);
155 enm.export_values();
156 });
157}
158
159void wrapVisitInfo(lsst::utils::python::WrapperCollection &wrappers) {
160 wrappers.addInheritanceDependency("lsst.daf.base");
161 wrappers.addInheritanceDependency("lsst.geom");
162 wrappers.addInheritanceDependency("lsst.afw.coord");
163 wrappers.addInheritanceDependency("lsst.afw.typehandling");
164 declareRotType(wrappers);
165 declareVisitInfo(wrappers);
166 wrappers.wrap([](auto &mod) {
167 /* Free Functions */
168 mod.def("setVisitInfoMetadata", &detail::setVisitInfoMetadata, "metadata"_a, "visitInfo"_a);
169 mod.def("stripVisitInfoKeywords", &detail::stripVisitInfoKeywords, "metadata"_a);
170 });
171}
172} // namespace image
173} // namespace afw
174} // 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:164
coord::Weather getWeather() const
get basic weather information
Definition: VisitInfo.h:199
lsst::geom::Angle getLocalEra() const
Definition: VisitInfo.cc:633
double getUt1() const
get UT1 (universal time) MJD date at middle of exposure
Definition: VisitInfo.h:167
double getBoresightAirmass() const
get airmass at the boresight, relative to zenith at sea level (and at the middle of the exposure,...
Definition: VisitInfo.h:182
std::string getScienceProgram() const
Definition: VisitInfo.h:217
lsst::geom::Angle getBoresightHourAngle() const
Definition: VisitInfo.cc:635
lsst::geom::Angle getBoresightRotAngle() const
Get rotation angle at boresight at middle of exposure.
Definition: VisitInfo.h:190
table::RecordId getExposureId() const
get exposure ID
Definition: VisitInfo.h:153
lsst::geom::Angle getEra() const
get earth rotation angle at middle of exposure
Definition: VisitInfo.h:170
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: VisitInfo.h:201
table::RecordId getId() const
Definition: VisitInfo.h:211
double getFocusZ() const
Definition: VisitInfo.h:214
std::string getObservationReason() const
Definition: VisitInfo.h:218
double getExposureTime() const
get exposure duration (shutter open time); (sec)
Definition: VisitInfo.h:158
RotType getRotType() const
get rotation type of boresightRotAngle
Definition: VisitInfo.h:193
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:178
std::string getObject() const
Definition: VisitInfo.h:219
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:174
std::string getInstrumentLabel() const
Definition: VisitInfo.h:209
bool getHasSimulatedContent() const
Definition: VisitInfo.h:220
double getDarkTime() const
get time from CCD flush to exposure readout, including shutter open time (despite the name); (sec)
Definition: VisitInfo.h:161
coord::Observatory getObservatory() const
get observatory longitude, latitude and elevation
Definition: VisitInfo.h:196
lsst::geom::Angle getBoresightParAngle() const
Get parallactic angle at the boresight.
Definition: VisitInfo.cc:637
std::string getObservationType() const
Definition: VisitInfo.h:216
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)
Definition: _visitInfo.cc:149
void wrapVisitInfo(lsst::utils::python::WrapperCollection &)
Definition: _visitInfo.cc:159
T nan(T... args)