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.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 int constexpr SERIALIZATION_VERSION = 1;
62 
64 
73 double getDouble(daf::base::PropertySet const& metadata, std::string const& key) {
74  return metadata.exists(key) ? metadata.getAsDouble(key) : nan;
75 }
76 
85 lsst::geom::Angle getAngle(daf::base::PropertySet const& metadata, std::string const& key) {
86  return getDouble(metadata, key) * lsst::geom::degrees;
87 }
88 
97 std::string getString(daf::base::PropertySet const& metadata, std::string const& key) {
98  return metadata.exists(key) ? metadata.getAsString(key) : "";
99 }
100 
109 bool 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 
126 bool 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 
139 bool 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 
153 std::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 
174 RotType 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 
189 class VisitInfoSchema {
190 public:
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  static std::string const VERSION_KEY;
217 
218  static VisitInfoSchema const& get() {
219  static VisitInfoSchema instance;
220  return instance;
221  }
222 
223  // No copying
224  VisitInfoSchema(const VisitInfoSchema&) = delete;
225  VisitInfoSchema& operator=(const VisitInfoSchema&) = delete;
226 
227  // No moving
228  VisitInfoSchema(VisitInfoSchema&&) = delete;
229  VisitInfoSchema& operator=(VisitInfoSchema&&) = delete;
230 
231 private:
232  VisitInfoSchema()
233  : schema(),
234  exposureId(schema.addField<table::RecordId>("exposureid", "exposure ID", "")),
235  exposureTime(schema.addField<double>("exposuretime", "exposure duration", "s")),
236  darkTime(schema.addField<double>("darktime", "time from CCD flush to readout", "s")),
237  tai(schema.addField<std::int64_t>(
238  "tai", "TAI date and time at middle of exposure as nsec from unix epoch", "nsec")),
239  ut1(schema.addField<double>("ut1", "UT1 date and time at middle of exposure", "MJD")),
240  era(schema.addField<lsst::geom::Angle>("era", "earth rotation angle at middle of exposure",
241  "")),
242  boresightRaDec(table::CoordKey::addFields(schema, "boresightradec",
243  "sky position of boresight at middle of exposure")),
244  // CoordKey is intended for ICRS coordinates, so use a pair of lsst::geom::Angle fields
245  // to save boresightAzAlt
246  boresightAzAlt_az(schema.addField<lsst::geom::Angle>(
247  "boresightazalt_az",
248  "refracted apparent topocentric position of boresight at middle of exposure", "")),
250  "boresightazalt_alt",
251  "refracted apparent topocentric position of boresight at middle of exposure", "")),
252  boresightAirmass(schema.addField<double>(
253  "boresightairmass", "airmass at boresight, relative to zenith at sea level", "")),
254  boresightRotAngle(schema.addField<lsst::geom::Angle>(
255  "boresightrotangle", "rotation angle at boresight at middle of exposure", "")),
256  rotType(schema.addField<int>("rottype", "rotation type; see VisitInfo.getRotType for details",
257  "MJD")),
258  // observatory data
259  latitude(schema.addField<lsst::geom::Angle>(
260  "latitude", "latitude of telescope (+ is east of Greenwich)", "")),
261  longitude(schema.addField<lsst::geom::Angle>("longitude", "longitude of telescope", "")),
262  elevation(schema.addField<double>("elevation", "elevation of telescope", "")),
263 
264  // weather data
265  airTemperature(schema.addField<double>("airtemperature", "air temperature", "C")),
266  airPressure(schema.addField<double>("airpressure", "air pressure", "Pascal")),
267  humidity(schema.addField<double>("humidity", "humidity (%)", "")),
268 
269  instrumentLabel(schema.addField<std::string>(
270  "instrumentlabel", "Short name of the instrument that took this data", "", 0)),
271 
272  // for internal support
273  version(schema.addField<int>(VERSION_KEY, "version of this VisitInfo")) {}
274 };
275 std::string const VisitInfoSchema::VERSION_KEY = "version";
276 
277 class VisitInfoFactory : public table::io::PersistableFactory {
278 public:
279  std::shared_ptr<table::io::Persistable> read(InputArchive const& archive,
280  CatalogVector const& catalogs) const override {
281  VisitInfoSchema const& keys = VisitInfoSchema::get();
282  LSST_ARCHIVE_ASSERT(catalogs.size() == 1u);
283  LSST_ARCHIVE_ASSERT(catalogs.front().size() == 1u);
284  table::BaseRecord const& record = catalogs.front().front();
285  int version = getVersion(record);
286  if (version > SERIALIZATION_VERSION) {
287  throw LSST_EXCEPT(pex::exceptions::TypeError, "Cannot read VisitInfo FITS version > " +
288  std::to_string(SERIALIZATION_VERSION));
289  }
290 
291  // Version-dependent fields
292  std::string instrumentLabel = version >= 1 ? record.get(keys.instrumentLabel) : "";
293 
295  new VisitInfo(record.get(keys.exposureId), record.get(keys.exposureTime),
296  record.get(keys.darkTime), ::DateTime(record.get(keys.tai), ::DateTime::TAI),
297  record.get(keys.ut1), record.get(keys.era), record.get(keys.boresightRaDec),
298  lsst::geom::SpherePoint(record.get(keys.boresightAzAlt_az),
299  record.get(keys.boresightAzAlt_alt)),
300  record.get(keys.boresightAirmass), record.get(keys.boresightRotAngle),
301  static_cast<RotType>(record.get(keys.rotType)),
302  coord::Observatory(record.get(keys.longitude), record.get(keys.latitude),
303  record.get(keys.elevation)),
304  coord::Weather(record.get(keys.airTemperature), record.get(keys.airPressure),
305  record.get(keys.humidity)),
306  instrumentLabel));
307  return result;
308  }
309 
310  explicit VisitInfoFactory(std::string const& name) : table::io::PersistableFactory(name) {}
311 
312 private:
313  int getVersion(table::BaseRecord const& record) const {
314  try {
315  // Don't assume version is at same index as in VisitInfoSchema
316  auto versionKey = record.getSchema().find<int>(VisitInfoSchema::VERSION_KEY);
317  return record.get(versionKey.key);
318  } catch (pex::exceptions::NotFoundError const&) {
319  // un-versioned files are implicitly version 0
320  return 0;
321  }
322  }
323 };
324 
325 std::string getVisitInfoPersistenceName() { return "VisitInfo"; }
326 
327 VisitInfoFactory registration(getVisitInfoPersistenceName());
328 
329 } // namespace
330 
331 namespace detail {
332 
334  int nstripped = 0;
335 
336  std::vector<std::string> keyList = {"EXPID", "EXPTIME", "DARKTIME", "DATE-AVG", "TIMESYS",
337  "TIME-MID", "MJD-AVG-UT1", "AVG-ERA", "BORE-RA", "BORE-DEC",
338  "BORE-AZ", "BORE-ALT", "BORE-AIRMASS", "BORE-ROTANG", "ROTTYPE",
339  "OBS-LONG", "OBS-LAT", "OBS-ELEV", "AIRTEMP", "AIRPRESS",
340  "HUMIDITY", "INSTRUMENT"};
341  for (auto&& key : keyList) {
342  if (metadata.exists(key)) {
343  metadata.remove(key);
344  nstripped++;
345  }
346  }
347  return nstripped;
348 }
349 
351  if (visitInfo.getExposureId() != 0) {
352  metadata.set("EXPID", visitInfo.getExposureId());
353  }
354  setDouble(metadata, "EXPTIME", visitInfo.getExposureTime(), "Exposure time (sec)");
355  setDouble(metadata, "DARKTIME", visitInfo.getDarkTime(), "Time from CCD flush to readout (sec)");
356  if (visitInfo.getDate().isValid()) {
357  metadata.set("DATE-AVG", visitInfo.getDate().toString(::DateTime::TAI),
358  "TAI date at middle of observation");
359  metadata.set("TIMESYS", "TAI");
360  }
361  setDouble(metadata, "MJD-AVG-UT1", visitInfo.getUt1(), "UT1 MJD date at ctr of obs");
362  setAngle(metadata, "AVG-ERA", visitInfo.getEra(), "Earth rot ang at ctr of obs (deg)");
363  auto boresightRaDec = visitInfo.getBoresightRaDec();
364  setAngle(metadata, "BORE-RA", boresightRaDec[0], "ICRS RA (deg) at boresight");
365  setAngle(metadata, "BORE-DEC", boresightRaDec[1], "ICRS Dec (deg) at boresight");
366  auto boresightAzAlt = visitInfo.getBoresightAzAlt();
367  setAngle(metadata, "BORE-AZ", boresightAzAlt[0], "Refr app topo az (deg) at bore");
368  setAngle(metadata, "BORE-ALT", boresightAzAlt[1], "Refr app topo alt (deg) at bore");
369  setDouble(metadata, "BORE-AIRMASS", visitInfo.getBoresightAirmass(), "Airmass at boresight");
370  setAngle(metadata, "BORE-ROTANG", visitInfo.getBoresightRotAngle(), "Rotation angle (deg) at boresight");
371  metadata.set("ROTTYPE", rotTypeStrFromEnum(visitInfo.getRotType()), "Type of rotation angle");
372  auto observatory = visitInfo.getObservatory();
373  setAngle(metadata, "OBS-LONG", observatory.getLongitude(), "Telescope longitude (+E, deg)");
374  setAngle(metadata, "OBS-LAT", observatory.getLatitude(), "Telescope latitude (deg)");
375  setDouble(metadata, "OBS-ELEV", observatory.getElevation(), "Telescope elevation (m)");
376  auto weather = visitInfo.getWeather();
377  setDouble(metadata, "AIRTEMP", weather.getAirTemperature(), "Outside air temperature (C)");
378  setDouble(metadata, "AIRPRESS", weather.getAirPressure(), "Outdoor air pressure (P)");
379  setDouble(metadata, "HUMIDITY", weather.getHumidity(), "Relative humidity (%)");
380  setString(metadata, "INSTRUMENT", visitInfo.getInstrumentLabel(),
381  "Short name of the instrument that took this data");
382 }
383 
384 } // namespace detail
385 
386 VisitInfo::VisitInfo(daf::base::PropertySet const& metadata)
387  : _exposureId(0),
388  _exposureTime(nan), // don't use getDouble because str values are also accepted
389  _darkTime(getDouble(metadata, "DARKTIME")),
390  _date(),
391  _ut1(getDouble(metadata, "MJD-AVG-UT1")),
392  _era(getAngle(metadata, "AVG-ERA")),
393  _boresightRaDec(
394  lsst::geom::SpherePoint(getAngle(metadata, "BORE-RA"), getAngle(metadata, "BORE-DEC"))),
395  _boresightAzAlt(
396  lsst::geom::SpherePoint(getAngle(metadata, "BORE-AZ"), getAngle(metadata, "BORE-ALT"))),
397  _boresightAirmass(getDouble(metadata, "BORE-AIRMASS")),
398  _boresightRotAngle(getAngle(metadata, "BORE-ROTANG")),
399  _rotType(RotType::UNKNOWN),
400  _observatory(getAngle(metadata, "OBS-LONG"), getAngle(metadata, "OBS-LAT"),
401  getDouble(metadata, "OBS-ELEV")),
402  _weather(getDouble(metadata, "AIRTEMP"), getDouble(metadata, "AIRPRESS"),
403  getDouble(metadata, "HUMIDITY")),
404  _instrumentLabel(getString(metadata, "INSTRUMENT")) {
405  auto key = "EXPID";
406  if (metadata.exists(key)) {
407  _exposureId = metadata.getAsInt64(key);
408  }
409 
410  key = "EXPTIME";
411  if (metadata.exists(key)) {
412  try {
413  _exposureTime = metadata.getAsDouble(key);
414  } catch (lsst::pex::exceptions::TypeError& err) {
415  // some old exposures have EXPTIME stored as a string
416  std::string exptimeStr = metadata.getAsString(key);
417  _exposureTime = std::stod(exptimeStr);
418  }
419  }
420 
421  key = "DATE-AVG";
422  if (metadata.exists(key)) {
423  if (metadata.exists("TIMESYS")) {
424  auto timesysName = boost::algorithm::trim_right_copy(metadata.getAsString("TIMESYS"));
425  if (timesysName != "TAI") {
426  // rather than try to deal with all the possible choices, which requires
427  // appending or deleting a "Z", depending on the time system, just give up.
428  // VisitInfo should be used on FITS headers that have been sanitized!
430  os << "TIMESYS = \"" << timesysName
431  << "\"; VisitInfo requires TIMESYS to exist and to equal \"TAI\"";
433  }
434  } else {
436  "TIMESYS not found; VistitInfo requires TIMESYS to exist and to equal \"TAI\"");
437  }
438  _date = ::DateTime(boost::algorithm::trim_right_copy(metadata.getAsString(key)), ::DateTime::TAI);
439  } else {
440  // DATE-AVG not found. For backwards compatibility look for TIME-MID, an outdated LSST keyword
441  // whose time system was UTC, despite a FITS comment claiming it was TAI. Ignore TIMESYS.
442  key = "TIME-MID";
443  if (metadata.exists(key)) {
444  _date = ::DateTime(boost::algorithm::trim_right_copy(metadata.getAsString(key)), ::DateTime::UTC);
445  }
446  }
447 
448  key = "ROTTYPE";
449  if (metadata.exists(key)) {
450  _rotType = rotTypeEnumFromStr(metadata.getAsString(key));
451  }
452 }
453 
455  return _exposureId == other.getExposureId() && _exposureTime == other.getExposureTime() &&
456  _darkTime == other.getDarkTime() && _date == other.getDate() && _ut1 == other.getUt1() &&
457  _era == other.getEra() && _boresightRaDec == other.getBoresightRaDec() &&
458  _boresightAzAlt == other.getBoresightAzAlt() && _boresightAirmass == other.getBoresightAirmass() &&
459  _boresightRotAngle == other.getBoresightRotAngle() && _rotType == other.getRotType() &&
460  _observatory == other.getObservatory() && _weather == other.getWeather() &&
461  _instrumentLabel == other.getInstrumentLabel();
462 }
463 
465  // Completely arbitrary seed
466  return utils::hashCombine(17, _exposureId, _exposureTime, _darkTime, _date, _ut1, _era, _boresightRaDec,
467  _boresightAzAlt, _boresightAirmass, _boresightRotAngle, _rotType, _observatory,
468  _weather, _instrumentLabel);
469 }
470 
471 std::string VisitInfo::getPersistenceName() const { return getVisitInfoPersistenceName(); }
472 
474  VisitInfoSchema const& keys = VisitInfoSchema::get();
475  table::BaseCatalog cat = handle.makeCatalog(keys.schema);
477  record->set(keys.exposureId, getExposureId());
478  record->set(keys.exposureTime, getExposureTime());
479  record->set(keys.darkTime, getDarkTime());
480  record->set(keys.tai, getDate().nsecs(::DateTime::TAI));
481  record->set(keys.ut1, getUt1());
482  record->set(keys.era, getEra());
483  record->set(keys.boresightRaDec, getBoresightRaDec());
484  auto boresightAzAlt = getBoresightAzAlt();
485  record->set(keys.boresightAzAlt_az, boresightAzAlt[0]);
486  record->set(keys.boresightAzAlt_alt, boresightAzAlt[1]);
487  record->set(keys.boresightAirmass, getBoresightAirmass());
488  record->set(keys.boresightRotAngle, getBoresightRotAngle());
489  record->set(keys.rotType, static_cast<int>(getRotType()));
490  auto observatory = getObservatory();
491  record->set(keys.latitude, observatory.getLatitude());
492  record->set(keys.longitude, observatory.getLongitude());
493  record->set(keys.elevation, observatory.getElevation());
494  auto weather = getWeather();
495  record->set(keys.airTemperature, weather.getAirTemperature());
496  record->set(keys.airPressure, weather.getAirPressure());
497  record->set(keys.humidity, weather.getHumidity());
498  record->set(keys.instrumentLabel, getInstrumentLabel());
499  record->set(keys.version, SERIALIZATION_VERSION);
500  handle.saveCatalog(cat);
501 }
502 
504 
506 
512  double _parallactic_y, _parallactic_x, result;
513  _parallactic_y = sin(getBoresightHourAngle().asRadians());
514  _parallactic_x =
515  cos((getBoresightRaDec()[1]).asRadians()) * tan(getObservatory().getLatitude().asRadians()) -
516  sin((getBoresightRaDec()[1]).asRadians()) * cos(getBoresightHourAngle().asRadians());
517  result = atan2(_parallactic_y, _parallactic_x);
518  return result * lsst::geom::radians;
519 }
520 
522  return std::make_unique<VisitInfo>(*this);
523 }
524 
525 bool VisitInfo::equals(typehandling::Storable const& other) const noexcept {
526  return singleClassEquals(*this, other);
527 }
528 
530  std::stringstream buffer;
531  buffer << "VisitInfo(";
532  buffer << "exposureId=" << getExposureId() << ", ";
533  buffer << "exposureTime=" << getExposureTime() << ", ";
534  buffer << "darkTime=" << getDarkTime() << ", ";
535  buffer << "date=" << getDate().toString(daf::base::DateTime::TAI) << ", ";
536  buffer << "UT1=" << getUt1() << ", ";
537  buffer << "ERA=" << getEra() << ", ";
538  buffer << "boresightRaDec=" << getBoresightRaDec() << ", ";
539  buffer << "boresightAzAlt=" << getBoresightAzAlt() << ", ";
540  buffer << "boresightAirmass=" << getBoresightAirmass() << ", ";
541  buffer << "boresightRotAngle=" << getBoresightRotAngle() << ", ";
542  buffer << "rotType=" << static_cast<int>(getRotType()) << ", ";
543  buffer << "observatory=" << getObservatory() << ", ";
544  buffer << "weather=" << getWeather() << ", ";
545  buffer << "instrumentLabel=" << getInstrumentLabel();
546  buffer << ")";
547  return buffer.str();
548 }
549 
551  os << visitInfo.toString();
552  return os;
553 }
554 
555 } // namespace image
556 } // namespace afw
557 } // namespace lsst
py::object result
Definition: _schema.cc:430
table::Key< std::string > name
Definition: Amplifier.cc:116
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
table::Key< double > angle
ItemVariant const * other
Definition: Schema.cc:56
Key< U > key
Definition: Schema.cc:281
std::ostream * os
Definition: Schema.cc:746
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< 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
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition: Persistable.h:48
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:471
daf::base::DateTime getDate() const
get uniform date and time at middle of exposure
Definition: VisitInfo.h:137
coord::Weather getWeather() const
get basic weather information
Definition: VisitInfo.h:172
lsst::geom::Angle getLocalEra() const
Definition: VisitInfo.cc:503
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
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
lsst::geom::Angle getEra() const
get earth rotation angle at middle of exposure
Definition: VisitInfo.h:143
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
std::shared_ptr< typehandling::Storable > cloneStorable() const override
Create a new VisitInfo that is a copy of this one.
Definition: VisitInfo.cc:521
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
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
Definition: VisitInfo.cc:473
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:485
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
Class for handling dates/times, including MJD, UTC, and TAI.
Definition: DateTime.h:64
std::string toString(Timescale scale) const
Get date as an ISO8601-formatted string.
Definition: DateTime.cc:499
double get(DateSystem system=MJD, Timescale scale=TAI) const
Get date as a double in a specified representation, such as MJD.
Definition: DateTime.cc:429
Class for storing ordered metadata with comments.
Definition: PropertyList.h:68
void set(std::string const &name, T const &value)
Replace all values for a property name (possibly hierarchical) with a new scalar value.
Class for storing generic metadata.
Definition: PropertySet.h:67
std::string getAsString(std::string const &name) const
Get the last value for a string property name (possibly hierarchical).
virtual void remove(std::string const &name)
Remove all values for a property name (possibly hierarchical).
int64_t getAsInt64(std::string const &name) const
Get the last value for a bool/char/short/int/int64_t property name (possibly hierarchical).
bool exists(std::string const &name) const
Determine if a name (possibly hierarchical) exists.
double getAsDouble(std::string const &name) const
Get the last value for any arithmetic property name (possibly hierarchical).
A class representing an angle.
Definition: Angle.h:127
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:57
Reports errors that are due to events beyond the control of the program.
Definition: Runtime.h:104
Reports errors from accepting an object of an unexpected or inappropriate type.
Definition: Runtime.h:167
T empty(T... args)
T isfinite(T... args)
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
@ 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
constant with units of degrees
Definition: Angle.h:109
constexpr AngleUnit radians
constant with units of radians
Definition: Angle.h:108
double sin(Angle const &a)
Definition: Angle.h:102
double tan(Angle const &a)
Definition: Angle.h:104
double cos(Angle const &a)
Definition: Angle.h:103
std::size_t hashCombine(std::size_t seed) noexcept
Combine hashes.
Definition: hashCombine.h:35
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)