LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
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"
15 #include "lsst/afw/image/Calib.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 = 4; // 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";
46 std::string const VISIT_INFO_FIELD_NAME = "visitInfo";
47 std::string const AP_CORR_MAP_FIELD_NAME = "apCorrMap";
48 std::string const VALID_POLYGON_FIELD_NAME = "validPolygon";
49 std::string const TRANSMISSION_CURVE_FIELD_NAME = "transmissionCurve";
50 std::string const DETECTOR_FIELD_NAME = "detector";
51 
52 int getTableVersion(daf::base::PropertySet &metadata) {
53  return metadata.exists(EXPOSURE_TABLE_VERSION_KEY) ? metadata.get<int>(EXPOSURE_TABLE_VERSION_KEY) : 1;
54 }
55 
61 struct PersistenceHelper {
62  Schema schema;
63  Key<int> wcs;
64  Key<int> psf;
65  Key<int> calib;
66  Key<int> apCorrMap;
67  Key<int> validPolygon;
68  Key<int> visitInfo;
70  Key<int> detector;
71 
72  // Create a SchemaMapper that maps an ExposureRecord to a BaseRecord with IDs for Wcs, Psf, etc.
73  SchemaMapper makeWriteMapper(Schema const &inputSchema) const {
74  std::vector<Schema> inSchemas;
75  inSchemas.push_back(PersistenceHelper().schema);
76  inSchemas.push_back(inputSchema);
77  // don't need front; it's an identity mapper
78  SchemaMapper result = SchemaMapper::join(inSchemas).back();
79  result.editOutputSchema().setAliasMap(inputSchema.getAliasMap());
80  return result;
81  }
82 
83  // Create a SchemaMapper that maps a BaseRecord to an ExposureRecord with IDs for WCS, Psf, etc.
84  SchemaMapper makeReadMapper(Schema const &inputSchema) const {
85  SchemaMapper result = SchemaMapper::removeMinimalSchema(inputSchema, schema);
86  result.editOutputSchema().setAliasMap(inputSchema.getAliasMap());
87  return result;
88  }
89 
90  // Write psf, wcs, etc. from an ExposureRecord to an archive
91  template <typename OutputArchiveIsh>
92  void writeRecord(ExposureRecord const &input, BaseRecord &output, SchemaMapper const &mapper,
93  OutputArchiveIsh &archive, bool permissive) const {
94  output.assign(input, mapper);
95  output.set(psf, archive.put(input.getPsf(), permissive));
96  output.set(wcs, archive.put(input.getWcs(), permissive));
97  output.set(calib, archive.put(input.getCalib(), permissive));
98  output.set(apCorrMap, archive.put(input.getApCorrMap(), permissive));
99  output.set(validPolygon, archive.put(input.getValidPolygon(), permissive));
100  output.set(visitInfo, archive.put(input.getVisitInfo(), permissive));
101  output.set(transmissionCurve, archive.put(input.getTransmissionCurve(), permissive));
102  output.set(detector, archive.put(input.getDetector(), permissive));
103  }
104 
105  // Read psf, wcs, etc. from an archive to an ExposureRecord
106  void readRecord(BaseRecord const &input, ExposureRecord &output, SchemaMapper const &mapper,
107  io::InputArchive const &archive) const {
108  output.assign(input, mapper);
109  if (psf.isValid()) {
110  output.setPsf(archive.get<detection::Psf>(input.get(psf)));
111  }
112  if (wcs.isValid()) {
113  output.setWcs(archive.get<geom::SkyWcs>(input.get(wcs)));
114  }
115  if (calib.isValid()) {
116  output.setCalib(archive.get<image::Calib>(input.get(calib)));
117  }
118  if (apCorrMap.isValid()) {
119  output.setApCorrMap(archive.get<image::ApCorrMap>(input.get(apCorrMap)));
120  }
121  if (validPolygon.isValid()) {
122  output.setValidPolygon(archive.get<geom::polygon::Polygon>(input.get(validPolygon)));
123  }
124  if (visitInfo.isValid()) {
125  output.setVisitInfo(archive.get<image::VisitInfo>(input.get(visitInfo)));
126  }
127  if (transmissionCurve.isValid()) {
128  output.setTransmissionCurve(archive.get<image::TransmissionCurve>(input.get(transmissionCurve)));
129  }
130  if (detector.isValid()) {
131  output.setDetector(archive.get<cameraGeom::Detector>(input.get(detector)));
132  }
133  }
134 
135  // No copying
136  PersistenceHelper(const PersistenceHelper &) = delete;
137  PersistenceHelper &operator=(const PersistenceHelper &) = delete;
138 
139  // No moving
140  PersistenceHelper(PersistenceHelper &&) = delete;
141  PersistenceHelper &operator=(PersistenceHelper &&) = delete;
142 
143  // Construct a PersistenceHelper using the most modern schema.
144  PersistenceHelper()
145  : schema(),
146  wcs(schema.addField<int>(WCS_FIELD_NAME, "archive ID for Wcs object")),
147  psf(schema.addField<int>(PSF_FIELD_NAME, "archive ID for Psf object")),
148  calib(schema.addField<int>(CALIB_FIELD_NAME, "archive ID for Calib object")),
149  apCorrMap(schema.addField<int>(AP_CORR_MAP_FIELD_NAME, "archive ID for ApCorrMap object")),
150  validPolygon(schema.addField<int>(VALID_POLYGON_FIELD_NAME, "archive ID for Polygon object")),
151  visitInfo(schema.addField<int>(VISIT_INFO_FIELD_NAME, "archive ID for VisitInfo object")),
152  transmissionCurve(schema.addField<int>(TRANSMISSION_CURVE_FIELD_NAME,
153  "archive ID for TransmissionCurve object")),
154  detector(schema.addField<int>(DETECTOR_FIELD_NAME, "archive ID for Detector object")) {}
155 
156  // Add a field to this->schema, saving its key in 'key', if and only if 'name' is a field in 'oldSchema'
157  void addIfPresent(Schema const &oldSchema, Key<int> &key, std::string const &name) {
158  try {
159  auto item = oldSchema.find<int>(name);
160  key = schema.addField(item.field);
161  } catch (pex::exceptions::NotFoundError &) {
162  }
163  }
164 
165  // Construct a PersistenceHelper from a possibly old on-disk schema
166  PersistenceHelper(Schema const &oldSchema) {
167  addIfPresent(oldSchema, wcs, WCS_FIELD_NAME);
168  addIfPresent(oldSchema, psf, PSF_FIELD_NAME);
169  addIfPresent(oldSchema, calib, CALIB_FIELD_NAME);
170  addIfPresent(oldSchema, apCorrMap, AP_CORR_MAP_FIELD_NAME);
171  addIfPresent(oldSchema, validPolygon, VALID_POLYGON_FIELD_NAME);
172  addIfPresent(oldSchema, visitInfo, VISIT_INFO_FIELD_NAME);
173  addIfPresent(oldSchema, transmissionCurve, TRANSMISSION_CURVE_FIELD_NAME);
174  addIfPresent(oldSchema, detector, DETECTOR_FIELD_NAME);
175  assert(oldSchema.contains(schema));
176  }
177 };
178 
179 } // namespace
180 
181 //-----------------------------------------------------------------------------------------------------------
182 //----- ExposureFitsWriter ---------------------------------------------------------------------------------
183 //-----------------------------------------------------------------------------------------------------------
184 
185 // A custom FitsWriter for Exposure - this sets the AFW_TYPE key to EXPOSURE, which should ensure
186 // we use ExposureFitsReader to read it, and sets EXPOSURE_TABLE_VERSION_KEY to the current version:
187 // EXPOSURE_TABLE_CURRENT_VERSION
188 
189 namespace {
190 
191 class ExposureFitsWriter : public io::FitsWriter {
192 public:
193  ExposureFitsWriter(Fits *fits, std::shared_ptr<io::OutputArchive> archive, int flags)
194  : io::FitsWriter(fits, flags), _doWriteArchive(false), _archive(archive), _helper() {
195  if (!_archive) {
196  _doWriteArchive = true;
197  _archive.reset(new io::OutputArchive());
198  }
199  }
200 
201 protected:
202  void _writeTable(std::shared_ptr<BaseTable const> const &table, std::size_t nRows) override;
203 
204  void _writeRecord(BaseRecord const &r) override;
205 
206  void _finish() override {
207  if (_doWriteArchive) _archive->writeFits(*_fits);
208  }
209 
213  PersistenceHelper _helper;
214  SchemaMapper _mapper;
215 };
216 
217 void ExposureFitsWriter::_writeTable(std::shared_ptr<BaseTable const> const &t, std::size_t nRows) {
218  std::shared_ptr<ExposureTable const> inTable = std::dynamic_pointer_cast<ExposureTable const>(t);
219  if (!inTable) {
221  "Cannot use a ExposureFitsWriter on a non-Exposure table.");
222  }
223  _mapper = _helper.makeWriteMapper(inTable->getSchema());
224  std::shared_ptr<BaseTable> outTable = BaseTable::make(_mapper.getOutputSchema());
225  io::FitsWriter::_writeTable(outTable, nRows);
226  _fits->writeKey("AFW_TYPE", "EXPOSURE", "Tells lsst::afw to load this as an Exposure table.");
227  _fits->writeKey(EXPOSURE_TABLE_VERSION_KEY, EXPOSURE_TABLE_CURRENT_VERSION, "Exposure table version");
228  _record = outTable->makeRecord();
229 }
230 
231 void ExposureFitsWriter::_writeRecord(BaseRecord const &r) {
232  ExposureRecord const &record = static_cast<ExposureRecord const &>(r);
233  _helper.writeRecord(record, *_record, _mapper, *_archive, false);
235 }
236 
237 } // namespace
238 
239 //-----------------------------------------------------------------------------------------------------------
240 //----- ExposureFitsReader ---------------------------------------------------------------------------------
241 //-----------------------------------------------------------------------------------------------------------
242 
243 // FitsColumnReader that reads a Persistable subclass T (Wcs, Psf, or Calib here) by using an int
244 // column to retrieve the object from an InputArchive and attach it to an ExposureRecord via
245 // the Setter member function pointer.
246 template <typename T, void (ExposureRecord::*Setter)(std::shared_ptr<T const>)>
248 public:
250  auto item = mapper.find(name);
251  if (item) {
252  if (mapper.hasArchive()) {
254  mapper.customize(std::move(reader));
255  }
256  mapper.erase(item);
257  }
258  }
259 
260  PersistableObjectColumnReader(int column) : _column(column) {}
261 
263  std::shared_ptr<io::InputArchive> const &archive) const override {
264  int id = 0;
265  fits.readTableScalar<int>(row, _column, id);
266  std::shared_ptr<T> value = archive->get<T>(id);
267  (static_cast<ExposureRecord &>(record).*(Setter))(value);
268  }
269 
270 private:
271  bool _noHeavy;
272  int _column;
273 };
274 
275 namespace {
276 
277 class ExposureFitsReader : public io::FitsReader {
278 public:
279  ExposureFitsReader() : afw::table::io::FitsReader("EXPOSURE") {}
280 
282  std::shared_ptr<daf::base::PropertyList> metadata, int ioFlags,
283  bool stripMetadata) const override {
284  // We rely on the table version stored in the metadata when loading an ExposureCatalog
285  // persisted on its own. This is not as flexible in terms of backwards compatibility
286  // as the code that loads ExposureCatalogs persisted as part of something else, but
287  // we happen to know there are no ExposureCatalogs sitting on disk with with versions
288  // older than what this routine supports.
289  auto tableVersion = getTableVersion(*metadata);
294  mapper);
296  "validPolygon", mapper);
297  if (tableVersion > 1) {
299  mapper);
300  }
301  if (tableVersion > 2) {
303  &ExposureRecord::setTransmissionCurve>::setup("transmissionCurve",
304  mapper);
305  }
306  if (tableVersion > 3) {
308  &ExposureRecord::setDetector>::setup("detector", mapper);
309  }
311  table->setMetadata(metadata);
312  return table;
313  }
314 
315  bool usesArchive(int ioFlags) const override { return true; }
316 };
317 
318 static ExposureFitsReader const exposureFitsReader;
319 
320 } // namespace
321 
322 //-----------------------------------------------------------------------------------------------------------
323 //----- ExposureTable/Record member function implementations -----------------------------------------------
324 //-----------------------------------------------------------------------------------------------------------
325 
328 }
329 
331 
332 bool ExposureRecord::contains(lsst::geom::SpherePoint const &coord, bool includeValidPolygon) const {
333  if (!getWcs()) {
335  "ExposureRecord does not have a Wcs; cannot call contains()");
336  }
337 
338  // If there is no valid polygon set to false
339  if (includeValidPolygon && !getValidPolygon()) {
340  includeValidPolygon = false;
341  }
342 
343  try {
344  lsst::geom::Point2D point = getWcs()->skyToPixel(coord);
345  if (includeValidPolygon)
346  return (lsst::geom::Box2D(getBBox()).contains(point) && getValidPolygon()->contains(point));
347  else
348  return lsst::geom::Box2D(getBBox()).contains(point);
349  } catch (pex::exceptions::DomainError &) {
350  // SkyWcs can throw if the given coordinate is outside the region where the WCS is valid.
351  return false;
352  }
353 }
354 
356  bool includeValidPolygon) const {
357  return contains(wcs.pixelToSky(point), includeValidPolygon);
358 }
359 
361 
363 
365  try {
366  ExposureRecord const &s = dynamic_cast<ExposureRecord const &>(other);
367  _psf = s._psf;
368  _wcs = s._wcs;
369  _calib = s._calib;
370  _apCorrMap = s._apCorrMap;
371  _validPolygon = s._validPolygon;
372  _visitInfo = s._visitInfo;
373  _transmissionCurve = s._transmissionCurve;
374  _detector = s._detector;
375  } catch (std::bad_cast &) {
376  }
377 }
378 
380  if (!checkSchema(schema)) {
381  throw LSST_EXCEPT(
383  "Schema for Exposure must contain at least the keys defined by makeMinimalSchema().");
384  }
385  return std::shared_ptr<ExposureTable>(new ExposureTable(schema));
386 }
387 
389 
391 // Delegate to copy-constructor for backward compatibility
393 
395 
396 ExposureTable::MinimalSchema::MinimalSchema() {
397  id = schema.addField<RecordId>("id", "unique ID");
398  bbox = Box2IKey::addFields(schema, "bbox", "bounding box", "pixel");
399  schema.getCitizen().markPersistent();
400 }
401 
402 ExposureTable::MinimalSchema &ExposureTable::getMinimalSchema() {
403  static MinimalSchema it;
404  return it;
405 }
406 
407 std::shared_ptr<io::FitsWriter> ExposureTable::makeFitsWriter(fits::Fits *fitsfile, int flags) const {
408  return std::make_shared<ExposureFitsWriter>(fitsfile, std::shared_ptr<io::OutputArchive>(), flags);
409 }
410 
411 std::shared_ptr<io::FitsWriter> ExposureTable::makeFitsWriter(fits::Fits *fitsfile,
413  int flags) const {
414  return std::make_shared<ExposureFitsWriter>(fitsfile, archive, flags);
415 }
416 
419 }
420 
422  return std::shared_ptr<ExposureRecord>(new ExposureRecord(getSelf<ExposureTable>()));
423 }
424 
425 //-----------------------------------------------------------------------------------------------------------
426 //----- ExposureCatalogT member function implementations ----------------------------------------------------
427 //-----------------------------------------------------------------------------------------------------------
428 
429 template <typename RecordT>
431  PersistenceHelper helper{};
432  SchemaMapper mapper = helper.makeWriteMapper(this->getSchema());
433  BaseCatalog outputCat = handle.makeCatalog(mapper.getOutputSchema());
434  outputCat.reserve(this->size());
435  for (const_iterator i = this->begin(); i != this->end(); ++i) {
436  helper.writeRecord(*i, *outputCat.addNew(), mapper, handle, permissive);
437  }
438  handle.saveCatalog(outputCat);
439 }
440 
441 template <typename RecordT>
443  BaseCatalog const &catalog) {
444  // Helper constructor will infer which components are available
445  // (effectively the version, but more flexible).
446  PersistenceHelper helper{catalog.getSchema()};
447  SchemaMapper mapper = helper.makeReadMapper(catalog.getSchema());
449  result.reserve(catalog.size());
450  for (BaseCatalog::const_iterator i = catalog.begin(); i != catalog.end(); ++i) {
451  helper.readRecord(*i, *result.addNew(), mapper, archive);
452  }
453  return result;
454 }
455 
456 template <typename RecordT>
458  bool includeValidPolygon) const {
459  ExposureCatalogT result(this->getTable());
460  for (const_iterator i = this->begin(); i != this->end(); ++i) {
461  if (i->contains(coord, includeValidPolygon)) {
462  result.push_back(i);
463  }
464  }
465  return result;
466 }
467 
468 template <typename RecordT>
470  geom::SkyWcs const &wcs,
471  bool includeValidPolygon) const {
472  ExposureCatalogT result(this->getTable());
473  for (const_iterator i = this->begin(); i != this->end(); ++i) {
474  if (i->contains(point, wcs, includeValidPolygon)) {
475  result.push_back(i);
476  }
477  }
478  return result;
479 }
480 
481 //-----------------------------------------------------------------------------------------------------------
482 //----- Explicit instantiation ------------------------------------------------------------------------------
483 //-----------------------------------------------------------------------------------------------------------
484 
485 template class CatalogT<ExposureRecord>;
486 template class CatalogT<ExposureRecord const>;
487 
488 template class SortedCatalogT<ExposureRecord>;
490 
491 template class ExposureCatalogT<ExposureRecord>;
493 } // namespace table
494 } // namespace afw
495 } // namespace lsst
Defines the fields and offsets for a table.
Definition: Schema.h:50
bool _doWriteArchive
Definition: Exposure.cc:210
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.
Key< int > visitInfo
Definition: Exposure.cc:68
bool contains(VertexIterator const begin, VertexIterator const end, UnitVector3d const &v)
A utility class for reading FITS binary tables.
Definition: FitsReader.h:34
Schema schema
Definition: Exposure.cc:62
A floating-point coordinate rectangle geometry.
Definition: Box.h:294
An object passed to Persistable::write to allow it to persist itself.
Table class used to store exposure metadata.
Definition: Exposure.h:185
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
Definition: Exposure.cc:417
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:457
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:332
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:249
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:67
static Box2IKey getBBoxKey()
Key for the full bbox.
Definition: Exposure.h:233
Schema const getOutputSchema() const
Return the output schema (copy-on-write).
Definition: SchemaMapper.h:27
py::object result
Definition: schema.cc:284
void readTableScalar(std::size_t row, int col, T &value)
Read an array scalar from a binary table.
Definition: fits.h:594
ExposureTable(Schema const &schema)
Definition: Exposure.cc:388
std::shared_ptr< BaseRecord > _record
Definition: Exposure.cc:212
void setDetector(std::shared_ptr< cameraGeom::Detector const > detector)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
Definition: Exposure.h:151
Reports arguments outside the domain of an operation.
Definition: Runtime.h:57
A class that describes a mapping from a FITS binary table to an afw::table Schema.
table::Key< int > id
Definition: Detector.cc:163
Schema getSchema() const
Return the schema associated with the catalog&#39;s table.
Definition: Catalog.h:117
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:421
void setBBox(lsst::geom::Box2I const &bbox)
Definition: Exposure.cc:330
STL class.
Key< int > validPolygon
Definition: Exposure.cc:67
Describe an exposure&#39;s calibration.
Definition: Calib.h:95
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:463
PersistenceHelper _helper
Definition: Exposure.cc:213
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:63
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
bool contains(Point2D const &point) const noexcept
Return true if the box contains the point.
Definition: Box.cc:288
Iterator class for CatalogT.
Definition: Catalog.h:38
Key< int > transmissionCurve
Definition: Exposure.cc:69
SchemaMapper _mapper
Definition: Exposure.cc:214
T dynamic_pointer_cast(T... args)
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
table::Box2IKey bbox
Definition: Detector.cc:166
solver_t * s
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:211
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
Key< int > calib
Definition: Exposure.cc:65
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:66
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
STL class.
Information about a CCD or other imaging detector.
Definition: Detector.h:61
static std::shared_ptr< ExposureTable > make(Schema const &schema)
Construct a new table.
Definition: Exposure.cc:379
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.
Key< U > key
Definition: Schema.cc:281
static ExposureCatalogT readFromArchive(io::InputArchive const &archive, BaseCatalog const &catalog)
Convenience input function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:442
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:430
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:144
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
ItemVariant const * other
Definition: Schema.cc:56
Key< int > detector
Definition: Exposure.cc:70
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...
void _assign(BaseRecord const &other) override
Called by assign() after transferring fields to allow subclass data members to be copied...
Definition: Exposure.cc:364
Key< int > psf
Definition: Exposure.cc:64
An integer coordinate rectangle.
Definition: Box.h:54
void readCell(BaseRecord &record, std::size_t row, fits::Fits &fits, std::shared_ptr< io::InputArchive > const &archive) const override
Definition: Exposure.cc:262
lsst::geom::Box2I getBBox() const
Definition: Exposure.cc:326
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:44
ExposureRecord(ExposureRecord const &)=delete
SchemaMapper * mapper
Definition: SchemaMapper.cc:78
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
int row
Definition: CR.cc:145