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