LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
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());
230  std::shared_ptr<BaseTable> outTable = BaseTable::make(_mapper.getOutputSchema());
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 
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) {
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  }
400  return std::shared_ptr<ExposureTable>(new ExposureTable(schema));
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
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
Defines the fields and offsets for a table.
Definition: Schema.h:50
bool _doWriteArchive
Definition: Exposure.cc:216
A spatially-varying transmission curve as a function of wavelength.
Key< int > visitInfo
Definition: Exposure.cc:70
A utility class for reading FITS binary tables.
Definition: FitsReader.h:34
Schema schema
Definition: Exposure.cc:63
A floating-point coordinate rectangle geometry.
Definition: Box.h:413
An object passed to Persistable::write to allow it to persist itself.
The photometric calibration of an exposure.
Definition: PhotoCalib.h:114
Table class used to store exposure metadata.
Definition: Exposure.h:195
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
Definition: Exposure.cc:431
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
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
Definition: ApCorrMap.h:45
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
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:21
Schema getSchema() const
Return the table&#39;s schema.
Definition: BaseTable.h:137
static void setup(std::string const &name, io::FitsSchemaInputMapper &mapper)
Definition: Exposure.cc:257
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:68
static Box2IKey getBBoxKey()
Key for the full bbox.
Definition: Exposure.h:243
Schema const getOutputSchema() const
Return the output schema (copy-on-write).
Definition: SchemaMapper.h:27
void readTableScalar(std::size_t row, int col, T &value)
Read an array scalar from a binary table.
Definition: fits.h:595
ExposureTable(Schema const &schema)
Definition: Exposure.cc:403
std::shared_ptr< BaseRecord > _record
Definition: Exposure.cc:218
Reports arguments outside the domain of an operation.
Definition: Runtime.h:57
Key< int > photoCalib
Definition: Exposure.cc:67
A class that describes a mapping from a FITS binary table to an afw::table Schema.
table::Key< int > id
Definition: Detector.cc:162
Schema getSchema() const
Return the schema associated with the catalog&#39;s table.
Definition: Catalog.h:117
ItemVariant const * other
Definition: Schema.cc:56
SchemaMapper * mapper
Definition: SchemaMapper.cc:78
STL class.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:297
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
Definition: Exposure.cc:435
void setBBox(lsst::geom::Box2I const &bbox)
Definition: Exposure.cc:347
Key< int > validPolygon
Definition: Exposure.cc:69
Fits * fits
Definition: FitsWriter.cc:90
STL class.
T push_back(T... args)
static SchemaMapper removeMinimalSchema(Schema const &input, Schema const &minimal)
Create a mapper by removing fields from the front of a schema.
void push_back(Record const &r)
Add a copy of the given record to the end of the catalog.
Definition: Catalog.h:476
PersistenceHelper _helper
Definition: Exposure.cc:219
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.
A base class for image defects.
Key< int > wcs
Definition: Exposure.cc:64
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Definition: fwd.h:63
iterator end()
Iterator access.
Definition: Catalog.h:397
Iterator class for CatalogT.
Definition: Catalog.h:38
Key< int > transmissionCurve
Definition: Exposure.cc:71
Key< U > key
Definition: Schema.cc:281
SchemaMapper _mapper
Definition: Exposure.cc:220
T dynamic_pointer_cast(T... args)
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
T move(T... args)
virtual void _writeTable(std::shared_ptr< BaseTable const > const &table, std::size_t nRows)
Write a table and its schema.
Definition: FitsWriter.cc:103
std::shared_ptr< io::OutputArchive > _archive
Definition: Exposure.cc:217
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
Key< int > calib
Definition: Exposure.cc:66
T get(T... args)
void reserve(size_type n)
Increase the capacity of the catalog to the given size.
Definition: Catalog.h:428
Key< int > apCorrMap
Definition: Exposure.cc:68
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
STL class.
static std::shared_ptr< ExposureTable > make(Schema const &schema)
Construct a new table.
Definition: Exposure.cc:394
STL class.
Base class for all records.
Definition: BaseRecord.h:31
static std::shared_ptr< BaseTable > make(Schema const &schema)
Construct a new table.
Definition: BaseTable.cc:121
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:57
Schema finalize()
Map any remaining items into regular Schema items, and return the final Schema.
static ExposureCatalogT readFromArchive(io::InputArchive const &archive, BaseCatalog const &catalog)
Convenience input function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:456
Custom catalog class for ExposureRecord/Table.
Definition: Exposure.h:67
void writeToArchive(io::OutputArchiveHandle &handle, bool ignoreUnpersistable=true) const
Convenience output function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:444
void setTransmissionCurve(std::shared_ptr< image::TransmissionCurve const > transmissionCurve)
Get/Set the the attached Wcs, Psf, PhotoCalib, or ApCorrMap. No copies are made.
Definition: Exposure.h:157
virtual void _writeRecord(BaseRecord const &source)
Write an individual record.
Definition: FitsWriter.cc:189
Reports invalid arguments.
Definition: Runtime.h:66
void erase(Item const *item)
Remove the given item (which should have been retrieved via find()) from the mapping, preventing it from being included in the regular fields added by finalize().
Record class used to store exposure metadata.
Definition: Exposure.h:79
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:408
Key< int > detector
Definition: Exposure.cc:72
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
void customize(std::unique_ptr< FitsColumnReader > reader)
Customize a mapping by providing a FitsColumnReader instance that will be invoked by readRecords()...
A multi-catalog archive object used to load table::io::Persistable objects.
Definition: InputArchive.h:31
Polymorphic reader interface used to read different kinds of objects from one or more FITS binary tab...
bool hasArchive() const
Return true if the mapper has an InputArchive.
iterator begin()
Iterator access.
Definition: Catalog.h:396
Item const * find(std::string const &ttype) const
Find an item with the given column name (ttype), returning nullptr if no such column exists...
void _assign(BaseRecord const &other) override
Called by assign() after transferring fields to allow subclass data members to be copied...
Definition: Exposure.cc:379
Key< int > psf
Definition: Exposure.cc:65
An integer coordinate rectangle.
Definition: Box.h:55
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
py::object result
Definition: _schema.cc:429
lsst::geom::Box2I getBBox() const
Definition: Exposure.cc:343
Implementation of the Photometric Calibration class.
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
int end
Base class for all tables.
Definition: BaseTable.h:61
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
int row
Definition: CR.cc:145