lsst.afw  15.0-24-g02ed2a30c+2
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"
15 #include "lsst/afw/image/Calib.h"
17 #include "lsst/afw/detection/Psf.h"
21 
22 namespace lsst {
23 namespace afw {
24 namespace table {
25 
26 //-----------------------------------------------------------------------------------------------------------
27 //----- Private ExposureTable/Record classes ---------------------------------------------------------------
28 //-----------------------------------------------------------------------------------------------------------
29 
30 // These private derived classes are what you actually get when you do ExposureTable::make; like the
31 // private classes in BaseTable.cc, it's more convenient to have an extra set of trivial derived
32 // classes than to do a lot of friending.
33 
34 namespace {
35 
36 int const EXPOSURE_TABLE_CURRENT_VERSION = 3; // current version of ExposureTable
37 std::string const EXPOSURE_TABLE_VERSION_KEY = "EXPTABLE_VER"; // FITS header key for ExposureTable version
38 
39 // Field names used to store the archive IDs of different components (used in
40 // multiple places, so we define them here instead of as multiple string
41 // literals).
42 std::string const WCS_FIELD_NAME = "wcs";
43 std::string const PSF_FIELD_NAME = "psf";
44 std::string const CALIB_FIELD_NAME = "calib";
45 std::string const VISIT_INFO_FIELD_NAME = "visitInfo";
46 std::string const AP_CORR_MAP_FIELD_NAME = "apCorrMap";
47 std::string const VALID_POLYGON_FIELD_NAME = "validPolygon";
48 std::string const TRANSMISSION_CURVE_FIELD_NAME = "transmissionCurve";
49 
50 
51 int getTableVersion(daf::base::PropertySet &metadata) {
52  return metadata.exists(EXPOSURE_TABLE_VERSION_KEY) ? metadata.get<int>(EXPOSURE_TABLE_VERSION_KEY) : 1;
53 }
54 
60 struct PersistenceHelper {
61  Schema schema;
62  Key<int> wcs;
63  Key<int> psf;
64  Key<int> calib;
65  Key<int> apCorrMap;
66  Key<int> validPolygon;
67  Key<int> visitInfo;
69 
70  // Create a SchemaMapper that maps an ExposureRecord to a BaseRecord with IDs for Wcs, Psf, etc.
71  SchemaMapper makeWriteMapper(Schema const &inputSchema) const {
72  std::vector<Schema> inSchemas;
73  inSchemas.push_back(PersistenceHelper().schema);
74  inSchemas.push_back(inputSchema);
75  // don't need front; it's an identity mapper
76  SchemaMapper result = SchemaMapper::join(inSchemas).back();
77  result.editOutputSchema().setAliasMap(inputSchema.getAliasMap());
78  return result;
79  }
80 
81  // Create a SchemaMapper that maps a BaseRecord to an ExposureRecord with IDs for WCS, Psf, etc.
82  SchemaMapper makeReadMapper(Schema const &inputSchema) const {
83  SchemaMapper result = SchemaMapper::removeMinimalSchema(inputSchema, schema);
84  result.editOutputSchema().setAliasMap(inputSchema.getAliasMap());
85  return result;
86  }
87 
88  // Write psf, wcs, etc. from an ExposureRecord to an archive
89  template <typename OutputArchiveIsh>
90  void writeRecord(ExposureRecord const &input, BaseRecord &output, SchemaMapper const &mapper,
91  OutputArchiveIsh &archive, bool permissive) const {
92  output.assign(input, mapper);
93  output.set(psf, archive.put(input.getPsf(), permissive));
94  output.set(wcs, archive.put(input.getWcs(), permissive));
95  output.set(calib, archive.put(input.getCalib(), permissive));
96  output.set(apCorrMap, archive.put(input.getApCorrMap(), permissive));
97  output.set(validPolygon, archive.put(input.getValidPolygon(), permissive));
98  output.set(visitInfo, archive.put(input.getVisitInfo(), permissive));
99  output.set(transmissionCurve, archive.put(input.getTransmissionCurve(), permissive));
100  }
101 
102  // Read psf, wcs, etc. from an archive to an ExposureRecord
103  void readRecord(BaseRecord const &input, ExposureRecord &output, SchemaMapper const &mapper,
104  io::InputArchive const &archive) const {
105  output.assign(input, mapper);
106  if (psf.isValid()) {
107  output.setPsf(archive.get<detection::Psf>(input.get(psf)));
108  }
109  if (wcs.isValid()) {
110  output.setWcs(archive.get<geom::SkyWcs>(input.get(wcs)));
111  }
112  if (calib.isValid()) {
113  output.setCalib(archive.get<image::Calib>(input.get(calib)));
114  }
115  if (apCorrMap.isValid()) {
116  output.setApCorrMap(archive.get<image::ApCorrMap>(input.get(apCorrMap)));
117  }
118  if (validPolygon.isValid()) {
119  output.setValidPolygon(archive.get<geom::polygon::Polygon>(input.get(validPolygon)));
120  }
121  if (visitInfo.isValid()) {
122  output.setVisitInfo(archive.get<image::VisitInfo>(input.get(visitInfo)));
123  }
124  if (transmissionCurve.isValid()) {
125  output.setTransmissionCurve(archive.get<image::TransmissionCurve>(input.get(transmissionCurve)));
126  }
127  }
128 
129  // No copying
130  PersistenceHelper(const PersistenceHelper &) = delete;
131  PersistenceHelper &operator=(const PersistenceHelper &) = delete;
132 
133  // No moving
134  PersistenceHelper(PersistenceHelper &&) = delete;
135  PersistenceHelper &operator=(PersistenceHelper &&) = delete;
136 
137  // Construct a PersistenceHelper using the most modern schema.
138  PersistenceHelper()
139  : schema(),
140  wcs(schema.addField<int>(WCS_FIELD_NAME, "archive ID for Wcs object")),
141  psf(schema.addField<int>(PSF_FIELD_NAME, "archive ID for Psf object")),
142  calib(schema.addField<int>(CALIB_FIELD_NAME, "archive ID for Calib object")),
143  apCorrMap(schema.addField<int>(AP_CORR_MAP_FIELD_NAME, "archive ID for ApCorrMap object")),
144  validPolygon(schema.addField<int>(VALID_POLYGON_FIELD_NAME, "archive ID for Polygon object")),
145  visitInfo(schema.addField<int>(VISIT_INFO_FIELD_NAME, "archive ID for VisitInfo object")),
146  transmissionCurve(schema.addField<int>(TRANSMISSION_CURVE_FIELD_NAME,
147  "archive ID for TransmissionCurve object")) {}
148 
149  // Add a field to this->schema, saving its key in 'key', if and only if 'name' is a field in 'oldSchema'
150  void addIfPresent(Schema const &oldSchema, Key<int> &key, std::string const &name) {
151  try {
152  auto item = oldSchema.find<int>(name);
153  key = schema.addField(item.field);
154  } catch (pex::exceptions::NotFoundError &) {
155  }
156  }
157 
158  // Construct a PersistenceHelper from a possibly old on-disk schema
159  PersistenceHelper(Schema const &oldSchema) {
160  addIfPresent(oldSchema, wcs, WCS_FIELD_NAME);
161  addIfPresent(oldSchema, psf, PSF_FIELD_NAME);
162  addIfPresent(oldSchema, calib, CALIB_FIELD_NAME);
163  addIfPresent(oldSchema, apCorrMap, AP_CORR_MAP_FIELD_NAME);
164  addIfPresent(oldSchema, validPolygon, VALID_POLYGON_FIELD_NAME);
165  addIfPresent(oldSchema, visitInfo, VISIT_INFO_FIELD_NAME);
166  addIfPresent(oldSchema, transmissionCurve, TRANSMISSION_CURVE_FIELD_NAME);
167  assert(oldSchema.contains(schema));
168  }
169 };
170 
171 } // anonymous
172 
173 //-----------------------------------------------------------------------------------------------------------
174 //----- ExposureFitsWriter ---------------------------------------------------------------------------------
175 //-----------------------------------------------------------------------------------------------------------
176 
177 // A custom FitsWriter for Exposure - this sets the AFW_TYPE key to EXPOSURE, which should ensure
178 // we use ExposureFitsReader to read it, and sets EXPOSURE_TABLE_VERSION_KEY to the current version:
179 // EXPOSURE_TABLE_CURRENT_VERSION
180 
181 namespace {
182 
183 class ExposureFitsWriter : public io::FitsWriter {
184 public:
185  ExposureFitsWriter(Fits *fits, std::shared_ptr<io::OutputArchive> archive, int flags)
186  : io::FitsWriter(fits, flags), _doWriteArchive(false), _archive(archive), _helper() {
187  if (!_archive) {
188  _doWriteArchive = true;
189  _archive.reset(new io::OutputArchive());
190  }
191  }
192 
193 protected:
194  virtual void _writeTable(std::shared_ptr<BaseTable const> const &table, std::size_t nRows);
195 
196  virtual void _writeRecord(BaseRecord const &r);
197 
198  virtual void _finish() {
199  if (_doWriteArchive) _archive->writeFits(*_fits);
200  }
201 
205  PersistenceHelper _helper;
206  SchemaMapper _mapper;
207 };
208 
209 void ExposureFitsWriter::_writeTable(std::shared_ptr<BaseTable const> const &t, std::size_t nRows) {
210  std::shared_ptr<ExposureTable const> inTable = std::dynamic_pointer_cast<ExposureTable const>(t);
211  if (!inTable) {
213  "Cannot use a ExposureFitsWriter on a non-Exposure table.");
214  }
215  _mapper = _helper.makeWriteMapper(inTable->getSchema());
216  std::shared_ptr<BaseTable> outTable = BaseTable::make(_mapper.getOutputSchema());
217  io::FitsWriter::_writeTable(outTable, nRows);
218  _fits->writeKey("AFW_TYPE", "EXPOSURE", "Tells lsst::afw to load this as an Exposure table.");
219  _fits->writeKey(EXPOSURE_TABLE_VERSION_KEY, EXPOSURE_TABLE_CURRENT_VERSION, "Exposure table version");
220  _record = outTable->makeRecord();
221 }
222 
223 void ExposureFitsWriter::_writeRecord(BaseRecord const &r) {
224  ExposureRecord const &record = static_cast<ExposureRecord const &>(r);
225  _helper.writeRecord(record, *_record, _mapper, *_archive, false);
227 }
228 
229 } // anonymous
230 
231 //-----------------------------------------------------------------------------------------------------------
232 //----- ExposureFitsReader ---------------------------------------------------------------------------------
233 //-----------------------------------------------------------------------------------------------------------
234 
235 // FitsColumnReader that reads a Persistable subclass T (Wcs, Psf, or Calib here) by using an int
236 // column to retrieve the object from an InputArchive and attach it to an ExposureRecord via
237 // the Setter member function pointer.
238 template <typename T, void (ExposureRecord::*Setter)(std::shared_ptr<T const>)>
240 public:
242  auto item = mapper.find(name);
243  if (item) {
244  if (mapper.hasArchive()) {
246  mapper.customize(std::move(reader));
247  }
248  mapper.erase(item);
249  }
250  }
251 
252  PersistableObjectColumnReader(int column) : _column(column) {}
253 
254  virtual void readCell(BaseRecord &record, std::size_t row, fits::Fits &fits,
255  std::shared_ptr<io::InputArchive> const &archive) const {
256  int id = 0;
257  fits.readTableScalar<int>(row, _column, id);
258  std::shared_ptr<T> value = archive->get<T>(id);
259  (static_cast<ExposureRecord &>(record).*(Setter))(value);
260  }
261 
262 private:
263  bool _noHeavy;
264  int _column;
265 };
266 
267 namespace {
268 
269 class ExposureFitsReader : public io::FitsReader {
270 public:
271  ExposureFitsReader() : afw::table::io::FitsReader("EXPOSURE") {}
272 
275  int ioFlags, bool stripMetadata) const {
276  // We rely on the table version stored in the metadata when loading an ExposureCatalog
277  // persisted on its own. This is not as flexible in terms of backwards compatibility
278  // as the code that loads ExposureCatalogs persisted as part of something else, but
279  // we happen to know there are no ExposureCatalogs sitting on disk with with versions
280  // older than what this routine supports.
281  auto tableVersion = getTableVersion(*metadata);
286  mapper);
288  "validPolygon", mapper);
289  if (tableVersion > 1) {
291  mapper);
292  }
293  if (tableVersion > 2) {
295  &ExposureRecord::setTransmissionCurve>::setup("transmissionCurve",
296  mapper);
297  }
299  table->setMetadata(metadata);
300  return table;
301  }
302 
303  virtual bool usesArchive(int ioFlags) const { return true; }
304 };
305 
306 static ExposureFitsReader const exposureFitsReader;
307 
308 } // anonymous
309 
310 //-----------------------------------------------------------------------------------------------------------
311 //----- ExposureTable/Record member function implementations -----------------------------------------------
312 //-----------------------------------------------------------------------------------------------------------
313 
315  return geom::Box2I(get(ExposureTable::getBBoxKey()));
316 }
317 
320 }
321 
322 bool ExposureRecord::contains(geom::SpherePoint const &coord, bool includeValidPolygon) const {
323  if (!getWcs()) {
325  "ExposureRecord does not have a Wcs; cannot call contains()");
326  }
327 
328  // If there is no valid polygon set to false
329  if (includeValidPolygon && !getValidPolygon()) {
330  includeValidPolygon = false;
331  }
332 
333  try {
334  geom::Point2D point = getWcs()->skyToPixel(coord);
335  if (includeValidPolygon)
336  return (geom::Box2D(getBBox()).contains(point) && getValidPolygon()->contains(point));
337  else
338  return geom::Box2D(getBBox()).contains(point);
339  } catch (pex::exceptions::DomainError &) {
340  // SkyWcs can throw if the given coordinate is outside the region where the WCS is valid.
341  return false;
342  }
343 }
344 
346  bool includeValidPolygon) const {
347  return contains(wcs.pixelToSky(point), includeValidPolygon);
348 }
349 
351 
353 
355  try {
356  ExposureRecord const &s = dynamic_cast<ExposureRecord const &>(other);
357  _psf = s._psf;
358  _wcs = s._wcs;
359  _calib = s._calib;
360  _apCorrMap = s._apCorrMap;
361  _validPolygon = s._validPolygon;
362  _visitInfo = s._visitInfo;
363  _transmissionCurve = s._transmissionCurve;
364  } catch (std::bad_cast &) {
365  }
366 }
367 
369  if (!checkSchema(schema)) {
370  throw LSST_EXCEPT(
372  "Schema for Exposure must contain at least the keys defined by makeMinimalSchema().");
373  }
374  return std::shared_ptr<ExposureTable>(new ExposureTable(schema));
375 }
376 
378 
380 // Delegate to copy-constructor for backward compatibility
382 
384 
385 ExposureTable::MinimalSchema::MinimalSchema() {
386  id = schema.addField<RecordId>("id", "unique ID");
387  bbox = Box2IKey::addFields(schema, "bbox", "bounding box", "pixel");
388  schema.getCitizen().markPersistent();
389 }
390 
391 ExposureTable::MinimalSchema &ExposureTable::getMinimalSchema() {
392  static MinimalSchema it;
393  return it;
394 }
395 
396 std::shared_ptr<io::FitsWriter> ExposureTable::makeFitsWriter(fits::Fits *fitsfile, int flags) const {
397  return std::make_shared<ExposureFitsWriter>(fitsfile, std::shared_ptr<io::OutputArchive>(), flags);
398 }
399 
400 std::shared_ptr<io::FitsWriter> ExposureTable::makeFitsWriter(fits::Fits *fitsfile,
402  int flags) const {
403  return std::make_shared<ExposureFitsWriter>(fitsfile, archive, flags);
404 }
405 
408 }
409 
411  return std::shared_ptr<ExposureRecord>(new ExposureRecord(getSelf<ExposureTable>()));
412 }
413 
414 //-----------------------------------------------------------------------------------------------------------
415 //----- ExposureCatalogT member function implementations ----------------------------------------------------
416 //-----------------------------------------------------------------------------------------------------------
417 
418 template <typename RecordT>
420  PersistenceHelper helper{};
421  SchemaMapper mapper = helper.makeWriteMapper(this->getSchema());
422  BaseCatalog outputCat = handle.makeCatalog(mapper.getOutputSchema());
423  outputCat.reserve(this->size());
424  for (const_iterator i = this->begin(); i != this->end(); ++i) {
425  helper.writeRecord(*i, *outputCat.addNew(), mapper, handle, permissive);
426  }
427  handle.saveCatalog(outputCat);
428 }
429 
430 template <typename RecordT>
432  BaseCatalog const &catalog) {
433  // Helper constructor will infer which components are available
434  // (effectively the version, but more flexible).
435  PersistenceHelper helper{catalog.getSchema()};
436  SchemaMapper mapper = helper.makeReadMapper(catalog.getSchema());
438  result.reserve(catalog.size());
439  for (BaseCatalog::const_iterator i = catalog.begin(); i != catalog.end(); ++i) {
440  helper.readRecord(*i, *result.addNew(), mapper, archive);
441  }
442  return result;
443 }
444 
445 template <typename RecordT>
447  bool includeValidPolygon) const {
448  ExposureCatalogT result(this->getTable());
449  for (const_iterator i = this->begin(); i != this->end(); ++i) {
450  if (i->contains(coord, includeValidPolygon)) {
451  result.push_back(i);
452  }
453  }
454  return result;
455 }
456 
457 template <typename RecordT>
459  geom::SkyWcs const &wcs,
460  bool includeValidPolygon) const {
461  ExposureCatalogT result(this->getTable());
462  for (const_iterator i = this->begin(); i != this->end(); ++i) {
463  if (i->contains(point, wcs, includeValidPolygon)) {
464  result.push_back(i);
465  }
466  }
467  return result;
468 }
469 
470 //-----------------------------------------------------------------------------------------------------------
471 //----- Explicit instantiation ------------------------------------------------------------------------------
472 //-----------------------------------------------------------------------------------------------------------
473 
474 template class CatalogT<ExposureRecord>;
475 template class CatalogT<ExposureRecord const>;
476 
477 template class SortedCatalogT<ExposureRecord>;
479 
480 template class ExposureCatalogT<ExposureRecord>;
482 }
483 }
484 } // namespace lsst::afw::table
std::shared_ptr< BaseRecord > _record
Definition: Exposure.cc:204
Defines the fields and offsets for a table.
Definition: Schema.h:47
Key< int > wcs
Definition: Exposure.cc:62
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:61
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixel...
Definition: SkyWcs.h:113
A spatially-varying transmission curve as a function of wavelength.
A utility class for reading FITS binary tables.
Definition: FitsReader.h:34
Key< int > calib
Definition: Exposure.cc:64
bool contains(Point2D const &point) const
Return true if the box contains the point.
Definition: Box.cc:266
An object passed to Persistable::write to allow it to persist itself.
void setBBox(geom::Box2I const &bbox)
Definition: Exposure.cc:318
Table class used to store exposure metadata.
Definition: Exposure.h:170
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
Definition: Exposure.cc:406
geom::Box2I getBBox() const
Definition: Exposure.cc:314
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
Definition: ApCorrMap.h:44
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:120
static void setup(std::string const &name, io::FitsSchemaInputMapper &mapper)
Definition: Exposure.cc:241
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:67
static Box2IKey getBBoxKey()
Key for the full bbox.
Definition: Exposure.h:218
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:593
ExposureTable(Schema const &schema)
Definition: Exposure.cc:377
bool _doWriteArchive
Definition: Exposure.cc:202
Key< int > apCorrMap
Definition: Exposure.cc:65
Key< int > psf
Definition: Exposure.cc:63
A class that describes a mapping from a FITS binary table to an afw::table Schema.
Schema getSchema() const
Return the schema associated with the catalog&#39;s table.
Definition: Catalog.h:117
ItemVariant const * other
Definition: Schema.cc:55
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:298
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
Definition: Exposure.cc:410
Describe an exposure&#39;s calibration.
Definition: Calib.h:96
SchemaMapper _mapper
Definition: Exposure.cc:206
std::shared_ptr< io::OutputArchive > _archive
Definition: Exposure.cc:203
Fits * fits
Definition: FitsWriter.cc:90
ExposureCatalogT subsetContaining(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:446
An integer coordinate rectangle.
Definition: Box.h:55
STL class.
Key< int > validPolygon
Definition: Exposure.cc:66
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.
Key< int > transmissionCurve
Definition: Exposure.cc:68
void push_back(Record const &r)
Add a copy of the given record to the end of the catalog.
Definition: Catalog.h:463
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.
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
int end
iterator end()
Iterator access.
Definition: Catalog.h:397
Schema schema
Definition: Exposure.cc:61
Iterator class for CatalogT.
Definition: Catalog.h:38
bool contains(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:322
Key< U > key
Definition: Schema.cc:280
T dynamic_pointer_cast(T... args)
T move(T... args)
std::unique_ptr< SchemaItem< U > > result
Definition: Schema.cc:194
virtual void _writeTable(std::shared_ptr< BaseTable const > const &table, std::size_t nRows)
Write a table and its schema.
Definition: FitsWriter.cc:103
virtual void _assign(BaseRecord const &other)
Called by assign() after transferring fields to allow subclass data members to be copied...
Definition: Exposure.cc:354
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
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 > visitInfo
Definition: Exposure.cc:67
#define LSST_EXCEPT(type,...)
STL class.
static std::shared_ptr< ExposureTable > make(Schema const &schema)
Construct a new table.
Definition: Exposure.cc:368
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
Schema finalize()
Map any remaining items into regular Schema items, and return the final Schema.
SpherePoint pixelToSky(Point2D const &pixel) const
Compute sky position(s) from pixel position(s)
Definition: SkyWcs.h:326
static ExposureCatalogT readFromArchive(io::InputArchive const &archive, BaseCatalog const &catalog)
Convenience input function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:431
Custom catalog class for ExposureRecord/Table.
Definition: Exposure.h:63
void writeToArchive(io::OutputArchiveHandle &handle, bool ignoreUnpersistable=true) const
Convenience output function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:419
void setTransmissionCurve(std::shared_ptr< image::TransmissionCurve const > transmissionCurve)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
Definition: Exposure.h:137
virtual void _writeRecord(BaseRecord const &source)
Write an individual record.
Definition: FitsWriter.cc:189
table::Box2IKey bbox
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:75
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:408
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
A floating-point coordinate rectangle geometry.
Definition: Box.h:266
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...
PersistenceHelper _helper
Definition: Exposure.cc:205
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
virtual void readCell(BaseRecord &record, std::size_t row, fits::Fits &fits, std::shared_ptr< io::InputArchive > const &archive) const
Definition: Exposure.cc:254
Base class for all tables.
Definition: BaseTable.h:44
ExposureRecord(ExposureRecord const &)=delete
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:472