LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
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:
91  daf::base::DateTime const &date, double ut1, lsst::geom::Angle const &era,
93  lsst::geom::SpherePoint const &boresightAzAlt, double boresightAirmass,
95  coord::Observatory const &observatory, coord::Weather const &weather,
97  : _exposureId(exposureId),
98  _exposureTime(exposureTime),
99  _darkTime(darkTime),
100  _date(date),
101  _ut1(ut1),
102  _era(era),
103  _boresightRaDec(boresightRaDec),
104  _boresightAzAlt(boresightAzAlt),
105  _boresightAirmass(boresightAirmass),
106  _boresightRotAngle(boresightRotAngle),
107  _rotType(rotType),
108  _observatory(observatory),
109  _weather(weather),
110  _instrumentLabel(instrumentLabel){};
111 
112  explicit VisitInfo(daf::base::PropertySet const &metadata);
113 
114  ~VisitInfo() override = default;
115 
116  VisitInfo(VisitInfo const &) = default;
117  VisitInfo(VisitInfo &&) = default;
118  VisitInfo &operator=(VisitInfo const &) = default;
119  VisitInfo &operator=(VisitInfo &&) = default;
120 
121  bool operator==(VisitInfo const &other) const;
122  bool operator!=(VisitInfo const &other) const { return !(*this == other); };
123 
125  std::size_t hash_value() const noexcept override;
126 
128  table::RecordId getExposureId() const { return _exposureId; }
129 
131  double getExposureTime() const { return _exposureTime; }
132 
134  double getDarkTime() const { return _darkTime; }
135 
137  daf::base::DateTime getDate() const { return _date; }
138 
140  double getUt1() const { return _ut1; }
141 
143  lsst::geom::Angle getEra() const { return _era; }
144 
147  lsst::geom::SpherePoint getBoresightRaDec() const { return _boresightRaDec; }
148 
151  lsst::geom::SpherePoint getBoresightAzAlt() const { return _boresightAzAlt; }
152 
155  double getBoresightAirmass() const { return _boresightAirmass; }
156 
163  lsst::geom::Angle getBoresightRotAngle() const { return _boresightRotAngle; }
164 
166  RotType getRotType() const { return _rotType; }
167 
169  coord::Observatory getObservatory() const { return _observatory; }
170 
172  coord::Weather getWeather() const { return _weather; }
173 
174  bool isPersistable() const noexcept override { return true; }
175 
176  // get the local sidereal time on the meridian (equivalent, but not equal, to Local Mean Sidereal Time)
178 
179  // get hour angle at the boresight
181 
182  std::string getInstrumentLabel() const { return _instrumentLabel; }
183 
194 
197 
199  std::string toString() const override;
200 
206  bool equals(typehandling::Storable const &other) const noexcept override;
207 
208 protected:
209  std::string getPersistenceName() const override;
210 
211  void write(OutputArchiveHandle &handle) const override;
212 
213 private:
214  table::RecordId _exposureId;
215  double _exposureTime;
216  double _darkTime;
217  daf::base::DateTime _date;
218  double _ut1;
219  lsst::geom::Angle _era;
220  lsst::geom::SpherePoint _boresightRaDec;
221  lsst::geom::SpherePoint _boresightAzAlt;
222  double _boresightAirmass;
223  lsst::geom::Angle _boresightRotAngle;
224  RotType _rotType;
225  coord::Observatory _observatory;
226  coord::Weather _weather;
227  std::string _instrumentLabel;
228 };
229 
230 std::ostream &operator<<(std::ostream &os, VisitInfo const &visitInfo);
231 
232 namespace detail {
233 
240 void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo);
241 
250 
251 } // namespace detail
252 } // namespace image
253 } // namespace afw
254 } // namespace lsst
255 
256 namespace std {
257 template <>
258 struct hash<lsst::afw::image::VisitInfo> {
261  size_t operator()(argument_type const &obj) const noexcept { return obj.hash_value(); }
262 };
263 } // namespace std
264 
265 #endif // !LSST_AFW_IMAGE_VISITINFO_H_INCLUDED
ItemVariant const * other
Definition: Schema.cc:56
std::ostream * os
Definition: Schema.cc:746
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:471
daf::base::DateTime getDate() const
get uniform date and time at middle of exposure
Definition: VisitInfo.h:137
VisitInfo(VisitInfo const &)=default
coord::Weather getWeather() const
get basic weather information
Definition: VisitInfo.h:172
lsst::geom::Angle getLocalEra() const
Definition: VisitInfo.cc:503
~VisitInfo() override=default
double getUt1() const
get UT1 (universal time) MJD date at middle of exposure
Definition: VisitInfo.h:140
double getBoresightAirmass() const
get airmass at the boresight, relative to zenith at sea level (and at the middle of the exposure,...
Definition: VisitInfo.h:155
VisitInfo & operator=(VisitInfo const &)=default
lsst::geom::Angle getBoresightHourAngle() const
Definition: VisitInfo.cc:505
lsst::geom::Angle getBoresightRotAngle() const
Get rotation angle at boresight at middle of exposure.
Definition: VisitInfo.h:163
table::RecordId getExposureId() const
get exposure ID
Definition: VisitInfo.h:128
std::size_t hash_value() const noexcept override
Return a hash of this object.
Definition: VisitInfo.cc:464
bool operator==(VisitInfo const &other) const
Definition: VisitInfo.cc:454
bool operator!=(VisitInfo const &other) const
Definition: VisitInfo.h:122
lsst::geom::Angle getEra() const
get earth rotation angle at middle of exposure
Definition: VisitInfo.h:143
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: VisitInfo.h:174
std::string toString() const override
Create a string representation of this object.
Definition: VisitInfo.cc:529
double getExposureTime() const
get exposure duration (shutter open time); (sec)
Definition: VisitInfo.h:131
RotType getRotType() const
get rotation type of boresightRotAngle
Definition: VisitInfo.h:166
bool equals(typehandling::Storable const &other) const noexcept override
Compare this object to another Storable.
Definition: VisitInfo.cc:525
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:151
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:147
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:521
VisitInfo(VisitInfo &&)=default
std::string getInstrumentLabel() const
Definition: VisitInfo.h:182
double getDarkTime() const
get time from CCD flush to exposure readout, including shutter open time (despite the name); (sec)
Definition: VisitInfo.h:134
coord::Observatory getObservatory() const
get observatory longitude, latitude and elevation
Definition: VisitInfo.h:169
lsst::geom::Angle getBoresightParAngle() const
Get parallactic angle at the boresight.
Definition: VisitInfo.cc:507
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)
Construct a VisitInfo.
Definition: VisitInfo.h:90
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
Definition: VisitInfo.cc:473
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:67
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:333
void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo)
Set FITS metadata from a VisitInfo.
Definition: VisitInfo.cc:350
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
std::ostream & operator<<(std::ostream &os, Measurement const &measurement)
Definition: PhotoCalib.cc:48
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:22
A base class for image defects.
STL namespace.
size_t operator()(argument_type const &obj) const noexcept
Definition: VisitInfo.h:261
Key< int > visitInfo
Definition: Exposure.cc:70