LSSTApplications  20.0.0
LSSTDataManagementBasePackage
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 
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
lsst::afw::table::CatalogT::end
iterator end()
Definition: Catalog.h:397
lsst::afw::table::ExposureRecord::getBBox
lsst::geom::Box2I getBBox() const
Definition: Exposure.cc:343
lsst::afw::table::ExposureTable::getBBoxKey
static Box2IKey getBBoxKey()
Key for the full bbox.
Definition: Exposure.h:243
schema
Schema schema
Definition: Exposure.cc:63
std::string
STL class.
std::shared_ptr
STL class.
lsst::afw::table::Schema::addField
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:668
lsst::afw::table::io::FitsWriter::_writeRecord
virtual void _writeRecord(BaseRecord const &source)
Write an individual record.
Definition: FitsWriter.cc:189
Psf.h
lsst::afw::table::ExposureTable
Table class used to store exposure metadata.
Definition: Exposure.h:195
std::move
T move(T... args)
lsst::afw::table::BaseRecord::get
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
Definition: BaseRecord.h:151
TransmissionCurve.h
detector
Key< int > detector
Definition: Exposure.cc:72
lsst::afw::table::io::OutputArchiveHandle
An object passed to Persistable::write to allow it to persist itself.
Definition: OutputArchive.h:118
lsst::afw::fits::Fits
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:297
lsst::afw::table::io::FitsSchemaInputMapper
A class that describes a mapping from a FITS binary table to an afw::table Schema.
Definition: FitsSchemaInputMapper.h:91
std::vector
STL class.
transmissionCurve
Key< int > transmissionCurve
Definition: Exposure.cc:71
lsst::geom::Box2D::contains
bool contains(Point2D const &point) const noexcept
Return true if the box contains the point.
Definition: Box.cc:322
psf
Key< int > psf
Definition: Exposure.cc:65
lsst::afw::table::ExposureTable::_clone
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
Definition: Exposure.cc:431
lsst::afw::table::io::OutputArchiveHandle::saveCatalog
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
Definition: OutputArchive.cc:211
lsst::afw::table::ExposureCatalogT
Custom catalog class for ExposureRecord/Table.
Definition: Exposure.h:67
lsst::afw
Definition: imageAlgorithm.dox:1
lsst::afw::table::io::InputArchive
A multi-catalog archive object used to load table::io::Persistable objects.
Definition: InputArchive.h:31
validPolygon
Key< int > validPolygon
Definition: Exposure.cc:69
std::shared_ptr::get
T get(T... args)
lsst::afw::table::ExposureRecord::setBBox
void setBBox(lsst::geom::Box2I const &bbox)
Definition: Exposure.cc:347
SkyWcs.h
lsst::afw::table::PersistableObjectColumnReader::readCell
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
_archive
std::shared_ptr< io::OutputArchive > _archive
Definition: Exposure.cc:217
lsst::afw::table::Schema
Defines the fields and offsets for a table.
Definition: Schema.h:50
_record
std::shared_ptr< BaseRecord > _record
Definition: Exposure.cc:218
lsst::afw::geom.transform.transformContinued.name
string name
Definition: transformContinued.py:32
lsst::afw::table::PersistableObjectColumnReader::PersistableObjectColumnReader
PersistableObjectColumnReader(int column)
Definition: Exposure.cc:268
lsst::afw::table::ExposureCatalogT::readFromArchive
static ExposureCatalogT readFromArchive(io::InputArchive const &archive, BaseCatalog const &catalog)
Convenience input function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:456
lsst::afw::table::BaseTable
Base class for all tables.
Definition: BaseTable.h:61
lsst::afw::table::ExposureRecord::contains
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
lsst::afw::table::ExposureTable::_makeRecord
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
Definition: Exposure.cc:435
end
int end
Definition: BoundedField.cc:105
lsst::afw::table::CatalogT::reserve
void reserve(size_type n)
Increase the capacity of the catalog to the given size.
Definition: Catalog.h:428
std::bad_cast
STL class.
lsst::afw::table::BoxKey< lsst::geom::Box2I >::addFields
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
std::vector::push_back
T push_back(T... args)
lsst::afw::table::io::OutputArchiveHandle::makeCatalog
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
Definition: OutputArchive.cc:207
PropertyList.h
lsst::afw::table::CatalogT::size
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:408
fits
Fits * fits
Definition: FitsWriter.cc:90
calib
Key< int > calib
Definition: Exposure.cc:66
lsst::pex::exceptions::DomainError
Reports arguments outside the domain of an operation.
Definition: Runtime.h:57
lsst::afw::table::BaseTable::makeRecord
std::shared_ptr< BaseRecord > makeRecord()
Default-construct an associated record.
Definition: BaseTable.h:108
lsst::afw::image::VisitInfo
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:68
id
table::Key< int > id
Definition: Detector.cc:162
other
ItemVariant const * other
Definition: Schema.cc:56
lsst::afw::table::BaseRecord
Base class for all records.
Definition: BaseRecord.h:31
PropertySet.h
lsst::afw::table::ExposureRecord::~ExposureRecord
~ExposureRecord() override
lsst::pex::exceptions::LogicError
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
lsst::afw::table::SchemaMapper
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:21
lsst::afw::table::CatalogT::getSchema
Schema getSchema() const
Return the schema associated with the catalog's table.
Definition: Catalog.h:117
lsst::afw::table::ExposureTable::checkSchema
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid ExposureTable schema.
Definition: Exposure.h:228
lsst::afw::table::Key::isValid
bool isValid() const noexcept
Return true if the key was initialized to valid offset.
Definition: Key.h:97
lsst::afw::table::CatalogIterator
Iterator class for CatalogT.
Definition: Catalog.h:39
lsst::afw::table::io::FitsColumnReader
Polymorphic reader interface used to read different kinds of objects from one or more FITS binary tab...
Definition: FitsSchemaInputMapper.h:20
lsst::afw::image::PhotoCalib
The photometric calibration of an exposure.
Definition: PhotoCalib.h:114
std::int64_t
lsst::afw::table::BaseTable::getSchema
Schema getSchema() const
Return the table's schema.
Definition: BaseTable.h:137
result
py::object result
Definition: _schema.cc:429
lsst::afw::table::BaseTable::setMetadata
void setMetadata(std::shared_ptr< daf::base::PropertyList > const &metadata)
Set the flexible metadata associated with the table. May be null.
Definition: BaseTable.h:82
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
LSST_EXCEPT
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
lsst::afw::table::PersistableObjectColumnReader
Definition: Exposure.cc:255
Polygon.h
lsst::afw::image::TransmissionCurve
A spatially-varying transmission curve as a function of wavelength.
Definition: TransmissionCurve.h:61
photoCalib
Key< int > photoCalib
Definition: Exposure.cc:67
lsst::afw::table::SchemaMapper::removeMinimalSchema
static SchemaMapper removeMinimalSchema(Schema const &input, Schema const &minimal)
Create a mapper by removing fields from the front of a schema.
Definition: SchemaMapper.cc:195
lsst::afw::table::io::FitsWriter::_writeTable
virtual void _writeTable(std::shared_ptr< BaseTable const > const &table, std::size_t nRows)
Write a table and its schema.
Definition: FitsWriter.cc:103
lsst::afw::table::ExposureTable::ExposureTable
ExposureTable(Schema const &schema)
Definition: Exposure.cc:403
lsst::afw::table::SchemaMapper::join
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.
Definition: SchemaMapper.cc:222
lsst::afw::table::ExposureRecord::setTransmissionCurve
void setTransmissionCurve(std::shared_ptr< image::TransmissionCurve const > transmissionCurve)
Definition: Exposure.h:157
lsst::pex::exceptions::InvalidParameterError
Reports invalid arguments.
Definition: Runtime.h:66
PhotoCalib.h
Implementation of the Photometric Calibration class.
row
int row
Definition: CR.cc:145
_helper
PersistenceHelper _helper
Definition: Exposure.cc:219
key
Key< U > key
Definition: Schema.cc:281
lsst::geom::Point< double, 2 >
lsst::afw::table::ExposureCatalogT::subsetContaining
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
lsst::afw::table::ExposureCatalogT::writeToArchive
void writeToArchive(io::OutputArchiveHandle &handle, bool ignoreUnpersistable=true) const
Convenience output function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:444
lsst::afw::table::SchemaMapper::getOutputSchema
Schema const getOutputSchema() const
Return the output schema (copy-on-write).
Definition: SchemaMapper.h:27
lsst::afw::table::PersistableObjectColumnReader::setup
static void setup(std::string const &name, io::FitsSchemaInputMapper &mapper)
Definition: Exposure.cc:257
lsst::geom::Box2I
An integer coordinate rectangle.
Definition: Box.h:55
mapper
SchemaMapper * mapper
Definition: SchemaMapper.cc:78
lsst::afw::table::ExposureRecord
Record class used to store exposure metadata.
Definition: Exposure.h:79
lsst::afw::table::BaseTable::getMetadata
std::shared_ptr< daf::base::PropertyList > getMetadata() const
Return the flexible metadata associated with the table. May be null.
Definition: BaseTable.h:79
ApCorrMap.h
_doWriteArchive
bool _doWriteArchive
Definition: Exposure.cc:216
InputArchive.h
std::size_t
wcs
Key< int > wcs
Definition: Exposure.cc:64
lsst::afw::table::ExposureTable::~ExposureTable
~ExposureTable() override
FitsWriter.h
lsst::geom::SpherePoint
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:57
lsst::afw::table::CatalogT::addNew
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
lsst::afw::table::BaseRecord::set
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
Definition: BaseRecord.h:164
lsst::geom::Box2D
A floating-point coordinate rectangle geometry.
Definition: Box.h:413
lsst::afw::image::ApCorrMap
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
Definition: ApCorrMap.h:45
lsst::afw::table::CatalogT::begin
iterator begin()
Iterator access.
Definition: Catalog.h:396
lsst::afw::table::BaseTable::make
static std::shared_ptr< BaseTable > make(Schema const &schema)
Construct a new table.
Definition: BaseTable.cc:121
Exposure.h
lsst::afw::table::ExposureTable::make
static std::shared_ptr< ExposureTable > make(Schema const &schema)
Construct a new table.
Definition: Exposure.cc:394
_mapper
SchemaMapper _mapper
Definition: Exposure.cc:220
std::unique_ptr
STL class.
lsst::afw::table::ExposureRecord::getValidPolygon
std::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Definition: Exposure.h:148
lsst::afw::table::CatalogT< BaseRecord >
lsst::afw::table::ExposureRecord::_assign
void _assign(BaseRecord const &other) override
Called by assign() after transferring fields to allow subclass data members to be copied.
Definition: Exposure.cc:379
lsst::afw::table::ExposureRecord::getWcs
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
Access.h
lsst::afw::table::SortedCatalogT
Custom catalog class for record/table subclasses that are guaranteed to have an ID,...
Definition: fwd.h:63
Detector.h
OutputArchive.h
visitInfo
Key< int > visitInfo
Definition: Exposure.cc:70
exceptions.h
bbox
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
apCorrMap
Key< int > apCorrMap
Definition: Exposure.cc:68
VisitInfo.h