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