lsst.afw  13.0-92-g8ecf155+1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
visitInfo.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2008-2017 AURA/LSST.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
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 
23 #include "pybind11/pybind11.h"
24 
25 #include <memory>
26 #include <limits>
27 
28 #include "lsst/daf/base/PropertySet.h"
29 #include "lsst/afw/coord/Coord.h"
31 #include "lsst/afw/coord/Weather.h"
32 #include "lsst/afw/geom/Angle.h"
35 #include "lsst/afw/table/misc.h"
37 
38 namespace py = pybind11;
39 using namespace pybind11::literals;
40 
41 namespace lsst {
42 namespace afw {
43 namespace image {
44 
45 namespace {
46 
47 static double const nan(std::numeric_limits<double>::quiet_NaN());
48 static geom::Angle const nanAngle(nan);
49 
50 } // anonymous
51 
52 PYBIND11_PLUGIN(visitInfo) {
53  py::module mod("visitInfo");
54 
55  /* Module level */
56  table::io::python::declarePersistableFacade<VisitInfo>(mod, "VisitInfo");
57 
58  py::class_<VisitInfo, std::shared_ptr<VisitInfo>, table::io::PersistableFacade<VisitInfo>,
60  cls(mod, "VisitInfo");
61 
62  /* Member types and enums */
63  py::enum_<RotType>(mod, "RotType")
64  .value("UNKNOWN", RotType::UNKNOWN)
65  .value("SKY", RotType::SKY)
66  .value("HORIZON", RotType::HORIZON)
67  .value("MOUNT", RotType::MOUNT)
68  .export_values();
69 
70  /* Constructors */
71  cls.def(py::init<table::RecordId, double, double, daf::base::DateTime const &, double,
72  geom::Angle const &, coord::IcrsCoord const &, coord::Coord const &, double,
73  geom::Angle const &, RotType const &, coord::Observatory const &,
74  coord::Weather const &>(),
75  "exposureId"_a = 0, "exposureTime"_a = nan, "darkTime"_a = nan, "date"_a = daf::base::DateTime(),
76  "ut1"_a = nan, "era"_a = nanAngle, "boresightRaDec"_a = coord::IcrsCoord(nanAngle, nanAngle),
77  "boresightAzAlt"_a = coord::Coord(nanAngle, nanAngle), "boresightAirmass"_a = nan,
78  "boresightRotAngle"_a = nanAngle, "rotType"_a = RotType::UNKNOWN,
79  "observatory"_a = coord::Observatory(nanAngle, nanAngle, nan),
80  "weather"_a = coord::Weather(nan, nan, nan));
81  cls.def(py::init<daf::base::PropertySet const &>(), "metadata"_a);
82  cls.def(py::init<VisitInfo const &>(), "visitInfo"_a);
83 
84  /* Operators */
85  cls.def("__eq__", [](VisitInfo const &self, VisitInfo const &other) { return self == other; },
86  py::is_operator());
87  cls.def("__ne__", [](VisitInfo const &self, VisitInfo const &other) { return self != other; },
88  py::is_operator());
89 
90  /* Members */
91  cls.def("getExposureId", &VisitInfo::getExposureId);
92  cls.def("getExposureTime", &VisitInfo::getExposureTime);
93  cls.def("getDarkTime", &VisitInfo::getDarkTime);
94  cls.def("getDate", &VisitInfo::getDate);
95  cls.def("getUt1", &VisitInfo::getUt1);
96  cls.def("getEra", &VisitInfo::getEra);
97  cls.def("getBoresightRaDec", &VisitInfo::getBoresightRaDec);
98  cls.def("getBoresightAzAlt", &VisitInfo::getBoresightAzAlt);
99  cls.def("getBoresightAirmass", &VisitInfo::getBoresightAirmass);
100  cls.def("getBoresightRotAngle", &VisitInfo::getBoresightRotAngle);
101  cls.def("getRotType", &VisitInfo::getRotType);
102  cls.def("getObservatory", &VisitInfo::getObservatory);
103  cls.def("getWeather", &VisitInfo::getWeather);
104  cls.def("isPersistable", &VisitInfo::isPersistable);
105  cls.def("getLocalEra", &VisitInfo::getLocalEra);
106  cls.def("getBoresightHourAngle", &VisitInfo::getBoresightHourAngle);
107 
108  /* Free Functions */
109  mod.def("setVisitInfoMetadata", &detail::setVisitInfoMetadata, "metadata"_a, "visitInfo"_a);
110  mod.def("stripVisitInfoKeywords", &detail::stripVisitInfoKeywords, "metadata"_a);
111 
112  return mod.ptr();
113 }
114 }
115 }
116 } // namespace lsst::afw::image
std::int64_t RecordId
Type used for unique IDs for records.
Definition: misc.h:22
lsst::afw::geom::Angle Angle
Definition: misc.h:36
Hold the location of an observatory.
Definition: Observatory.h:41
RotType
Type of rotation.
Definition: VisitInfo.h:44
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:67
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:73
PYBIND11_PLUGIN(_cameraPoint)
Definition: cameraPoint.cc:35
void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo)
Set FITS metadata from a VisitInfo.
Definition: VisitInfo.cc:275
A class representing an angle.
Definition: Angle.h:102
double const _a
Definition: RandomImage.cc:77
Basic weather information sufficient for a simple model for air mass or refraction.
Definition: Weather.h:38
afw::table::Key< afw::table::Array< ImagePixelT > > image
int stripVisitInfoKeywords(daf::base::PropertySet &metadata)
Remove VisitInfo-related keywords from the metadata.
Definition: VisitInfo.cc:259
This is the base class for spherical coordinates.
Definition: Coord.h:63
A class to handle Icrs coordinates (inherits from Coord)
Definition: Coord.h:288