LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Exposure.cc
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 #include <memory>
3 #include <typeinfo>
4 #include <string>
5 
8 #include "lsst/pex/exceptions.h"
14 #include "lsst/afw/geom/SkyWcs.h"
17 #include "lsst/afw/detection/Psf.h"
22 
23 namespace lsst {
24 namespace afw {
25 namespace table {
26 
27 //-----------------------------------------------------------------------------------------------------------
28 //----- Private ExposureTable/Record classes ---------------------------------------------------------------
29 //-----------------------------------------------------------------------------------------------------------
30 
31 // These private derived classes are what you actually get when you do ExposureTable::make; like the
32 // private classes in BaseTable.cc, it's more convenient to have an extra set of trivial derived
33 // classes than to do a lot of friending.
34 
35 namespace {
36 
37 int const EXPOSURE_TABLE_CURRENT_VERSION = 5; // current version of ExposureTable
38 std::string const EXPOSURE_TABLE_VERSION_KEY = "EXPTABLE_VER"; // FITS header key for ExposureTable version
39 
40 // Field names used to store the archive IDs of different components (used in
41 // multiple places, so we define them here instead of as multiple string
42 // literals).
43 std::string const WCS_FIELD_NAME = "wcs";
44 std::string const PSF_FIELD_NAME = "psf";
45 std::string const CALIB_FIELD_NAME = "calib"; // to support the deprecated Calib in old files
46 std::string const PHOTOCALIB_FIELD_NAME = "photoCalib";
47 std::string const VISIT_INFO_FIELD_NAME = "visitInfo";
48 std::string const AP_CORR_MAP_FIELD_NAME = "apCorrMap";
49 std::string const VALID_POLYGON_FIELD_NAME = "validPolygon";
50 std::string const TRANSMISSION_CURVE_FIELD_NAME = "transmissionCurve";
51 std::string const DETECTOR_FIELD_NAME = "detector";
52 
53 int getTableVersion(daf::base::PropertySet &metadata) {
54  return metadata.exists(EXPOSURE_TABLE_VERSION_KEY) ? metadata.get<int>(EXPOSURE_TABLE_VERSION_KEY) : 1;
55 }
56 
62 struct PersistenceHelper {
63  Schema schema;
64  Key<int> wcs;
65  Key<int> psf;
66  Key<int> calib; // to support the deprecated Calib in old files (replaced with photoCalib)
67  Key<int> photoCalib;
68  Key<int> apCorrMap;
69  Key<int> validPolygon;
70  Key<int> visitInfo;
72  Key<int> detector;
73 
74  // Create a SchemaMapper that maps an ExposureRecord to a BaseRecord with IDs for Wcs, Psf, etc.
75  SchemaMapper makeWriteMapper(Schema const &inputSchema) const {
76  std::vector<Schema> inSchemas;
77  inSchemas.push_back(PersistenceHelper().schema);
78  inSchemas.push_back(inputSchema);
79  // don't need front; it's an identity mapper
80  SchemaMapper result = SchemaMapper::join(inSchemas).back();
81  result.editOutputSchema().setAliasMap(inputSchema.getAliasMap());
82  return result;
83  }
84 
85  // Create a SchemaMapper that maps a BaseRecord to an ExposureRecord with IDs for WCS, Psf, etc.
86  SchemaMapper makeReadMapper(Schema const &inputSchema) const {
87  SchemaMapper result = SchemaMapper::removeMinimalSchema(inputSchema, schema);
88  result.editOutputSchema().setAliasMap(inputSchema.getAliasMap());
89  return result;
90  }
91 
92  // Write psf, wcs, etc. from an ExposureRecord to an archive
93  template <typename OutputArchiveIsh>
94  void writeRecord(ExposureRecord const &input, BaseRecord &output, SchemaMapper const &mapper,
95  OutputArchiveIsh &archive, bool permissive) const {
96  output.assign(input, mapper);
97  output.set(psf, archive.put(input.getPsf(), permissive));
98  output.set(wcs, archive.put(input.getWcs(), permissive));
99  output.set(photoCalib, archive.put(input.getPhotoCalib(), permissive));
100  output.set(apCorrMap, archive.put(input.getApCorrMap(), permissive));
101  output.set(validPolygon, archive.put(input.getValidPolygon(), permissive));
102  output.set(visitInfo, archive.put(input.getVisitInfo(), permissive));
103  output.set(transmissionCurve, archive.put(input.getTransmissionCurve(), permissive));
104  output.set(detector, archive.put(input.getDetector(), permissive));
105  }
106 
107  // Read psf, wcs, etc. from an archive to an ExposureRecord
108  void readRecord(BaseRecord const &input, ExposureRecord &output, SchemaMapper const &mapper,
109  io::InputArchive const &archive) const {
110  output.assign(input, mapper);
111  if (psf.isValid()) {
112  output.setPsf(archive.get<detection::Psf>(input.get(psf)));
113  }
114  if (wcs.isValid()) {
115  output.setWcs(archive.get<geom::SkyWcs>(input.get(wcs)));
116  }
117  if (calib.isValid()) {
118  output.setPhotoCalib(archive.get<image::PhotoCalib>(input.get(calib)));
119  }
120  if (photoCalib.isValid()) {
121  output.setPhotoCalib(archive.get<image::PhotoCalib>(input.get(photoCalib)));
122  }
123  if (apCorrMap.isValid()) {
124  output.setApCorrMap(archive.get<image::ApCorrMap>(input.get(apCorrMap)));
125  }
126  if (validPolygon.isValid()) {
127  output.setValidPolygon(archive.get<geom::polygon::Polygon>(input.get(validPolygon)));
128  }
129  if (visitInfo.isValid()) {
130  output.setVisitInfo(archive.get<image::VisitInfo>(input.get(visitInfo)));
131  }
132  if (transmissionCurve.isValid()) {
133  output.setTransmissionCurve(archive.get<image::TransmissionCurve>(input.get(transmissionCurve)));
134  }
135  if (detector.isValid()) {
136  output.setDetector(archive.get<cameraGeom::Detector>(input.get(detector)));
137  }
138  }
139 
140  // No copying
141  PersistenceHelper(const PersistenceHelper &) = delete;
142  PersistenceHelper &operator=(const PersistenceHelper &) = delete;
143 
144  // No moving
145  PersistenceHelper(PersistenceHelper &&) = delete;
146  PersistenceHelper &operator=(PersistenceHelper &&) = delete;
147 
148  // Construct a PersistenceHelper using the most modern schema.
149  PersistenceHelper()
150  : schema(),
151  wcs(schema.addField<int>(WCS_FIELD_NAME, "archive ID for Wcs object")),
152  psf(schema.addField<int>(PSF_FIELD_NAME, "archive ID for Psf object")),
153  photoCalib(schema.addField<int>(PHOTOCALIB_FIELD_NAME, "archive ID for PhotoCalib object")),
154  apCorrMap(schema.addField<int>(AP_CORR_MAP_FIELD_NAME, "archive ID for ApCorrMap object")),
155  validPolygon(schema.addField<int>(VALID_POLYGON_FIELD_NAME, "archive ID for Polygon object")),
156  visitInfo(schema.addField<int>(VISIT_INFO_FIELD_NAME, "archive ID for VisitInfo object")),
157  transmissionCurve(schema.addField<int>(TRANSMISSION_CURVE_FIELD_NAME,
158  "archive ID for TransmissionCurve object")),
159  detector(schema.addField<int>(DETECTOR_FIELD_NAME, "archive ID for Detector object")) {}
160 
161  // Add a field to this->schema, saving its key in 'key', if and only if 'name' is a field in 'oldSchema'
162  void addIfPresent(Schema const &oldSchema, Key<int> &key, std::string const &name) {
163  try {
164  auto item = oldSchema.find<int>(name);
165  key = schema.addField(item.field);
166  } catch (pex::exceptions::NotFoundError &) {
167  }
168  }
169 
170  // Construct a PersistenceHelper from a possibly old on-disk schema
171  PersistenceHelper(Schema const &oldSchema) {
172  addIfPresent(oldSchema, wcs, WCS_FIELD_NAME);
173  addIfPresent(oldSchema, psf, PSF_FIELD_NAME);
174  addIfPresent(oldSchema, calib, CALIB_FIELD_NAME);
175  addIfPresent(oldSchema, photoCalib, PHOTOCALIB_FIELD_NAME);
176  addIfPresent(oldSchema, apCorrMap, AP_CORR_MAP_FIELD_NAME);
177  addIfPresent(oldSchema, validPolygon, VALID_POLYGON_FIELD_NAME);
178  addIfPresent(oldSchema, visitInfo, VISIT_INFO_FIELD_NAME);
179  addIfPresent(oldSchema, transmissionCurve, TRANSMISSION_CURVE_FIELD_NAME);
180  addIfPresent(oldSchema, detector, DETECTOR_FIELD_NAME);
181  assert(oldSchema.contains(schema));
182  }
183 };
184 
185 } // namespace
186 
187 //-----------------------------------------------------------------------------------------------------------
188 //----- ExposureFitsWriter ---------------------------------------------------------------------------------
189 //-----------------------------------------------------------------------------------------------------------
190 
191 // A custom FitsWriter for Exposure - this sets the AFW_TYPE key to EXPOSURE, which should ensure
192 // we use ExposureFitsReader to read it, and sets EXPOSURE_TABLE_VERSION_KEY to the current version:
193 // EXPOSURE_TABLE_CURRENT_VERSION
194 
195 namespace {
196 
197 class ExposureFitsWriter : public io::FitsWriter {
198 public:
199  ExposureFitsWriter(Fits *fits, std::shared_ptr<io::OutputArchive> archive, int flags)
200  : io::FitsWriter(fits, flags), _doWriteArchive(false), _archive(archive), _helper() {
201  if (!_archive) {
202  _doWriteArchive = true;
203  _archive.reset(new io::OutputArchive());
204  }
205  }
206 
207 protected:
208  void _writeTable(std::shared_ptr<BaseTable const> const &table, std::size_t nRows) override;
209 
210  void _writeRecord(BaseRecord const &r) override;
211 
212  void _finish() override {
213  if (_doWriteArchive) _archive->writeFits(*_fits);
214  }
215 
219  PersistenceHelper _helper;
220  SchemaMapper _mapper;
221 };
222 
223 void ExposureFitsWriter::_writeTable(std::shared_ptr<BaseTable const> const &t, std::size_t nRows) {
224  std::shared_ptr<ExposureTable const> inTable = std::dynamic_pointer_cast<ExposureTable const>(t);
225  if (!inTable) {
227  "Cannot use a ExposureFitsWriter on a non-Exposure table.");
228  }
229  _mapper = _helper.makeWriteMapper(inTable->getSchema());
231  // Put the metadata from inTable in outTable
232  outTable->setMetadata(inTable->getMetadata());
233  io::FitsWriter::_writeTable(outTable, nRows);
234  _fits->writeKey("AFW_TYPE", "EXPOSURE", "Tells lsst::afw to load this as an Exposure table.");
235  _fits->writeKey(EXPOSURE_TABLE_VERSION_KEY, EXPOSURE_TABLE_CURRENT_VERSION, "Exposure table version");
236  _record = outTable->makeRecord();
237 }
238 
239 void ExposureFitsWriter::_writeRecord(BaseRecord const &r) {
240  ExposureRecord const &record = static_cast<ExposureRecord const &>(r);
241  _helper.writeRecord(record, *_record, _mapper, *_archive, false);
243 }
244 
245 } // namespace
246 
247 //-----------------------------------------------------------------------------------------------------------
248 //----- ExposureFitsReader ---------------------------------------------------------------------------------
249 //-----------------------------------------------------------------------------------------------------------
250 
251 // FitsColumnReader that reads a Persistable subclass T (Wcs, Psf, or PhotoCalib here) by using an int
252 // column to retrieve the object from an InputArchive and attach it to an ExposureRecord via
253 // the Setter member function pointer.
254 template <typename T, void (ExposureRecord::*Setter)(std::shared_ptr<T const>)>
256 public:
258  auto item = mapper.find(name);
259  if (item) {
260  if (mapper.hasArchive()) {
262  mapper.customize(std::move(reader));
263  }
264  mapper.erase(item);
265  }
266  }
267 
268  PersistableObjectColumnReader(int column) : _column(column) {}
269 
271  std::shared_ptr<io::InputArchive> const &archive) const override {
272  int id = 0;
273  fits.readTableScalar<int>(row, _column, id);
274  std::shared_ptr<T> value = archive->get<T>(id);
275  (static_cast<ExposureRecord &>(record).*(Setter))(value);
276  }
277 
278 private:
279  bool _noHeavy;
280  int _column;
281 };
282 
283 namespace {
284 
285 class ExposureFitsReader : public io::FitsReader {
286 public:
287  ExposureFitsReader() : afw::table::io::FitsReader("EXPOSURE") {}
288 
289  std::shared_ptr<BaseTable> makeTable(io::FitsSchemaInputMapper &mapper,
290  std::shared_ptr<daf::base::PropertyList> metadata, int ioFlags,
291  bool stripMetadata) const override {
292  // We rely on the table version stored in the metadata when loading an ExposureCatalog
293  // persisted on its own. This is not as flexible in terms of backwards compatibility
294  // as the code that loads ExposureCatalogs persisted as part of something else, but
295  // we happen to know there are no ExposureCatalogs sitting on disk with with versions
296  // older than what this routine supports.
297  auto tableVersion = getTableVersion(*metadata);
301  mapper);
303  "validPolygon", mapper);
304  if (tableVersion > 1) {
306  mapper);
307  }
308  if (tableVersion > 2) {
309  PersistableObjectColumnReader<image::TransmissionCurve,
310  &ExposureRecord::setTransmissionCurve>::setup("transmissionCurve",
311  mapper);
312  }
313  if (tableVersion > 3) {
315  "detector", mapper);
316  }
317  // Load the PhotoCalib from the `calib` table prior to version 5.
318  if (tableVersion <= 4) {
320  mapper);
321  } else {
323  "photoCalib", mapper);
324  }
325 
326  auto schema = mapper.finalize();
328  table->setMetadata(metadata);
329  return table;
330  }
331 
332  bool usesArchive(int ioFlags) const override { return true; }
333 };
334 
335 static ExposureFitsReader const exposureFitsReader;
336 
337 } // namespace
338 
339 //-----------------------------------------------------------------------------------------------------------
340 //----- ExposureTable/Record member function implementations -----------------------------------------------
341 //-----------------------------------------------------------------------------------------------------------
342 
345 }
346 
348 
349 bool ExposureRecord::contains(lsst::geom::SpherePoint const &coord, bool includeValidPolygon) const {
350  if (!getWcs()) {
352  "ExposureRecord does not have a Wcs; cannot call contains()");
353  }
354 
355  // If there is no valid polygon set to false
356  if (includeValidPolygon && !getValidPolygon()) {
357  includeValidPolygon = false;
358  }
359 
360  try {
361  lsst::geom::Point2D point = getWcs()->skyToPixel(coord);
362  if (includeValidPolygon)
363  return (lsst::geom::Box2D(getBBox()).contains(point) && getValidPolygon()->contains(point));
364  else
365  return lsst::geom::Box2D(getBBox()).contains(point);
366  } catch (pex::exceptions::DomainError &) {
367  // SkyWcs can throw if the given coordinate is outside the region where the WCS is valid.
368  return false;
369  }
370 }
371 
372 bool ExposureRecord::contains(lsst::geom::Point2D const &point, geom::SkyWcs const &wcs,
373  bool includeValidPolygon) const {
374  return contains(wcs.pixelToSky(point), includeValidPolygon);
375 }
376 
378 
380  try {
381  ExposureRecord const &s = dynamic_cast<ExposureRecord const &>(other);
382  _psf = s._psf;
383  _wcs = s._wcs;
384  _photoCalib = s._photoCalib;
385  _apCorrMap = s._apCorrMap;
386  _validPolygon = s._validPolygon;
387  _visitInfo = s._visitInfo;
388  _transmissionCurve = s._transmissionCurve;
389  _detector = s._detector;
390  } catch (std::bad_cast &) {
391  }
392 }
393 
395  if (!checkSchema(schema)) {
396  throw LSST_EXCEPT(
398  "Schema for Exposure must contain at least the keys defined by makeMinimalSchema().");
399  }
401 }
402 
404 
405 ExposureTable::ExposureTable(ExposureTable const &other) = default;
406 // Delegate to copy-constructor for backward compatibility
408 
410 
411 ExposureTable::MinimalSchema::MinimalSchema() {
412  id = schema.addField<RecordId>("id", "unique ID");
413  bbox = Box2IKey::addFields(schema, "bbox", "bounding box", "pixel");
414 }
415 
416 ExposureTable::MinimalSchema &ExposureTable::getMinimalSchema() {
417  static MinimalSchema it;
418  return it;
419 }
420 
421 std::shared_ptr<io::FitsWriter> ExposureTable::makeFitsWriter(fits::Fits *fitsfile, int flags) const {
422  return std::make_shared<ExposureFitsWriter>(fitsfile, std::shared_ptr<io::OutputArchive>(), flags);
423 }
424 
425 std::shared_ptr<io::FitsWriter> ExposureTable::makeFitsWriter(fits::Fits *fitsfile,
427  int flags) const {
428  return std::make_shared<ExposureFitsWriter>(fitsfile, archive, flags);
429 }
430 
433 }
434 
436  return constructRecord<ExposureRecord>();
437 }
438 
439 //-----------------------------------------------------------------------------------------------------------
440 //----- ExposureCatalogT member function implementations ----------------------------------------------------
441 //-----------------------------------------------------------------------------------------------------------
442 
443 template <typename RecordT>
445  PersistenceHelper helper{};
446  SchemaMapper mapper = helper.makeWriteMapper(this->getSchema());
447  BaseCatalog outputCat = handle.makeCatalog(mapper.getOutputSchema());
448  outputCat.reserve(this->size());
449  for (const_iterator i = this->begin(); i != this->end(); ++i) {
450  helper.writeRecord(*i, *outputCat.addNew(), mapper, handle, permissive);
451  }
452  handle.saveCatalog(outputCat);
453 }
454 
455 template <typename RecordT>
457  BaseCatalog const &catalog) {
458  // Helper constructor will infer which components are available
459  // (effectively the version, but more flexible).
460  PersistenceHelper helper{catalog.getSchema()};
461  SchemaMapper mapper = helper.makeReadMapper(catalog.getSchema());
463  result.reserve(catalog.size());
464  for (BaseCatalog::const_iterator i = catalog.begin(); i != catalog.end(); ++i) {
465  helper.readRecord(*i, *result.addNew(), mapper, archive);
466  }
467  return result;
468 }
469 
470 template <typename RecordT>
472  bool includeValidPolygon) const {
473  ExposureCatalogT result(this->getTable());
474  for (const_iterator i = this->begin(); i != this->end(); ++i) {
475  if (i->contains(coord, includeValidPolygon)) {
476  result.push_back(i);
477  }
478  }
479  return result;
480 }
481 
482 template <typename RecordT>
484  geom::SkyWcs const &wcs,
485  bool includeValidPolygon) const {
486  ExposureCatalogT result(this->getTable());
487  for (const_iterator i = this->begin(); i != this->end(); ++i) {
488  if (i->contains(point, wcs, includeValidPolygon)) {
489  result.push_back(i);
490  }
491  }
492  return result;
493 }
494 
495 //-----------------------------------------------------------------------------------------------------------
496 //----- Explicit instantiation ------------------------------------------------------------------------------
497 //-----------------------------------------------------------------------------------------------------------
498 
499 template class CatalogT<ExposureRecord>;
500 template class CatalogT<ExposureRecord const>;
501 
502 template class SortedCatalogT<ExposureRecord>;
504 
505 template class ExposureCatalogT<ExposureRecord>;
507 } // namespace table
508 } // namespace afw
509 } // namespace lsst
py::object result
Definition: _schema.cc:429
table::Key< std::string > name
Definition: Amplifier.cc:116
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
int end
table::Key< int > id
Definition: Detector.cc:162
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
Fits * fits
Definition: FitsWriter.cc:90
Implementation of the Photometric Calibration class.
SchemaMapper * mapper
Definition: SchemaMapper.cc:71
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:297
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
Definition: ApCorrMap.h:45
The photometric calibration of an exposure.
Definition: PhotoCalib.h:114
A spatially-varying transmission curve as a function of wavelength.
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:68
Base class for all records.
Definition: BaseRecord.h:31
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
Definition: BaseRecord.h:164
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
Definition: BaseRecord.h:151
Base class for all tables.
Definition: BaseTable.h:61
static std::shared_ptr< BaseTable > make(Schema const &schema)
Construct a new table.
Definition: BaseTable.cc:120
static BoxKey addFields(Schema &schema, std::string const &name, std::string const &doc, std::string const &unit)
Add _min_x, _min_y, _max_x, _max_y fields to a Schema, and return a BoxKey that points to them.
Definition: aggregates.cc:60
Iterator class for CatalogT.
Definition: Catalog.h:40
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
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:413
iterator begin()
Iterator access.
Definition: Catalog.h:401
void reserve(size_type n)
Increase the capacity of the catalog to the given size.
Definition: Catalog.h:433
Schema getSchema() const
Return the schema associated with the catalog's table.
Definition: Catalog.h:118
Custom catalog class for ExposureRecord/Table.
Definition: Exposure.h:311
static ExposureCatalogT readFromArchive(io::InputArchive const &archive, BaseCatalog const &catalog)
Convenience input function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:456
void writeToArchive(io::OutputArchiveHandle &handle, bool ignoreUnpersistable=true) const
Convenience output function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:444
ExposureCatalogT subsetContaining(lsst::geom::SpherePoint const &coord, bool includeValidPolygon=false) const
Return a shallow subset of the catalog with only those records that contain the given point.
Definition: Exposure.cc:471
Record class used to store exposure metadata.
Definition: Exposure.h:79
bool contains(lsst::geom::SpherePoint const &coord, bool includeValidPolygon=false) const
Return true if the bounding box contains the given celestial coordinate point, taking into account th...
Definition: Exposure.cc:349
std::shared_ptr< geom::SkyWcs const > getWcs() const
Get/Set the the attached Wcs, Psf, PhotoCalib, or ApCorrMap. No copies are made.
Definition: Exposure.h:136
std::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Definition: Exposure.h:148
lsst::geom::Box2I getBBox() const
Definition: Exposure.cc:343
void setTransmissionCurve(std::shared_ptr< image::TransmissionCurve const > transmissionCurve)
Definition: Exposure.h:157
void setBBox(lsst::geom::Box2I const &bbox)
Definition: Exposure.cc:347
void _assign(BaseRecord const &other) override
Called by assign() after transferring fields to allow subclass data members to be copied.
Definition: Exposure.cc:379
Table class used to store exposure metadata.
Definition: Exposure.h:195
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
Definition: Exposure.cc:435
static Box2IKey getBBoxKey()
Key for the full bbox.
Definition: Exposure.h:243
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid ExposureTable schema.
Definition: Exposure.h:228
ExposureTable(Schema const &schema)
Definition: Exposure.cc:403
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
Definition: Exposure.cc:431
static std::shared_ptr< ExposureTable > make(Schema const &schema)
Construct a new table.
Definition: Exposure.cc:394
bool isValid() const noexcept
Return true if the key was initialized to valid offset.
Definition: Key.h:97
static void setup(std::string const &name, io::FitsSchemaInputMapper &mapper)
Definition: Exposure.cc:257
void readCell(BaseRecord &record, std::size_t row, fits::Fits &fits, std::shared_ptr< io::InputArchive > const &archive) const override
Read values from a single row.
Definition: Exposure.cc:270
Defines the fields and offsets for a table.
Definition: Schema.h:51
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
Definition: Schema.cc:479
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:21
Schema const getOutputSchema() const
Return the output schema (copy-on-write).
Definition: SchemaMapper.h:27
static SchemaMapper removeMinimalSchema(Schema const &input, Schema const &minimal)
Create a mapper by removing fields from the front of a schema.
static std::vector< SchemaMapper > join(std::vector< Schema > const &inputs, std::vector< std::string > const &prefixes=std::vector< std::string >())
Combine a sequence of schemas into one, creating a SchemaMapper for each.
Custom catalog class for record/table subclasses that are guaranteed to have an ID,...
Definition: SortedCatalog.h:42
Polymorphic reader interface used to read different kinds of objects from one or more FITS binary tab...
A class that describes a mapping from a FITS binary table to an afw::table Schema.
virtual void _writeRecord(BaseRecord const &source)
Write an individual record.
Definition: FitsWriter.cc:189
virtual void _writeTable(std::shared_ptr< BaseTable const > const &table, std::size_t nRows)
Write a table and its schema.
Definition: FitsWriter.cc:103
A multi-catalog archive object used to load table::io::Persistable objects.
Definition: InputArchive.h:31
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.
A floating-point coordinate rectangle geometry.
Definition: Box.h:413
bool contains(Point2D const &point) const noexcept
Return true if the box contains the point.
Definition: Box.cc:322
An integer coordinate rectangle.
Definition: Box.h:55
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:57
Reports arguments outside the domain of an operation.
Definition: Runtime.h:57
Reports invalid arguments.
Definition: Runtime.h:66
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
T get(T... args)
T move(T... args)
FilterProperty & operator=(FilterProperty const &)=default
A base class for image defects.
T push_back(T... args)
int row
Definition: CR.cc:145
Schema schema
Definition: Exposure.cc:63
bool _doWriteArchive
Definition: Exposure.cc:216
std::shared_ptr< BaseRecord > _record
Definition: Exposure.cc:218
Key< int > psf
Definition: Exposure.cc:65
Key< int > visitInfo
Definition: Exposure.cc:70
Key< int > validPolygon
Definition: Exposure.cc:69
Key< int > wcs
Definition: Exposure.cc:64
Key< int > photoCalib
Definition: Exposure.cc:67
Key< int > transmissionCurve
Definition: Exposure.cc:71
std::shared_ptr< io::OutputArchive > _archive
Definition: Exposure.cc:217
Key< int > calib
Definition: Exposure.cc:66
Key< int > detector
Definition: Exposure.cc:72
SchemaMapper _mapper
Definition: Exposure.cc:220
Key< int > apCorrMap
Definition: Exposure.cc:68
PersistenceHelper _helper
Definition: Exposure.cc:219