lsst.afw g67799ae11d+f394777a51
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"
34#include "lsst/geom/Point.h"
36#include "lsst/afw/table/misc.h" // for RecordId
39
40namespace lsst {
41namespace afw {
42namespace image {
43
45enum class RotType {
46 UNKNOWN,
48 SKY,
51 HORIZON,
54 MOUNT
55};
56
69public:
93 // TODO: remove exposureId on DM-32138
95 daf::base::DateTime const &date, double ut1, lsst::geom::Angle const &era,
97 lsst::geom::SpherePoint const &boresightAzAlt, double boresightAirmass,
99 coord::Observatory const &observatory, coord::Weather const &weather,
101 double focusZ)
102 : _exposureId(exposureId),
103 _exposureTime(exposureTime),
104 _darkTime(darkTime),
105 _date(date),
106 _ut1(ut1),
107 _era(era),
108 _boresightRaDec(boresightRaDec),
109 _boresightAzAlt(boresightAzAlt),
110 _boresightAirmass(boresightAirmass),
111 _boresightRotAngle(boresightRotAngle),
112 _rotType(rotType),
113 _observatory(observatory),
114 _weather(weather),
115 _instrumentLabel(instrumentLabel),
116 _id(id),
117 _focusZ(focusZ){};
118
119 explicit VisitInfo(daf::base::PropertySet const &metadata);
120
121 ~VisitInfo() override = default;
122
123 VisitInfo(VisitInfo const &) = default;
124 VisitInfo(VisitInfo &&) = default;
125 VisitInfo &operator=(VisitInfo const &) = default;
127
128 bool operator==(VisitInfo const &other) const;
129 bool operator!=(VisitInfo const &other) const { return !(*this == other); };
130
132 std::size_t hash_value() const noexcept override;
133
135 // TODO: remove on DM-32138
136 [[deprecated(
137 "Replaced by VisitInfo::getId() for full focal plane identifiers and by "
138 "ExposureInfo::getId() for detector-level identifiers. Will be removed after v25.")]] table::
141 return _exposureId;
142 }
143
145 double getExposureTime() const { return _exposureTime; }
146
148 double getDarkTime() const { return _darkTime; }
149
151 daf::base::DateTime getDate() const { return _date; }
152
154 double getUt1() const { return _ut1; }
155
157 lsst::geom::Angle getEra() const { return _era; }
158
161 lsst::geom::SpherePoint getBoresightRaDec() const { return _boresightRaDec; }
162
165 lsst::geom::SpherePoint getBoresightAzAlt() const { return _boresightAzAlt; }
166
169 double getBoresightAirmass() const { return _boresightAirmass; }
170
177 lsst::geom::Angle getBoresightRotAngle() const { return _boresightRotAngle; }
178
180 RotType getRotType() const { return _rotType; }
181
183 coord::Observatory getObservatory() const { return _observatory; }
184
186 coord::Weather getWeather() const { return _weather; }
187
188 bool isPersistable() const noexcept override { return true; }
189
190 // get the local sidereal time on the meridian (equivalent, but not equal, to Local Mean Sidereal Time)
192
193 // get hour angle at the boresight
195
196 std::string getInstrumentLabel() const { return _instrumentLabel; }
197
198 table::RecordId getId() const { return _id; }
199
200 // get defocal distance (mm)
201 double getFocusZ() const { return _focusZ; }
202
213
216
218 std::string toString() const override;
219
225 bool equals(typehandling::Storable const &other) const noexcept override;
226
227protected:
228 std::string getPersistenceName() const override;
229
230 void write(OutputArchiveHandle &handle) const override;
231
232private:
233 table::RecordId _exposureId; // TODO: remove on DM-32138
234 double _exposureTime;
235 double _darkTime;
237 double _ut1;
239 lsst::geom::SpherePoint _boresightRaDec;
240 lsst::geom::SpherePoint _boresightAzAlt;
241 double _boresightAirmass;
242 lsst::geom::Angle _boresightRotAngle;
243 RotType _rotType;
244 coord::Observatory _observatory;
245 coord::Weather _weather;
246 std::string _instrumentLabel;
247 table::RecordId _id;
248 double _focusZ;
249};
250
251std::ostream &operator<<(std::ostream &os, VisitInfo const &visitInfo);
252
253namespace detail {
254
261void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo);
262
271
272} // namespace detail
273} // namespace image
274} // namespace afw
275} // namespace lsst
276
277namespace std {
278template <>
279struct hash<lsst::afw::image::VisitInfo> {
282 size_t operator()(argument_type const &obj) const noexcept { return obj.hash_value(); }
283};
284} // namespace std
285
286#endif // !LSST_AFW_IMAGE_VISITINFO_H_INCLUDED
table::Key< int > id
Definition: Detector.cc:162
table::Key< int > detector
std::ostream * os
Definition: Schema.cc:557
table::Key< double > exposureTime
Definition: VisitInfo.cc:201
table::Key< lsst::geom::Angle > era
Definition: VisitInfo.cc:205
table::Key< int > rotType
Definition: VisitInfo.cc:211
table::Key< double > darkTime
Definition: VisitInfo.cc:202
table::Key< std::string > instrumentLabel
Definition: VisitInfo.cc:221
table::CoordKey boresightRaDec
Definition: VisitInfo.cc:206
table::Key< double > boresightAirmass
Definition: VisitInfo.cc:209
table::Key< double > focusZ
Definition: VisitInfo.cc:226
table::Key< lsst::geom::Angle > boresightRotAngle
Definition: VisitInfo.cc:210
table::Key< double > ut1
Definition: VisitInfo.cc:204
table::Key< table::RecordId > exposureId
Definition: VisitInfo.cc:200
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
A collection of all the things that make an Exposure different from a MaskedImage.
Definition: ExposureInfo.h:88
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:522
daf::base::DateTime getDate() const
get uniform date and time at middle of exposure
Definition: VisitInfo.h:151
VisitInfo(VisitInfo const &)=default
coord::Weather getWeather() const
get basic weather information
Definition: VisitInfo.h:186
lsst::geom::Angle getLocalEra() const
Definition: VisitInfo.cc:556
~VisitInfo() override=default
double getUt1() const
get UT1 (universal time) MJD date at middle of exposure
Definition: VisitInfo.h:154
double getBoresightAirmass() const
get airmass at the boresight, relative to zenith at sea level (and at the middle of the exposure,...
Definition: VisitInfo.h:169
lsst::geom::Angle getBoresightHourAngle() const
Definition: VisitInfo.cc:558
lsst::geom::Angle getBoresightRotAngle() const
Get rotation angle at boresight at middle of exposure.
Definition: VisitInfo.h:177
table::RecordId getExposureId() const
get exposure ID
Definition: VisitInfo.h:140
VisitInfo & operator=(VisitInfo const &)=default
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, double focusZ)
Construct a VisitInfo.
Definition: VisitInfo.h:94
std::size_t hash_value() const noexcept override
Return a hash of this object.
Definition: VisitInfo.cc:515
bool operator==(VisitInfo const &other) const
Definition: VisitInfo.cc:502
bool operator!=(VisitInfo const &other) const
Definition: VisitInfo.h:129
lsst::geom::Angle getEra() const
get earth rotation angle at middle of exposure
Definition: VisitInfo.h:157
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: VisitInfo.h:188
table::RecordId getId() const
Definition: VisitInfo.h:198
double getFocusZ() const
Definition: VisitInfo.h:201
VisitInfo & operator=(VisitInfo &&)=default
std::string toString() const override
Create a string representation of this object.
Definition: VisitInfo.cc:582
double getExposureTime() const
get exposure duration (shutter open time); (sec)
Definition: VisitInfo.h:145
RotType getRotType() const
get rotation type of boresightRotAngle
Definition: VisitInfo.h:180
bool equals(typehandling::Storable const &other) const noexcept override
Compare this object to another Storable.
Definition: VisitInfo.cc:578
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:165
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:161
std::shared_ptr< typehandling::Storable > cloneStorable() const override
Create a new VisitInfo that is a copy of this one.
Definition: VisitInfo.cc:574
VisitInfo(VisitInfo &&)=default
std::string getInstrumentLabel() const
Definition: VisitInfo.h:196
double getDarkTime() const
get time from CCD flush to exposure readout, including shutter open time (despite the name); (sec)
Definition: VisitInfo.h:148
coord::Observatory getObservatory() const
get observatory longitude, latitude and elevation
Definition: VisitInfo.h:183
lsst::geom::Angle getBoresightParAngle() const
Get parallactic angle at the boresight.
Definition: VisitInfo.cc:560
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
Definition: VisitInfo.cc:524
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
int stripVisitInfoKeywords(daf::base::PropertySet &metadata)
Remove VisitInfo-related keywords from the metadata.
Definition: VisitInfo.cc:353
void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo)
Set FITS metadata from a VisitInfo.
Definition: VisitInfo.cc:370
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
STL namespace.
size_t operator()(argument_type const &obj) const noexcept
Definition: VisitInfo.h:282
Key< int > visitInfo
Definition: Exposure.cc:70