LSST Applications  21.0.0-147-g0e635eb1+1acddb5be5,22.0.0+052faf71bd,22.0.0+1ea9a8b2b2,22.0.0+6312710a6c,22.0.0+729191ecac,22.0.0+7589c3a021,22.0.0+9f079a9461,22.0.1-1-g7d6de66+b8044ec9de,22.0.1-1-g87000a6+536b1ee016,22.0.1-1-g8e32f31+6312710a6c,22.0.1-10-gd060f87+016f7cdc03,22.0.1-12-g9c3108e+df145f6f68,22.0.1-16-g314fa6d+c825727ab8,22.0.1-19-g93a5c75+d23f2fb6d8,22.0.1-19-gb93eaa13+aab3ef7709,22.0.1-2-g8ef0a89+b8044ec9de,22.0.1-2-g92698f7+9f079a9461,22.0.1-2-ga9b0f51+052faf71bd,22.0.1-2-gac51dbf+052faf71bd,22.0.1-2-gb66926d+6312710a6c,22.0.1-2-gcb770ba+09e3807989,22.0.1-20-g32debb5+b8044ec9de,22.0.1-23-gc2439a9a+fb0756638e,22.0.1-3-g496fd5d+09117f784f,22.0.1-3-g59f966b+1e6ba2c031,22.0.1-3-g849a1b8+f8b568069f,22.0.1-3-gaaec9c0+c5c846a8b1,22.0.1-32-g5ddfab5d3+60ce4897b0,22.0.1-4-g037fbe1+64e601228d,22.0.1-4-g8623105+b8044ec9de,22.0.1-5-g096abc9+d18c45d440,22.0.1-5-g15c806e+57f5c03693,22.0.1-7-gba73697+57f5c03693,master-g6e05de7fdc+c1283a92b8,master-g72cdda8301+729191ecac,w.2021.39
LSST Data Management Base Package
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,
48  SKY,
51  HORIZON,
54  MOUNT
55 };
56 
69 public:
92  daf::base::DateTime const &date, double ut1, lsst::geom::Angle const &era,
94  lsst::geom::SpherePoint const &boresightAzAlt, double boresightAirmass,
96  coord::Observatory const &observatory, coord::Weather const &weather,
98  : _exposureId(exposureId),
99  _exposureTime(exposureTime),
100  _darkTime(darkTime),
101  _date(date),
102  _ut1(ut1),
103  _era(era),
104  _boresightRaDec(boresightRaDec),
105  _boresightAzAlt(boresightAzAlt),
106  _boresightAirmass(boresightAirmass),
107  _boresightRotAngle(boresightRotAngle),
108  _rotType(rotType),
109  _observatory(observatory),
110  _weather(weather),
111  _instrumentLabel(instrumentLabel),
112  _id(id){};
113 
114  explicit VisitInfo(daf::base::PropertySet const &metadata);
115 
116  ~VisitInfo() override = default;
117 
118  VisitInfo(VisitInfo const &) = default;
119  VisitInfo(VisitInfo &&) = default;
120  VisitInfo &operator=(VisitInfo const &) = default;
121  VisitInfo &operator=(VisitInfo &&) = default;
122 
123  bool operator==(VisitInfo const &other) const;
124  bool operator!=(VisitInfo const &other) const { return !(*this == other); };
125 
127  std::size_t hash_value() const noexcept override;
128 
130  table::RecordId getExposureId() const { return _exposureId; }
131 
133  double getExposureTime() const { return _exposureTime; }
134 
136  double getDarkTime() const { return _darkTime; }
137 
139  daf::base::DateTime getDate() const { return _date; }
140 
142  double getUt1() const { return _ut1; }
143 
145  lsst::geom::Angle getEra() const { return _era; }
146 
149  lsst::geom::SpherePoint getBoresightRaDec() const { return _boresightRaDec; }
150 
153  lsst::geom::SpherePoint getBoresightAzAlt() const { return _boresightAzAlt; }
154 
157  double getBoresightAirmass() const { return _boresightAirmass; }
158 
165  lsst::geom::Angle getBoresightRotAngle() const { return _boresightRotAngle; }
166 
168  RotType getRotType() const { return _rotType; }
169 
171  coord::Observatory getObservatory() const { return _observatory; }
172 
174  coord::Weather getWeather() const { return _weather; }
175 
176  bool isPersistable() const noexcept override { return true; }
177 
178  // get the local sidereal time on the meridian (equivalent, but not equal, to Local Mean Sidereal Time)
180 
181  // get hour angle at the boresight
183 
184  std::string getInstrumentLabel() const { return _instrumentLabel; }
185 
186  table::RecordId getId() const { return _id; }
187 
198 
201 
203  std::string toString() const override;
204 
210  bool equals(typehandling::Storable const &other) const noexcept override;
211 
212 protected:
213  std::string getPersistenceName() const override;
214 
215  void write(OutputArchiveHandle &handle) const override;
216 
217 private:
218  table::RecordId _exposureId;
219  double _exposureTime;
220  double _darkTime;
221  daf::base::DateTime _date;
222  double _ut1;
223  lsst::geom::Angle _era;
224  lsst::geom::SpherePoint _boresightRaDec;
225  lsst::geom::SpherePoint _boresightAzAlt;
226  double _boresightAirmass;
227  lsst::geom::Angle _boresightRotAngle;
228  RotType _rotType;
229  coord::Observatory _observatory;
230  coord::Weather _weather;
231  std::string _instrumentLabel;
232  table::RecordId _id;
233 };
234 
235 std::ostream &operator<<(std::ostream &os, VisitInfo const &visitInfo);
236 
237 namespace detail {
238 
245 void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo);
246 
255 
256 } // namespace detail
257 } // namespace image
258 } // namespace afw
259 } // namespace lsst
260 
261 namespace std {
262 template <>
263 struct hash<lsst::afw::image::VisitInfo> {
266  size_t operator()(argument_type const &obj) const noexcept { return obj.hash_value(); }
267 };
268 } // namespace std
269 
270 #endif // !LSST_AFW_IMAGE_VISITINFO_H_INCLUDED
table::Key< int > id
Definition: Detector.cc:162
std::ostream * os
Definition: Schema.cc:557
table::Key< double > exposureTime
Definition: VisitInfo.cc:193
table::Key< lsst::geom::Angle > era
Definition: VisitInfo.cc:197
table::Key< int > rotType
Definition: VisitInfo.cc:203
table::Key< double > darkTime
Definition: VisitInfo.cc:194
table::Key< std::string > instrumentLabel
Definition: VisitInfo.cc:213
table::CoordKey boresightRaDec
Definition: VisitInfo.cc:198
table::Key< double > boresightAirmass
Definition: VisitInfo.cc:201
table::Key< lsst::geom::Angle > boresightRotAngle
Definition: VisitInfo.cc:202
table::Key< double > ut1
Definition: VisitInfo.cc:196
table::Key< table::RecordId > exposureId
Definition: VisitInfo.cc:192
Basic LSST definitions.
Hold the location of an observatory.
Definition: Observatory.h:43
Basic weather information sufficient for a simple model for air mass or refraction.
Definition: Weather.h:38
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:68
std::string getPersistenceName() const override
Return the unique name used to persist this object and look up its factory.
Definition: VisitInfo.cc:485
daf::base::DateTime getDate() const
get uniform date and time at middle of exposure
Definition: VisitInfo.h:139
VisitInfo(VisitInfo const &)=default
coord::Weather getWeather() const
get basic weather information
Definition: VisitInfo.h:174
lsst::geom::Angle getLocalEra() const
Definition: VisitInfo.cc:518
~VisitInfo() override=default
double getUt1() const
get UT1 (universal time) MJD date at middle of exposure
Definition: VisitInfo.h:142
double getBoresightAirmass() const
get airmass at the boresight, relative to zenith at sea level (and at the middle of the exposure,...
Definition: VisitInfo.h:157
VisitInfo & operator=(VisitInfo const &)=default
lsst::geom::Angle getBoresightHourAngle() const
Definition: VisitInfo.cc:520
lsst::geom::Angle getBoresightRotAngle() const
Get rotation angle at boresight at middle of exposure.
Definition: VisitInfo.h:165
table::RecordId getExposureId() const
get exposure ID
Definition: VisitInfo.h:130
std::size_t hash_value() const noexcept override
Return a hash of this object.
Definition: VisitInfo.cc:478
bool operator==(VisitInfo const &other) const
Definition: VisitInfo.cc:468
bool operator!=(VisitInfo const &other) const
Definition: VisitInfo.h:124
lsst::geom::Angle getEra() const
get earth rotation angle at middle of exposure
Definition: VisitInfo.h:145
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: VisitInfo.h:176
table::RecordId getId() const
Definition: VisitInfo.h:186
std::string toString() const override
Create a string representation of this object.
Definition: VisitInfo.cc:544
double getExposureTime() const
get exposure duration (shutter open time); (sec)
Definition: VisitInfo.h:133
RotType getRotType() const
get rotation type of boresightRotAngle
Definition: VisitInfo.h:168
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, std::string const &instrumentLabel, table::RecordId const &id)
Construct a VisitInfo.
Definition: VisitInfo.h:91
bool equals(typehandling::Storable const &other) const noexcept override
Compare this object to another Storable.
Definition: VisitInfo.cc:540
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:153
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:149
VisitInfo & operator=(VisitInfo &&)=default
std::shared_ptr< typehandling::Storable > cloneStorable() const override
Create a new VisitInfo that is a copy of this one.
Definition: VisitInfo.cc:536
VisitInfo(VisitInfo &&)=default
std::string getInstrumentLabel() const
Definition: VisitInfo.h:184
double getDarkTime() const
get time from CCD flush to exposure readout, including shutter open time (despite the name); (sec)
Definition: VisitInfo.h:136
coord::Observatory getObservatory() const
get observatory longitude, latitude and elevation
Definition: VisitInfo.h:171
lsst::geom::Angle getBoresightParAngle() const
Get parallactic angle at the boresight.
Definition: VisitInfo.cc:522
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
Definition: VisitInfo.cc:487
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:176
io::OutputArchiveHandle OutputArchiveHandle
Definition: Persistable.h:108
Interface supporting iteration over heterogenous containers.
Definition: Storable.h:58
Class for handling dates/times, including MJD, UTC, and TAI.
Definition: DateTime.h:64
Class for storing ordered metadata with comments.
Definition: PropertyList.h:68
Class for storing generic metadata.
Definition: PropertySet.h:66
A class representing an angle.
Definition: Angle.h:127
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:57
int stripVisitInfoKeywords(daf::base::PropertySet &metadata)
Remove VisitInfo-related keywords from the metadata.
Definition: VisitInfo.cc:339
void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo)
Set FITS metadata from a VisitInfo.
Definition: VisitInfo.cc:356
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
std::ostream & operator<<(std::ostream &os, Measurement const &measurement)
Definition: PhotoCalib.cc:47
RotType
Type of rotation.
Definition: VisitInfo.h:45
@ HORIZON
Position angle of focal plane +Y, measured from +Alt through +Az.
@ MOUNT
The position sent to the instrument rotator; the details depend on the rotator.
@ UNKNOWN
Rotation angle is unknown.
@ SKY
Position angle of focal plane +Y, measured from N through E.
std::int64_t RecordId
Type used for unique IDs for records.
Definition: misc.h:21
A base class for image defects.
STL namespace.
size_t operator()(argument_type const &obj) const noexcept
Definition: VisitInfo.h:266
Key< int > visitInfo
Definition: Exposure.cc:70