LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
VisitInfo.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*- // fixed format comment for emacs
2 /*
3  * LSST Data Management System
4  * Copyright 2016 LSST Corporation.
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 
24 #ifndef LSST_AFW_IMAGE_VISITINFO_H_INCLUDED
25 #define LSST_AFW_IMAGE_VISITINFO_H_INCLUDED
26 
27 #include <cmath>
28 #include <limits>
29 
30 #include "lsst/base.h"
31 #include "lsst/daf/base.h"
33 #include "lsst/afw/coord/Weather.h"
34 #include "lsst/geom/Point.h"
35 #include "lsst/geom/SpherePoint.h"
36 #include "lsst/afw/table/misc.h" // for RecordId
39 
40 namespace lsst {
41 namespace afw {
42 namespace image {
43 
45 enum class RotType {
46  UNKNOWN,
47  SKY,
49  HORIZON,
52  MOUNT
55 };
56 
69 public:
90  daf::base::DateTime const &date, double ut1, lsst::geom::Angle const &era,
92  lsst::geom::SpherePoint const &boresightAzAlt, double boresightAirmass,
95  : _exposureId(exposureId),
96  _exposureTime(exposureTime),
97  _darkTime(darkTime),
98  _date(date),
99  _ut1(ut1),
100  _era(era),
101  _boresightRaDec(boresightRaDec),
102  _boresightAzAlt(boresightAzAlt),
103  _boresightAirmass(boresightAirmass),
104  _boresightRotAngle(boresightRotAngle),
105  _rotType(rotType),
106  _observatory(observatory),
107  _weather(weather){};
108 
109  explicit VisitInfo(daf::base::PropertySet const &metadata);
110 
111  ~VisitInfo() override = default;
112 
113  VisitInfo(VisitInfo const &) = default;
114  VisitInfo(VisitInfo &&) = default;
115  VisitInfo &operator=(VisitInfo const &) = default;
116  VisitInfo &operator=(VisitInfo &&) = default;
117 
118  bool operator==(VisitInfo const &other) const;
119  bool operator!=(VisitInfo const &other) const { return !(*this == other); };
120 
122  std::size_t hash_value() const noexcept override;
123 
125  table::RecordId getExposureId() const { return _exposureId; }
126 
128  double getExposureTime() const { return _exposureTime; }
129 
131  double getDarkTime() const { return _darkTime; }
132 
134  daf::base::DateTime getDate() const { return _date; }
135 
137  double getUt1() const { return _ut1; }
138 
140  lsst::geom::Angle getEra() const { return _era; }
141 
144  lsst::geom::SpherePoint getBoresightRaDec() const { return _boresightRaDec; }
145 
148  lsst::geom::SpherePoint getBoresightAzAlt() const { return _boresightAzAlt; }
149 
152  double getBoresightAirmass() const { return _boresightAirmass; }
153 
160  lsst::geom::Angle getBoresightRotAngle() const { return _boresightRotAngle; }
161 
163  RotType getRotType() const { return _rotType; }
164 
166  coord::Observatory getObservatory() const { return _observatory; }
167 
169  coord::Weather getWeather() const { return _weather; }
170 
171  bool isPersistable() const noexcept override { return true; }
172 
173  // get the local sidereal time on the meridian (equivalent, but not equal, to Local Mean Sidereal Time)
174  lsst::geom::Angle getLocalEra() const;
175 
176  // get hour angle at the boresight
177  lsst::geom::Angle getBoresightHourAngle() const;
178 
188  lsst::geom::Angle getBoresightParAngle() const;
189 
191  std::shared_ptr<typehandling::Storable> cloneStorable() const override;
192 
194  std::string toString() const override;
195 
201  bool equals(typehandling::Storable const &other) const noexcept override;
202 
203 protected:
204  std::string getPersistenceName() const override;
205 
206  void write(OutputArchiveHandle &handle) const override;
207 
208 private:
209  table::RecordId _exposureId;
210  double _exposureTime;
211  double _darkTime;
212  daf::base::DateTime _date;
213  double _ut1;
214  lsst::geom::Angle _era;
215  lsst::geom::SpherePoint _boresightRaDec;
216  lsst::geom::SpherePoint _boresightAzAlt;
217  double _boresightAirmass;
218  lsst::geom::Angle _boresightRotAngle;
219  RotType _rotType;
220  coord::Observatory _observatory;
221  coord::Weather _weather;
222 };
223 
225 
226 namespace detail {
227 
234 void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo);
235 
244 
245 } // namespace detail
246 } // namespace image
247 } // namespace afw
248 } // namespace lsst
249 
250 namespace std {
251 template <>
252 struct hash<lsst::afw::image::VisitInfo> {
255  size_t operator()(argument_type const &obj) const noexcept { return obj.hash_value(); }
256 };
257 } // namespace std
258 
259 #endif // !LSST_AFW_IMAGE_VISITINFO_H_INCLUDED
double getBoresightAirmass() const
get airmass at the boresight, relative to zenith at sea level (and at the middle of the exposure...
Definition: VisitInfo.h:152
def write(self, patchRef, catalog)
Write the output.
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:148
size_t operator()(argument_type const &obj) const noexcept
Definition: VisitInfo.h:255
Basic LSST definitions.
Class for handling dates/times, including MJD, UTC, and TAI.
Definition: DateTime.h:64
std::ostream & operator<<(std::ostream &os, Measurement const &measurement)
Definition: PhotoCalib.cc:48
VisitInfo(table::RecordId exposureId, double exposureTime, double darkTime, daf::base::DateTime const &date, double ut1, lsst::geom::Angle const &era, lsst::geom::SpherePoint const &boresightRaDec, lsst::geom::SpherePoint const &boresightAzAlt, double boresightAirmass, lsst::geom::Angle const &boresightRotAngle, RotType const &rotType, coord::Observatory const &observatory, coord::Weather const &weather)
Construct a VisitInfo.
Definition: VisitInfo.h:89
An object passed to Persistable::write to allow it to persist itself.
table::Key< double > ut1
Definition: VisitInfo.cc:162
Class for storing ordered metadata with comments.
Definition: PropertyList.h:68
Hold the location of an observatory.
Definition: Observatory.h:43
table::CoordKey boresightRaDec
Definition: VisitInfo.cc:164
RotType
Type of rotation.
Definition: VisitInfo.h:45
Interface supporting iteration over heterogenous containers.
Definition: Storable.h:58
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:68
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:144
STL namespace.
double getUt1() const
get UT1 (universal time) MJD date at middle of exposure
Definition: VisitInfo.h:137
table::Key< double > boresightAirmass
Definition: VisitInfo.cc:167
double getDarkTime() const
get time from CCD flush to exposure readout, including shutter open time (despite the name); (sec) ...
Definition: VisitInfo.h:131
ItemVariant const * other
Definition: Schema.cc:56
std::size_t hash_value(Extent< T, N > const &extent) noexcept
Definition: Extent.cc:127
table::Key< lsst::geom::Angle > era
Definition: VisitInfo.cc:163
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: VisitInfo.h:171
table::Key< int > rotType
Definition: VisitInfo.cc:169
Rotation angle is unknown.
A class representing an angle.
Definition: Angle.h:127
STL class.
table::Key< lsst::geom::Angle > boresightRotAngle
Definition: VisitInfo.cc:168
void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo)
Set FITS metadata from a VisitInfo.
Definition: VisitInfo.cc:281
A base class for image defects.
table::Key< double > exposureTime
Definition: VisitInfo.cc:159
table::RecordId getExposureId() const
get exposure ID
Definition: VisitInfo.h:125
bool operator!=(VisitInfo const &other) const
Definition: VisitInfo.h:119
table::Key< table::RecordId > exposureId
Definition: VisitInfo.cc:158
double getExposureTime() const
get exposure duration (shutter open time); (sec)
Definition: VisitInfo.h:128
RotType getRotType() const
get rotation type of boresightRotAngle
Definition: VisitInfo.h:163
Basic weather information sufficient for a simple model for air mass or refraction.
Definition: Weather.h:38
lsst::geom::Angle getEra() const
get earth rotation angle at middle of exposure
Definition: VisitInfo.h:140
Position angle of focal plane +Y, measured from N through E.
daf::base::DateTime getDate() const
get uniform date and time at middle of exposure
Definition: VisitInfo.h:134
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:57
Class for storing generic metadata.
Definition: PropertySet.h:67
int stripVisitInfoKeywords(daf::base::PropertySet &metadata)
Remove VisitInfo-related keywords from the metadata.
Definition: VisitInfo.cc:265
Position angle of focal plane +Y, measured from +Alt through +Az.
lsst::geom::Angle getBoresightRotAngle() const
Get rotation angle at boresight at middle of exposure.
Definition: VisitInfo.h:160
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
table::Key< double > darkTime
Definition: VisitInfo.cc:160
std::ostream * os
Definition: Schema.cc:746
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:176
STL class.
coord::Observatory getObservatory() const
get observatory longitude, latitude and elevation
Definition: VisitInfo.h:166
coord::Weather getWeather() const
get basic weather information
Definition: VisitInfo.h:169
The position sent to the instrument rotator; the details depend on the rotator.