LSST Applications  21.0.0-147-g0e635eb1+1acddb5be5,22.0.0+052faf71bd,22.0.0+1ea9a8b2b2,22.0.0+6312710a6c,22.0.0+729191ecac,22.0.0+7589c3a021,22.0.0+9f079a9461,22.0.1-1-g7d6de66+b8044ec9de,22.0.1-1-g87000a6+536b1ee016,22.0.1-1-g8e32f31+6312710a6c,22.0.1-10-gd060f87+016f7cdc03,22.0.1-12-g9c3108e+df145f6f68,22.0.1-16-g314fa6d+c825727ab8,22.0.1-19-g93a5c75+d23f2fb6d8,22.0.1-19-gb93eaa13+aab3ef7709,22.0.1-2-g8ef0a89+b8044ec9de,22.0.1-2-g92698f7+9f079a9461,22.0.1-2-ga9b0f51+052faf71bd,22.0.1-2-gac51dbf+052faf71bd,22.0.1-2-gb66926d+6312710a6c,22.0.1-2-gcb770ba+09e3807989,22.0.1-20-g32debb5+b8044ec9de,22.0.1-23-gc2439a9a+fb0756638e,22.0.1-3-g496fd5d+09117f784f,22.0.1-3-g59f966b+1e6ba2c031,22.0.1-3-g849a1b8+f8b568069f,22.0.1-3-gaaec9c0+c5c846a8b1,22.0.1-32-g5ddfab5d3+60ce4897b0,22.0.1-4-g037fbe1+64e601228d,22.0.1-4-g8623105+b8044ec9de,22.0.1-5-g096abc9+d18c45d440,22.0.1-5-g15c806e+57f5c03693,22.0.1-7-gba73697+57f5c03693,master-g6e05de7fdc+c1283a92b8,master-g72cdda8301+729191ecac,w.2021.39
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 <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"
32 #include "lsst/geom/SpherePoint.h"
33 #include "lsst/afw/table/Key.h"
34 #include "lsst/afw/table/aggregates.h" // for CoordKey
35 #include "lsst/afw/table/Schema.h"
36 #include "lsst/afw/table/misc.h" // for RecordId
39 #include "lsst/afw/table/io/CatalogVector.h" // needed, but why?
42 
44 
45 namespace lsst {
46 namespace afw {
47 
50 
51 namespace image {
52 
53 // the following persistence-related code emulates that in Calib.cc
54 
55 namespace {
56 
57 // Version history:
58 // unversioned: original VisitInfo schema
59 // 1: file versioning, instrument label
60 // 2: id field
61 int constexpr SERIALIZATION_VERSION = 2;
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  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 
233 private:
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", "")),
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 };
280 std::string const VisitInfoSchema::VERSION_KEY = "version";
281 
282 class VisitInfoFactory : public table::io::PersistableFactory {
283 public:
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 
318 private:
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 
331 std::string getVisitInfoPersistenceName() { return "VisitInfo"; }
332 
333 VisitInfoFactory registration(getVisitInfoPersistenceName());
334 
335 } // namespace
336 
337 namespace 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 
395 VisitInfo::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 
468 bool 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 
485 std::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 
540 bool 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
py::object result
Definition: _schema.cc:429
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
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
#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: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
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:500
double get(DateSystem system=MJD, Timescale scale=TAI) const
Get date as a double in a specified representation, such as MJD.
Definition: DateTime.cc:430
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:66
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: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.
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.
FilterProperty & operator=(FilterProperty const &)=default
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
std::size_t hashCombine(std::size_t seed) noexcept
Combine hashes.
Definition: hashCombine.h:35
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
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