LSSTApplications  19.0.0-14-gb0260a2+6db932c395,20.0.0+235c3eae2c,20.0.0+448775ce90,20.0.0+5f56aa8f28,20.0.0+b40eaeb6a0,20.0.0+d006f05c5d,20.0.0+dbd2281351,20.0.0+dc1acf7baf,20.0.0+e2e26847c2,20.0.0+f48bb53858,20.0.0-1-g10df615+4b67200b40,20.0.0-1-g253301a+d006f05c5d,20.0.0-1-g2b7511a+f48bb53858,20.0.0-1-g4d801e7+68c50072dc,20.0.0-1-g5b95a8c+d1beabf16b,20.0.0-1-g660595b+f45b7d88f4,20.0.0-1-gc96f8cb+4df7bab894,20.0.0-1-gd1c87d7+add1f556b4,20.0.0-1-gedffbd8+eb23c4e4f2,20.0.0-11-g13aeee2+1a7c0f1887,20.0.0-14-g199c894+e853f797a7,20.0.0-15-gf5872d0+4df7bab894,20.0.0-16-g6fe20a1+b7072f60df,20.0.0-2-g4dae9ad+4df7bab894,20.0.0-2-g5ad0983+1a7c0f1887,20.0.0-2-g7818986+add1f556b4,20.0.0-2-gb095acb+63636aeed8,20.0.0-2-gdaeb0e8+7d7ca508c5,20.0.0-2-gec03fae+de92faa26f,20.0.0-23-g8d4de91b+950b69a445,20.0.0-4-gfea843c+f45b7d88f4,20.0.0-46-g00fa051+1467b54e00,20.0.0-5-g357b56b+f45b7d88f4,20.0.0-5-gfcebe35+a6a1a2f802,20.0.0-7-gc818c6e6+57cf537add,20.0.0-7-gcda7bf1+738fa57269,20.0.0-9-g61a2a9a3d+7fa50e000d,w.2020.38
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,
94  coord::Observatory const &observatory, coord::Weather const &weather)
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)
175 
176  // get hour angle at the boresight
178 
189 
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 
224 std::ostream &operator<<(std::ostream &os, VisitInfo const &visitInfo);
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
lsst::afw::image::RotType
RotType
Type of rotation.
Definition: VisitInfo.h:45
base.h
lsst::afw::image
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
Definition: imageAlgorithm.dox:1
lsst::afw::image::VisitInfo::getDate
daf::base::DateTime getDate() const
get uniform date and time at middle of exposure
Definition: VisitInfo.h:134
std::string
STL class.
std::shared_ptr
STL class.
lsst::afw::table::RecordId
std::int64_t RecordId
Type used for unique IDs for records.
Definition: misc.h:22
lsst::afw::image::VisitInfo::getUt1
double getUt1() const
get UT1 (universal time) MJD date at middle of exposure
Definition: VisitInfo.h:137
base.h
lsst::afw::image::VisitInfo::getExposureId
table::RecordId getExposureId() const
get exposure ID
Definition: VisitInfo.h:125
boresightAirmass
table::Key< double > boresightAirmass
Definition: VisitInfo.cc:167
era
table::Key< lsst::geom::Angle > era
Definition: VisitInfo.cc:163
lsst::afw::image::VisitInfo::equals
bool equals(typehandling::Storable const &other) const noexcept override
Compare this object to another Storable.
Definition: VisitInfo.cc:450
lsst::afw::image::VisitInfo::getRotType
RotType getRotType() const
get rotation type of boresightRotAngle
Definition: VisitInfo.h:163
lsst::afw::image::detail::setVisitInfoMetadata
void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo)
Set FITS metadata from a VisitInfo.
Definition: VisitInfo.cc:281
lsst::afw::image::VisitInfo::getBoresightParAngle
lsst::geom::Angle getBoresightParAngle() const
Get parallactic angle at the boresight.
Definition: VisitInfo.cc:432
Observatory.h
lsst::afw::image::VisitInfo::getEra
lsst::geom::Angle getEra() const
get earth rotation angle at middle of exposure
Definition: VisitInfo.h:140
lsst::afw
Definition: imageAlgorithm.dox:1
lsst::afw::image::RotType::UNKNOWN
@ UNKNOWN
Rotation angle is unknown.
lsst::afw::image::VisitInfo::getExposureTime
double getExposureTime() const
get exposure duration (shutter open time); (sec)
Definition: VisitInfo.h:128
lsst::daf::base::PropertyList
Class for storing ordered metadata with comments.
Definition: PropertyList.h:68
lsst::afw::image::VisitInfo::VisitInfo
VisitInfo(VisitInfo &&)=default
Point.h
lsst::afw::image::operator<<
std::ostream & operator<<(std::ostream &os, Measurement const &measurement)
Definition: PhotoCalib.cc:48
lsst::afw::image::VisitInfo::getBoresightRaDec
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
lsst::afw::image::VisitInfo::hash_value
std::size_t hash_value() const noexcept override
Return a hash of this object.
Definition: VisitInfo.cc:391
lsst::afw::typehandling::Storable
Interface supporting iteration over heterogenous containers.
Definition: Storable.h:58
lsst::daf::base::DateTime
Class for handling dates/times, including MJD, UTC, and TAI.
Definition: DateTime.h:64
rotType
table::Key< int > rotType
Definition: VisitInfo.cc:169
ut1
table::Key< double > ut1
Definition: VisitInfo.cc:162
lsst::afw::image::VisitInfo::getWeather
coord::Weather getWeather() const
get basic weather information
Definition: VisitInfo.h:169
lsst::afw::coord::Weather
Basic weather information sufficient for a simple model for air mass or refraction.
Definition: Weather.h:38
lsst::afw::image::VisitInfo::VisitInfo
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
lsst::afw::image::VisitInfo
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:68
misc.h
std::ostream
STL class.
lsst::afw::image::VisitInfo::getBoresightAzAlt
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
lsst::afw::image::RotType::SKY
@ SKY
Position angle of focal plane +Y, measured from N through E.
other
ItemVariant const * other
Definition: Schema.cc:56
lsst::afw::image::VisitInfo::getBoresightRotAngle
lsst::geom::Angle getBoresightRotAngle() const
Get rotation angle at boresight at middle of exposure.
Definition: VisitInfo.h:160
exposureId
table::Key< table::RecordId > exposureId
Definition: VisitInfo.cc:158
lsst::afw::image::RotType::HORIZON
@ HORIZON
Position angle of focal plane +Y, measured from +Alt through +Az.
boresightRotAngle
table::Key< lsst::geom::Angle > boresightRotAngle
Definition: VisitInfo.cc:168
lsst::afw::image::VisitInfo::operator=
VisitInfo & operator=(VisitInfo &&)=default
lsst::afw::image::VisitInfo::getBoresightHourAngle
lsst::geom::Angle getBoresightHourAngle() const
Definition: VisitInfo.cc:430
Weather.h
Storable.h
std::int64_t
exposureTime
table::Key< double > exposureTime
Definition: VisitInfo.cc:159
lsst::afw::coord::Observatory
Hold the location of an observatory.
Definition: Observatory.h:43
boresightRaDec
table::CoordKey boresightRaDec
Definition: VisitInfo.cc:164
darkTime
table::Key< double > darkTime
Definition: VisitInfo.cc:160
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
lsst::afw::image::VisitInfo::getBoresightAirmass
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
lsst::afw::image::VisitInfo::operator==
bool operator==(VisitInfo const &other) const
Definition: VisitInfo.cc:382
lsst::afw::image::VisitInfo::write
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
Definition: VisitInfo.cc:400
os
std::ostream * os
Definition: Schema.cc:746
lsst::afw::image::VisitInfo::isPersistable
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: VisitInfo.h:171
lsst::afw::image::VisitInfo::toString
std::string toString() const override
Create a string representation of this object.
Definition: VisitInfo.cc:454
lsst::afw::image::RotType::MOUNT
@ MOUNT
The position sent to the instrument rotator; the details depend on the rotator.
std
STL namespace.
lsst::afw::image::VisitInfo::operator!=
bool operator!=(VisitInfo const &other) const
Definition: VisitInfo.h:119
lsst::afw::table::io::PersistableFacade
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:176
lsst::afw::image::VisitInfo::getLocalEra
lsst::geom::Angle getLocalEra() const
Definition: VisitInfo.cc:428
lsst::geom::Angle
A class representing an angle.
Definition: Angle.h:127
lsst::daf::base::PropertySet
Class for storing generic metadata.
Definition: PropertySet.h:67
lsst::afw::image::VisitInfo::getDarkTime
double getDarkTime() const
get time from CCD flush to exposure readout, including shutter open time (despite the name); (sec)
Definition: VisitInfo.h:131
lsst::afw::image::VisitInfo::~VisitInfo
~VisitInfo() override=default
std::size_t
SpherePoint.h
lsst::geom::SpherePoint
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:57
lsst::afw::image::VisitInfo::VisitInfo
VisitInfo(VisitInfo const &)=default
lsst::afw::image::detail::stripVisitInfoKeywords
int stripVisitInfoKeywords(daf::base::PropertySet &metadata)
Remove VisitInfo-related keywords from the metadata.
Definition: VisitInfo.cc:265
lsst::afw::table::io::Persistable::OutputArchiveHandle
io::OutputArchiveHandle OutputArchiveHandle
Definition: Persistable.h:108
lsst::afw::image::VisitInfo::getObservatory
coord::Observatory getObservatory() const
get observatory longitude, latitude and elevation
Definition: VisitInfo.h:166
Persistable.h
visitInfo
Key< int > visitInfo
Definition: Exposure.cc:70
lsst::afw::image::VisitInfo::cloneStorable
std::shared_ptr< typehandling::Storable > cloneStorable() const override
Create a new VisitInfo that is a copy of this one.
Definition: VisitInfo.cc:446
lsst::afw::image::VisitInfo::operator=
VisitInfo & operator=(VisitInfo const &)=default
lsst::afw::image::VisitInfo::getPersistenceName
std::string getPersistenceName() const override
Return the unique name used to persist this object and look up its factory.
Definition: VisitInfo.cc:398
std::hash< lsst::afw::image::VisitInfo >::operator()
size_t operator()(argument_type const &obj) const noexcept
Definition: VisitInfo.h:255
std::hash