LSST Applications g070148d5b3+33e5256705,g0d53e28543+25c8b88941,g0da5cf3356+2dd1178308,g1081da9e2a+62d12e78cb,g17e5ecfddb+7e422d6136,g1c76d35bf8+ede3a706f7,g295839609d+225697d880,g2e2c1a68ba+cc1f6f037e,g2ffcdf413f+853cd4dcde,g38293774b4+62d12e78cb,g3b44f30a73+d953f1ac34,g48ccf36440+885b902d19,g4b2f1765b6+7dedbde6d2,g5320a0a9f6+0c5d6105b6,g56b687f8c9+ede3a706f7,g5c4744a4d9+ef6ac23297,g5ffd174ac0+0c5d6105b6,g6075d09f38+66af417445,g667d525e37+2ced63db88,g670421136f+2ced63db88,g71f27ac40c+2ced63db88,g774830318a+463cbe8d1f,g7876bc68e5+1d137996f1,g7985c39107+62d12e78cb,g7fdac2220c+0fd8241c05,g96f01af41f+368e6903a7,g9ca82378b8+2ced63db88,g9d27549199+ef6ac23297,gabe93b2c52+e3573e3735,gb065e2a02a+3dfbe639da,gbc3249ced9+0c5d6105b6,gbec6a3398f+0c5d6105b6,gc9534b9d65+35b9f25267,gd01420fc67+0c5d6105b6,geee7ff78d7+a14128c129,gf63283c776+ede3a706f7,gfed783d017+0c5d6105b6,w.2022.47
LSST Data Management Base Package
Loading...
Searching...
No Matches
Exposure.cc
Go to the documentation of this file.
1// -*- lsst-c++ -*-
2#include <memory>
3#include <typeinfo>
4#include <string>
5
22
23namespace lsst {
24namespace afw {
25namespace 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
35namespace {
36
37int const EXPOSURE_TABLE_CURRENT_VERSION = 5; // current version of ExposureTable
38std::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).
43std::string const WCS_FIELD_NAME = "wcs";
44std::string const PSF_FIELD_NAME = "psf";
45std::string const CALIB_FIELD_NAME = "calib"; // to support the deprecated Calib in old files
46std::string const PHOTOCALIB_FIELD_NAME = "photoCalib";
47std::string const VISIT_INFO_FIELD_NAME = "visitInfo";
48std::string const AP_CORR_MAP_FIELD_NAME = "apCorrMap";
49std::string const VALID_POLYGON_FIELD_NAME = "validPolygon";
50std::string const TRANSMISSION_CURVE_FIELD_NAME = "transmissionCurve";
51std::string const DETECTOR_FIELD_NAME = "detector";
52
53int getTableVersion(daf::base::PropertySet &metadata) {
54 return metadata.exists(EXPOSURE_TABLE_VERSION_KEY) ? metadata.get<int>(EXPOSURE_TABLE_VERSION_KEY) : 1;
55}
56
62struct 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 }
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
195namespace {
196
197class ExposureFitsWriter : public io::FitsWriter {
198public:
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
207protected:
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
223void 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
239void 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.
254template <typename T, void (ExposureRecord::*Setter)(std::shared_ptr<T const>)>
256public:
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
278private:
279 bool _noHeavy;
280 int _column;
281};
282
283namespace {
284
285class ExposureFitsReader : public io::FitsReader {
286public:
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
335static ExposureFitsReader const exposureFitsReader;
336
337} // namespace
338
339//-----------------------------------------------------------------------------------------------------------
340//----- ExposureTable/Record member function implementations -----------------------------------------------
341//-----------------------------------------------------------------------------------------------------------
342
345}
346
348
349bool 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
372bool 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
405ExposureTable::ExposureTable(ExposureTable const &other) = default;
406// Delegate to copy-constructor for backward compatibility
408
410
411ExposureTable::MinimalSchema::MinimalSchema() {
412 id = schema.addField<RecordId>("id", "unique ID");
413 bbox = Box2IKey::addFields(schema, "bbox", "bounding box", "pixel");
414}
415
416ExposureTable::MinimalSchema &ExposureTable::getMinimalSchema() {
417 static MinimalSchema it;
418 return it;
419}
420
421std::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
425std::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
443template <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
455template <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
470template <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
482template <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
499template class CatalogT<ExposureRecord>;
500template class CatalogT<ExposureRecord const>;
501
502template class SortedCatalogT<ExposureRecord>;
504
507} // namespace table
508} // namespace afw
509} // namespace lsst
py::object result
Definition: _schema.cc:429
table::Key< std::string > name
Definition: Amplifier.cc:116
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
int end
table::Key< int > id
Definition: Detector.cc:162
table::Key< int > detector
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
Implementation of the Photometric Calibration class.
SchemaMapper * mapper
Definition: SchemaMapper.cc:71
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:66
table::Schema schema
Definition: python.h:134
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:308
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
Definition: ApCorrMap.h:45
The photometric calibration of an exposure.
Definition: PhotoCalib.h:114
A spatially-varying transmission curve as a function of wavelength.
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:68
Base class for all records.
Definition: BaseRecord.h:31
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
Definition: BaseRecord.h:151
Base class for all tables.
Definition: BaseTable.h:61
static std::shared_ptr< BaseTable > make(Schema const &schema)
Construct a new table.
Definition: BaseTable.cc:120
static BoxKey addFields(Schema &schema, std::string const &name, std::string const &doc, std::string const &unit)
Add _min_x, _min_y, _max_x, _max_y fields to a Schema, and return a BoxKey that points to them.
Definition: aggregates.cc:86
Iterator class for CatalogT.
Definition: Catalog.h:40
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
Definition: Catalog.h:490
void reserve(size_type n)
Increase the capacity of the catalog to the given size.
Definition: Catalog.h:433
Custom catalog class for ExposureRecord/Table.
Definition: Exposure.h:311
typename Base::const_iterator const_iterator
Definition: Exposure.h:319
static ExposureCatalogT readFromArchive(io::InputArchive const &archive, BaseCatalog const &catalog)
Convenience input function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:456
void writeToArchive(io::OutputArchiveHandle &handle, bool ignoreUnpersistable=true) const
Convenience output function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:444
ExposureCatalogT subsetContaining(lsst::geom::SpherePoint const &coord, bool includeValidPolygon=false) const
Return a shallow subset of the catalog with only those records that contain the given point.
Definition: Exposure.cc:471
Record class used to store exposure metadata.
Definition: Exposure.h:79
bool contains(lsst::geom::SpherePoint const &coord, bool includeValidPolygon=false) const
Return true if the bounding box contains the given celestial coordinate point, taking into account th...
Definition: Exposure.cc:349
lsst::geom::Box2I getBBox() const
Definition: Exposure.cc:343
std::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Definition: Exposure.h:148
void setTransmissionCurve(std::shared_ptr< image::TransmissionCurve const > transmissionCurve)
Definition: Exposure.h:157
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
void setBBox(lsst::geom::Box2I const &bbox)
Definition: Exposure.cc:347
void _assign(BaseRecord const &other) override
Called by assign() after transferring fields to allow subclass data members to be copied.
Definition: Exposure.cc:379
Table class used to store exposure metadata.
Definition: Exposure.h:195
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
Definition: Exposure.cc:435
static Box2IKey getBBoxKey()
Key for the full bbox.
Definition: Exposure.h:243
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid ExposureTable schema.
Definition: Exposure.h:228
ExposureTable(Schema const &schema)
Definition: Exposure.cc:403
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
Definition: Exposure.cc:431
static std::shared_ptr< ExposureTable > make(Schema const &schema)
Construct a new table.
Definition: Exposure.cc:394
bool isValid() const noexcept
Return true if the key was initialized to valid offset.
Definition: Key.h:97
static void setup(std::string const &name, io::FitsSchemaInputMapper &mapper)
Definition: Exposure.cc:257
void readCell(BaseRecord &record, std::size_t row, fits::Fits &fits, std::shared_ptr< io::InputArchive > const &archive) const override
Read values from a single row.
Definition: Exposure.cc:270
Defines the fields and offsets for a table.
Definition: Schema.h:51
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:21
Schema const getOutputSchema() const
Return the output schema (copy-on-write).
Definition: SchemaMapper.h:27
static SchemaMapper removeMinimalSchema(Schema const &input, Schema const &minimal)
Create a mapper by removing fields from the front of a schema.
static std::vector< SchemaMapper > join(std::vector< Schema > const &inputs, std::vector< std::string > const &prefixes=std::vector< std::string >())
Combine a sequence of schemas into one, creating a SchemaMapper for each.
Custom catalog class for record/table subclasses that are guaranteed to have an ID,...
Definition: SortedCatalog.h:42
Polymorphic reader interface used to read different kinds of objects from one or more FITS binary tab...
A class that describes a mapping from a FITS binary table to an afw::table Schema.
virtual void _writeRecord(BaseRecord const &source)
Write an individual record.
Definition: FitsWriter.cc:189
virtual void _writeTable(std::shared_ptr< BaseTable const > const &table, std::size_t nRows)
Write a table and its schema.
Definition: FitsWriter.cc:103
A multi-catalog archive object used to load table::io::Persistable objects.
Definition: InputArchive.h:31
An object passed to Persistable::write to allow it to persist itself.
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
A floating-point coordinate rectangle geometry.
Definition: Box.h:413
bool contains(Point2D const &point) const noexcept
Return true if the box contains the point.
Definition: Box.cc:322
An integer coordinate rectangle.
Definition: Box.h:55
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:57
Reports arguments outside the domain of an operation.
Definition: Runtime.h:57
Reports invalid arguments.
Definition: Runtime.h:66
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
daf::base::PropertySet * set
Definition: fits.cc:927
T get(T... args)
T move(T... args)
T push_back(T... args)
int row
Definition: CR.cc:145
bool _doWriteArchive
Definition: Exposure.cc:216
std::shared_ptr< BaseRecord > _record
Definition: Exposure.cc:218
Key< int > psf
Definition: Exposure.cc:65
Key< int > visitInfo
Definition: Exposure.cc:70
Key< int > validPolygon
Definition: Exposure.cc:69
Key< int > photoCalib
Definition: Exposure.cc:67
Key< int > transmissionCurve
Definition: Exposure.cc:71
std::shared_ptr< io::OutputArchive > _archive
Definition: Exposure.cc:217
Key< int > calib
Definition: Exposure.cc:66
SchemaMapper _mapper
Definition: Exposure.cc:220
Key< int > apCorrMap
Definition: Exposure.cc:68
PersistenceHelper _helper
Definition: Exposure.cc:219