lsst.afw 23.0.0+60ce4897b0
VisitInfo.cc
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#include <cmath>
24#include <limits>
25#include <sstream>
26
27#include "boost/algorithm/string/trim.hpp"
28
29#include "lsst/utils/hashCombine.h"
30#include "lsst/pex/exceptions.h"
31#include "lsst/geom/Angle.h"
33#include "lsst/afw/table/Key.h"
34#include "lsst/afw/table/aggregates.h" // for CoordKey
36#include "lsst/afw/table/misc.h" // for RecordId
39#include "lsst/afw/table/io/CatalogVector.h" // needed, but why?
42
44
45namespace lsst {
46namespace afw {
47
50
51namespace image {
52
53// the following persistence-related code emulates that in Calib.cc
54
55namespace {
56
57// Version history:
58// unversioned: original VisitInfo schema
59// 1: file versioning, instrument label
60// 2: id field
61int constexpr SERIALIZATION_VERSION = 2;
62
64
73double getDouble(daf::base::PropertySet const& metadata, std::string const& key) {
74 return metadata.exists(key) ? metadata.getAsDouble(key) : nan;
75}
76
85lsst::geom::Angle getAngle(daf::base::PropertySet const& metadata, std::string const& key) {
86 return getDouble(metadata, key) * lsst::geom::degrees;
87}
88
97std::string getString(daf::base::PropertySet const& metadata, std::string const& key) {
98 return metadata.exists(key) ? metadata.getAsString(key) : "";
99}
100
109bool setDouble(daf::base::PropertySet& metadata, std::string const& key, double value,
110 std::string const& comment) {
111 if (std::isfinite(value)) {
112 metadata.set(key, value);
113 return true;
114 }
115 return false;
116}
117
126bool setAngle(daf::base::PropertySet& metadata, std::string const& key, lsst::geom::Angle const& angle,
127 std::string const& comment) {
128 return setDouble(metadata, key, angle.asDegrees(), comment);
129}
130
139bool setString(daf::base::PropertySet& metadata, std::string const& key, std::string value,
140 std::string const& comment) {
141 if (!value.empty()) {
142 metadata.set(key, value);
143 return true;
144 }
145 return false;
146}
147
153std::string rotTypeStrFromEnum(RotType rotType) {
154 switch (rotType) {
155 case RotType::UNKNOWN:
156 return "UNKNOWN";
157 case RotType::SKY:
158 return "SKY";
159 case RotType::HORIZON:
160 return "HORIZON";
161 case RotType::MOUNT:
162 return "MOUNT";
163 }
165 os << "Unknown RotType enum: " << static_cast<int>(rotType);
167}
168
174RotType rotTypeEnumFromStr(std::string const& rotTypeName) {
175 if (rotTypeName == "UNKNOWN") {
176 return RotType::UNKNOWN;
177 } else if (rotTypeName == "SKY") {
178 return RotType::SKY;
179 } else if (rotTypeName == "HORIZON") {
180 return RotType::HORIZON;
181 } else if (rotTypeName == "MOUNT") {
182 return RotType::MOUNT;
183 }
185 os << "Unknown RotType name: \"" << rotTypeName << "\"";
187}
188
189class VisitInfoSchema {
190public:
191 table::Schema schema;
192 table::Key<table::RecordId> exposureId;
193 table::Key<double> exposureTime;
194 table::Key<double> darkTime;
195 table::Key<std::int64_t> tai;
196 table::Key<double> ut1;
197 table::Key<lsst::geom::Angle> era;
198 table::CoordKey boresightRaDec;
199 table::Key<lsst::geom::Angle> boresightAzAlt_az;
200 table::Key<lsst::geom::Angle> boresightAzAlt_alt;
201 table::Key<double> boresightAirmass;
202 table::Key<lsst::geom::Angle> boresightRotAngle;
203 table::Key<int> rotType;
204 // observatory data
205 table::Key<lsst::geom::Angle> latitude;
206 table::Key<lsst::geom::Angle> longitude;
207 table::Key<double> elevation;
208 // weather data
209 table::Key<double> airTemperature;
210 table::Key<double> airPressure;
211 table::Key<double> humidity;
212
213 table::Key<std::string> instrumentLabel;
214 table::Key<int> version;
215
216 table::Key<table::RecordId> idnum;
217
218 static std::string const VERSION_KEY;
219
220 static VisitInfoSchema const& get() {
221 static VisitInfoSchema instance;
222 return instance;
223 }
224
225 // No copying
226 VisitInfoSchema(const VisitInfoSchema&) = delete;
227 VisitInfoSchema& operator=(const VisitInfoSchema&) = delete;
228
229 // No moving
230 VisitInfoSchema(VisitInfoSchema&&) = delete;
231 VisitInfoSchema& operator=(VisitInfoSchema&&) = delete;
232
233private:
234 VisitInfoSchema()
235 : schema(),
236 exposureId(schema.addField<table::RecordId>("exposureid", "exposure ID", "")),
237 exposureTime(schema.addField<double>("exposuretime", "exposure duration", "s")),
238 darkTime(schema.addField<double>("darktime", "time from CCD flush to readout", "s")),
239 tai(schema.addField<std::int64_t>(
240 "tai", "TAI date and time at middle of exposure as nsec from unix epoch", "nsec")),
241 ut1(schema.addField<double>("ut1", "UT1 date and time at middle of exposure", "MJD")),
242 era(schema.addField<lsst::geom::Angle>("era", "earth rotation angle at middle of exposure",
243 "")),
244 boresightRaDec(table::CoordKey::addFields(schema, "boresightradec",
245 "sky position of boresight at middle of exposure")),
246 // CoordKey is intended for ICRS coordinates, so use a pair of lsst::geom::Angle fields
247 // to save boresightAzAlt
248 boresightAzAlt_az(schema.addField<lsst::geom::Angle>(
249 "boresightazalt_az",
250 "refracted apparent topocentric position of boresight at middle of exposure", "")),
251 boresightAzAlt_alt(schema.addField<lsst::geom::Angle>(
252 "boresightazalt_alt",
253 "refracted apparent topocentric position of boresight at middle of exposure", "")),
254 boresightAirmass(schema.addField<double>(
255 "boresightairmass", "airmass at boresight, relative to zenith at sea level", "")),
256 boresightRotAngle(schema.addField<lsst::geom::Angle>(
257 "boresightrotangle", "rotation angle at boresight at middle of exposure", "")),
258 rotType(schema.addField<int>("rottype", "rotation type; see VisitInfo.getRotType for details",
259 "MJD")),
260 // observatory data
261 latitude(schema.addField<lsst::geom::Angle>(
262 "latitude", "latitude of telescope (+ is east of Greenwich)", "")),
263 longitude(schema.addField<lsst::geom::Angle>("longitude", "longitude of telescope", "")),
264 elevation(schema.addField<double>("elevation", "elevation of telescope", "")),
265
266 // weather data
267 airTemperature(schema.addField<double>("airtemperature", "air temperature", "C")),
268 airPressure(schema.addField<double>("airpressure", "air pressure", "Pascal")),
269 humidity(schema.addField<double>("humidity", "humidity (%)", "")),
270
271 instrumentLabel(schema.addField<std::string>(
272 "instrumentlabel", "Short name of the instrument that took this data", "", 0)),
273
274 // for internal support
275 version(schema.addField<int>(VERSION_KEY, "version of this VisitInfo")),
276
277 idnum(schema.addField<table::RecordId>("idnum", "identifier of this full focal plane exposure",
278 "")) {}
279};
280std::string const VisitInfoSchema::VERSION_KEY = "version";
281
282class VisitInfoFactory : public table::io::PersistableFactory {
283public:
284 std::shared_ptr<table::io::Persistable> read(InputArchive const& archive,
285 CatalogVector const& catalogs) const override {
286 VisitInfoSchema const& keys = VisitInfoSchema::get();
287 LSST_ARCHIVE_ASSERT(catalogs.size() == 1u);
288 LSST_ARCHIVE_ASSERT(catalogs.front().size() == 1u);
289 table::BaseRecord const& record = catalogs.front().front();
290 int version = getVersion(record);
291 if (version > SERIALIZATION_VERSION) {
292 throw LSST_EXCEPT(pex::exceptions::TypeError, "Cannot read VisitInfo FITS version > " +
293 std::to_string(SERIALIZATION_VERSION));
294 }
295
296 // Version-dependent fields
297 std::string instrumentLabel = version >= 1 ? record.get(keys.instrumentLabel) : "";
298 table::RecordId id = version >= 2 ? record.get(keys.idnum) : 0;
299
301 new VisitInfo(record.get(keys.exposureId), record.get(keys.exposureTime),
302 record.get(keys.darkTime), ::DateTime(record.get(keys.tai), ::DateTime::TAI),
303 record.get(keys.ut1), record.get(keys.era), record.get(keys.boresightRaDec),
304 lsst::geom::SpherePoint(record.get(keys.boresightAzAlt_az),
305 record.get(keys.boresightAzAlt_alt)),
306 record.get(keys.boresightAirmass), record.get(keys.boresightRotAngle),
307 static_cast<RotType>(record.get(keys.rotType)),
308 coord::Observatory(record.get(keys.longitude), record.get(keys.latitude),
309 record.get(keys.elevation)),
310 coord::Weather(record.get(keys.airTemperature), record.get(keys.airPressure),
311 record.get(keys.humidity)),
312 instrumentLabel, id));
313 return result;
314 }
315
316 explicit VisitInfoFactory(std::string const& name) : table::io::PersistableFactory(name) {}
317
318private:
319 int getVersion(table::BaseRecord const& record) const {
320 try {
321 // Don't assume version is at same index as in VisitInfoSchema
322 auto versionKey = record.getSchema().find<int>(VisitInfoSchema::VERSION_KEY);
323 return record.get(versionKey.key);
324 } catch (pex::exceptions::NotFoundError const&) {
325 // un-versioned files are implicitly version 0
326 return 0;
327 }
328 }
329};
330
331std::string getVisitInfoPersistenceName() { return "VisitInfo"; }
332
333VisitInfoFactory registration(getVisitInfoPersistenceName());
334
335} // namespace
336
337namespace detail {
338
340 int nstripped = 0;
341
342 std::vector<std::string> keyList = {"EXPID", "EXPTIME", "DARKTIME", "DATE-AVG", "TIMESYS",
343 "TIME-MID", "MJD-AVG-UT1", "AVG-ERA", "BORE-RA", "BORE-DEC",
344 "BORE-AZ", "BORE-ALT", "BORE-AIRMASS", "BORE-ROTANG", "ROTTYPE",
345 "OBS-LONG", "OBS-LAT", "OBS-ELEV", "AIRTEMP", "AIRPRESS",
346 "HUMIDITY", "INSTRUMENT", "IDNUM"};
347 for (auto&& key : keyList) {
348 if (metadata.exists(key)) {
349 metadata.remove(key);
350 nstripped++;
351 }
352 }
353 return nstripped;
354}
355
357 if (visitInfo.getExposureId() != 0) {
358 metadata.set("EXPID", visitInfo.getExposureId());
359 }
360 setDouble(metadata, "EXPTIME", visitInfo.getExposureTime(), "Exposure time (sec)");
361 setDouble(metadata, "DARKTIME", visitInfo.getDarkTime(), "Time from CCD flush to readout (sec)");
362 if (visitInfo.getDate().isValid()) {
363 metadata.set("DATE-AVG", visitInfo.getDate().toString(::DateTime::TAI),
364 "TAI date at middle of observation");
365 metadata.set("TIMESYS", "TAI");
366 }
367 setDouble(metadata, "MJD-AVG-UT1", visitInfo.getUt1(), "UT1 MJD date at ctr of obs");
368 setAngle(metadata, "AVG-ERA", visitInfo.getEra(), "Earth rot ang at ctr of obs (deg)");
369 auto boresightRaDec = visitInfo.getBoresightRaDec();
370 setAngle(metadata, "BORE-RA", boresightRaDec[0], "ICRS RA (deg) at boresight");
371 setAngle(metadata, "BORE-DEC", boresightRaDec[1], "ICRS Dec (deg) at boresight");
372 auto boresightAzAlt = visitInfo.getBoresightAzAlt();
373 setAngle(metadata, "BORE-AZ", boresightAzAlt[0], "Refr app topo az (deg) at bore");
374 setAngle(metadata, "BORE-ALT", boresightAzAlt[1], "Refr app topo alt (deg) at bore");
375 setDouble(metadata, "BORE-AIRMASS", visitInfo.getBoresightAirmass(), "Airmass at boresight");
376 setAngle(metadata, "BORE-ROTANG", visitInfo.getBoresightRotAngle(), "Rotation angle (deg) at boresight");
377 metadata.set("ROTTYPE", rotTypeStrFromEnum(visitInfo.getRotType()), "Type of rotation angle");
378 auto observatory = visitInfo.getObservatory();
379 setAngle(metadata, "OBS-LONG", observatory.getLongitude(), "Telescope longitude (+E, deg)");
380 setAngle(metadata, "OBS-LAT", observatory.getLatitude(), "Telescope latitude (deg)");
381 setDouble(metadata, "OBS-ELEV", observatory.getElevation(), "Telescope elevation (m)");
382 auto weather = visitInfo.getWeather();
383 setDouble(metadata, "AIRTEMP", weather.getAirTemperature(), "Outside air temperature (C)");
384 setDouble(metadata, "AIRPRESS", weather.getAirPressure(), "Outdoor air pressure (P)");
385 setDouble(metadata, "HUMIDITY", weather.getHumidity(), "Relative humidity (%)");
386 setString(metadata, "INSTRUMENT", visitInfo.getInstrumentLabel(),
387 "Short name of the instrument that took this data");
388 if (visitInfo.getId() != 0) {
389 metadata.set("IDNUM", visitInfo.getId(), "identifier of this full focal plane exposure");
390 }
391}
392
393} // namespace detail
394
395VisitInfo::VisitInfo(daf::base::PropertySet const& metadata)
396 : _exposureId(0),
397 _exposureTime(nan), // don't use getDouble because str values are also accepted
398 _darkTime(getDouble(metadata, "DARKTIME")),
399 _date(),
400 _ut1(getDouble(metadata, "MJD-AVG-UT1")),
401 _era(getAngle(metadata, "AVG-ERA")),
402 _boresightRaDec(
403 lsst::geom::SpherePoint(getAngle(metadata, "BORE-RA"), getAngle(metadata, "BORE-DEC"))),
404 _boresightAzAlt(
405 lsst::geom::SpherePoint(getAngle(metadata, "BORE-AZ"), getAngle(metadata, "BORE-ALT"))),
406 _boresightAirmass(getDouble(metadata, "BORE-AIRMASS")),
407 _boresightRotAngle(getAngle(metadata, "BORE-ROTANG")),
408 _rotType(RotType::UNKNOWN),
409 _observatory(getAngle(metadata, "OBS-LONG"), getAngle(metadata, "OBS-LAT"),
410 getDouble(metadata, "OBS-ELEV")),
411 _weather(getDouble(metadata, "AIRTEMP"), getDouble(metadata, "AIRPRESS"),
412 getDouble(metadata, "HUMIDITY")),
413 _instrumentLabel(getString(metadata, "INSTRUMENT")),
414 _id(0) {
415 auto key = "EXPID";
416 if (metadata.exists(key)) {
417 _exposureId = metadata.getAsInt64(key);
418 }
419 key = "IDNUM";
420 if (metadata.exists(key)) {
421 _id = metadata.getAsInt64(key);
422 }
423
424 key = "EXPTIME";
425 if (metadata.exists(key)) {
426 try {
427 _exposureTime = metadata.getAsDouble(key);
428 } catch (lsst::pex::exceptions::TypeError& err) {
429 // some old exposures have EXPTIME stored as a string
430 std::string exptimeStr = metadata.getAsString(key);
431 _exposureTime = std::stod(exptimeStr);
432 }
433 }
434
435 key = "DATE-AVG";
436 if (metadata.exists(key)) {
437 if (metadata.exists("TIMESYS")) {
438 auto timesysName = boost::algorithm::trim_right_copy(metadata.getAsString("TIMESYS"));
439 if (timesysName != "TAI") {
440 // rather than try to deal with all the possible choices, which requires
441 // appending or deleting a "Z", depending on the time system, just give up.
442 // VisitInfo should be used on FITS headers that have been sanitized!
444 os << "TIMESYS = \"" << timesysName
445 << "\"; VisitInfo requires TIMESYS to exist and to equal \"TAI\"";
447 }
448 } else {
450 "TIMESYS not found; VistitInfo requires TIMESYS to exist and to equal \"TAI\"");
451 }
452 _date = ::DateTime(boost::algorithm::trim_right_copy(metadata.getAsString(key)), ::DateTime::TAI);
453 } else {
454 // DATE-AVG not found. For backwards compatibility look for TIME-MID, an outdated LSST keyword
455 // whose time system was UTC, despite a FITS comment claiming it was TAI. Ignore TIMESYS.
456 key = "TIME-MID";
457 if (metadata.exists(key)) {
458 _date = ::DateTime(boost::algorithm::trim_right_copy(metadata.getAsString(key)), ::DateTime::UTC);
459 }
460 }
461
462 key = "ROTTYPE";
463 if (metadata.exists(key)) {
464 _rotType = rotTypeEnumFromStr(metadata.getAsString(key));
465 }
466}
467
468bool VisitInfo::operator==(VisitInfo const& other) const {
469 return _exposureId == other.getExposureId() && _exposureTime == other.getExposureTime() &&
470 _darkTime == other.getDarkTime() && _date == other.getDate() && _ut1 == other.getUt1() &&
471 _era == other.getEra() && _boresightRaDec == other.getBoresightRaDec() &&
472 _boresightAzAlt == other.getBoresightAzAlt() && _boresightAirmass == other.getBoresightAirmass() &&
473 _boresightRotAngle == other.getBoresightRotAngle() && _rotType == other.getRotType() &&
474 _observatory == other.getObservatory() && _weather == other.getWeather() &&
475 _instrumentLabel == other.getInstrumentLabel() && _id == other.getId();
476}
477
479 // Completely arbitrary seed
480 return utils::hashCombine(17, _exposureId, _exposureTime, _darkTime, _date, _ut1, _era, _boresightRaDec,
481 _boresightAzAlt, _boresightAirmass, _boresightRotAngle, _rotType, _observatory,
482 _weather, _instrumentLabel, _id);
483}
484
485std::string VisitInfo::getPersistenceName() const { return getVisitInfoPersistenceName(); }
486
488 VisitInfoSchema const& keys = VisitInfoSchema::get();
489 table::BaseCatalog cat = handle.makeCatalog(keys.schema);
491 record->set(keys.exposureId, getExposureId());
492 record->set(keys.exposureTime, getExposureTime());
493 record->set(keys.darkTime, getDarkTime());
494 record->set(keys.tai, getDate().nsecs(::DateTime::TAI));
495 record->set(keys.ut1, getUt1());
496 record->set(keys.era, getEra());
497 record->set(keys.boresightRaDec, getBoresightRaDec());
498 auto boresightAzAlt = getBoresightAzAlt();
499 record->set(keys.boresightAzAlt_az, boresightAzAlt[0]);
500 record->set(keys.boresightAzAlt_alt, boresightAzAlt[1]);
501 record->set(keys.boresightAirmass, getBoresightAirmass());
502 record->set(keys.boresightRotAngle, getBoresightRotAngle());
503 record->set(keys.rotType, static_cast<int>(getRotType()));
504 auto observatory = getObservatory();
505 record->set(keys.latitude, observatory.getLatitude());
506 record->set(keys.longitude, observatory.getLongitude());
507 record->set(keys.elevation, observatory.getElevation());
508 auto weather = getWeather();
509 record->set(keys.airTemperature, weather.getAirTemperature());
510 record->set(keys.airPressure, weather.getAirPressure());
511 record->set(keys.humidity, weather.getHumidity());
512 record->set(keys.instrumentLabel, getInstrumentLabel());
513 record->set(keys.version, SERIALIZATION_VERSION);
514 record->set(keys.idnum, getId());
515 handle.saveCatalog(cat);
516}
517
519
521
527 double _parallactic_y, _parallactic_x, result;
528 _parallactic_y = sin(getBoresightHourAngle().asRadians());
529 _parallactic_x =
530 cos((getBoresightRaDec()[1]).asRadians()) * tan(getObservatory().getLatitude().asRadians()) -
531 sin((getBoresightRaDec()[1]).asRadians()) * cos(getBoresightHourAngle().asRadians());
532 result = atan2(_parallactic_y, _parallactic_x);
533 return result * lsst::geom::radians;
534}
535
537 return std::make_unique<VisitInfo>(*this);
538}
539
540bool VisitInfo::equals(typehandling::Storable const& other) const noexcept {
541 return singleClassEquals(*this, other);
542}
543
545 std::stringstream buffer;
546 buffer << "VisitInfo(";
547 buffer << "exposureId=" << getExposureId() << ", ";
548 buffer << "exposureTime=" << getExposureTime() << ", ";
549 buffer << "darkTime=" << getDarkTime() << ", ";
550 buffer << "date=" << getDate().toString(daf::base::DateTime::TAI) << ", ";
551 buffer << "UT1=" << getUt1() << ", ";
552 buffer << "ERA=" << getEra() << ", ";
553 buffer << "boresightRaDec=" << getBoresightRaDec() << ", ";
554 buffer << "boresightAzAlt=" << getBoresightAzAlt() << ", ";
555 buffer << "boresightAirmass=" << getBoresightAirmass() << ", ";
556 buffer << "boresightRotAngle=" << getBoresightRotAngle() << ", ";
557 buffer << "rotType=" << static_cast<int>(getRotType()) << ", ";
558 buffer << "observatory=" << getObservatory() << ", ";
559 buffer << "weather=" << getWeather() << ", ";
560 buffer << "instrumentLabel='" << getInstrumentLabel() << "', ";
561 buffer << "id=" << getId();
562 buffer << ")";
563 return buffer.str();
564}
565
567 os << visitInfo.toString();
568 return os;
569}
570
571} // namespace image
572} // namespace afw
573} // namespace lsst
table::Key< std::string > name
Definition: Amplifier.cc:116
#define LSST_EXCEPT(type,...)
table::Key< double > angle
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition: Persistable.h:48
std::ostream * os
Definition: Schema.cc:557
table::Key< lsst::geom::Angle > longitude
Definition: VisitInfo.cc:206
table::Key< lsst::geom::Angle > latitude
Definition: VisitInfo.cc:205
table::Key< lsst::geom::Angle > boresightAzAlt_az
Definition: VisitInfo.cc:199
table::Schema schema
Definition: VisitInfo.cc:191
table::Key< double > exposureTime
Definition: VisitInfo.cc:193
table::Key< lsst::geom::Angle > era
Definition: VisitInfo.cc:197
table::Key< double > airPressure
Definition: VisitInfo.cc:210
table::Key< lsst::geom::Angle > boresightAzAlt_alt
Definition: VisitInfo.cc:200
table::Key< int > rotType
Definition: VisitInfo.cc:203
table::Key< double > darkTime
Definition: VisitInfo.cc:194
table::Key< table::RecordId > idnum
Definition: VisitInfo.cc:216
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< double > airTemperature
Definition: VisitInfo.cc:209
table::Key< std::int64_t > tai
Definition: VisitInfo.cc:195
table::Key< double > elevation
Definition: VisitInfo.cc:207
table::Key< double > humidity
Definition: VisitInfo.cc:211
table::Key< int > version
Definition: VisitInfo.cc:214
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
lsst::geom::Angle getLongitude() const noexcept
get telescope longitude (positive values are E of Greenwich)
Definition: Observatory.cc:48
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
coord::Weather getWeather() const
get basic weather information
Definition: VisitInfo.h:174
lsst::geom::Angle getLocalEra() const
Definition: VisitInfo.cc:518
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
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
lsst::geom::Angle getEra() const
get earth rotation angle at middle of exposure
Definition: VisitInfo.h:145
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
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
std::shared_ptr< typehandling::Storable > cloneStorable() const override
Create a new VisitInfo that is a copy of this one.
Definition: VisitInfo.cc:536
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
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
Definition: Catalog.h:490
An object passed to Persistable::write to allow it to persist itself.
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
static std::shared_ptr< T > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18
Interface supporting iteration over heterogenous containers.
Definition: Storable.h:58
std::string toString(Timescale scale) const
double get(DateSystem system=MJD, Timescale scale=TAI) const
void set(std::string const &name, T const &value)
std::string getAsString(std::string const &name) const
virtual void remove(std::string const &name)
int64_t getAsInt64(std::string const &name) const
bool exists(std::string const &name) const
double getAsDouble(std::string const &name) const
T empty(T... args)
T isfinite(T... args)
def keys(self)
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.
FilterProperty & operator=(FilterProperty const &)=default
std::ostream & operator<<(std::ostream &os, Measurement const &measurement)
Definition: PhotoCalib.cc:47
RotType
Type of rotation.
Definition: VisitInfo.h:45
@ UNKNOWN
Rotation angle is unknown.
lsst::geom::Angle Angle
Definition: misc.h:33
lsst::geom::SpherePoint SpherePoint
Definition: misc.h:34
std::int64_t RecordId
Type used for unique IDs for records.
Definition: misc.h:21
constexpr AngleUnit degrees
constexpr AngleUnit radians
A base class for image defects.
STL namespace.
T nan(T... args)
T quiet_NaN(T... args)
T stod(T... args)
T str(T... args)
Key< int > visitInfo
Definition: Exposure.cc:70
T to_string(T... args)
std::shared_ptr< table::io::Persistable > read(table::io::InputArchive const &archive, table::io::CatalogVector const &catalogs) const override
Definition: warpExposure.cc:0