23 #ifndef AFW_TABLE_Exposure_h_INCLUDED 24 #define AFW_TABLE_Exposure_h_INCLUDED 59 template <
typename RecordT>
64 class OutputArchiveHandle;
79 std::shared_ptr<ExposureTable const>
getTable()
const {
80 return std::static_pointer_cast<
ExposureTable const>(BaseRecord::getTable());
99 bool contains(
Coord const& coord,
bool includeValidPolygon =
false)
const;
114 std::shared_ptr<image::Wcs const> getWcs()
const {
return _wcs; }
116 void setWcs(std::shared_ptr<image::Wcs const> wcs) { _wcs = wcs; }
118 std::shared_ptr<detection::Psf const>
getPsf()
const {
return _psf; }
119 void setPsf(std::shared_ptr<detection::Psf const> psf) {
_psf = psf; }
121 std::shared_ptr<image::Calib const>
getCalib()
const {
return _calib; }
122 void setCalib(std::shared_ptr<image::Calib const>
calib) { _calib = calib; }
124 std::shared_ptr<image::ApCorrMap const>
getApCorrMap()
const {
return _apCorrMap; }
125 void setApCorrMap(std::shared_ptr<image::ApCorrMap const> apCorrMap) { _apCorrMap = apCorrMap; }
127 std::shared_ptr<geom::polygon::Polygon const>
getValidPolygon()
const {
return _validPolygon; }
128 void setValidPolygon(std::shared_ptr<geom::polygon::Polygon const> polygon) { _validPolygon = polygon; }
130 std::shared_ptr<image::VisitInfo const>
getVisitInfo()
const {
return _visitInfo; }
135 explicit ExposureRecord(std::shared_ptr<ExposureTable>
const& table);
137 virtual void _assign(
BaseRecord const& other);
142 std::shared_ptr<image::Wcs const> _wcs;
143 std::shared_ptr<detection::Psf const>
_psf;
144 std::shared_ptr<image::Calib const> _calib;
145 std::shared_ptr<image::ApCorrMap const> _apCorrMap;
146 std::shared_ptr<geom::polygon::Polygon const> _validPolygon;
147 std::shared_ptr<image::VisitInfo const> _visitInfo;
167 static std::shared_ptr<ExposureTable> make(
Schema const&
schema);
177 Schema r = getMinimalSchema().schema;
196 static Key<RecordId> getIdKey() {
return getMinimalSchema().id; }
205 std::shared_ptr<ExposureTable>
clone()
const {
return std::static_pointer_cast<
ExposureTable>(_clone()); }
214 return std::static_pointer_cast<
ExposureRecord>(BaseTable::copyRecord(other));
219 return std::static_pointer_cast<
ExposureRecord>(BaseTable::copyRecord(other, mapper));
227 std::shared_ptr<BaseTable> _clone()
const override;
229 std::shared_ptr<BaseRecord> _makeRecord()
override;
233 struct MinimalSchema {
243 static MinimalSchema& getMinimalSchema();
247 template <
typename RecordT>
251 std::shared_ptr<io::FitsWriter> makeFitsWriter(
fits::Fits* fitsfile,
int flags)
const override;
253 std::shared_ptr<io::FitsWriter> makeFitsWriter(
fits::Fits* fitsfile,
254 std::shared_ptr<io::OutputArchive> archive,
264 template <
typename RecordT>
270 typedef typename Record::Table
Table;
281 explicit ExposureCatalogT(std::shared_ptr<Table>
const& table = std::shared_ptr<Table>()) : Base(table) {}
296 template <
typename InputIterator>
299 : Base(table, first, last, deep) {}
307 template <
typename OtherRecordT>
310 using Base::writeFits;
320 std::shared_ptr<io::FitsWriter> writer = this->getTable()->makeFitsWriter(&fitsfile, archive, flags);
321 writer->write(*
this);
334 return io::FitsReader::apply<ExposureCatalogT>(filename, hdu, flags);
347 return io::FitsReader::apply<ExposureCatalogT>(manager, hdu, flags);
358 return io::FitsReader::apply<ExposureCatalogT>(fitsfile, flags);
369 return io::FitsReader::apply<ExposureCatalogT>(fitsfile, flags, archive);
425 bool includeValidPolygon =
false)
const;
435 inline RecordId ExposureRecord::getId()
const {
return get(ExposureTable::getIdKey()); }
436 inline void ExposureRecord::setId(
RecordId id) {
set(ExposureTable::getIdKey(), id); }
441 #endif // !AFW_TABLE_Exposure_h_INCLUDED std::int64_t RecordId
Type used for unique IDs for records.
std::shared_ptr< ExposureTable > clone() const
Return a polymorphic deep copy of the table.
std::shared_ptr< ExposureTable const > getTable() const
Defines the fields and offsets for a table.
void setValidPolygon(std::shared_ptr< geom::polygon::Polygon const > polygon)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
ExposureCatalogT< RecordT > subset(ndarray::Array< bool const, 1 > const &mask) const
Return the subset of a catalog corresponding to the True values of the given mask array...
Writer object for FITS binary tables.
std::shared_ptr< image::ApCorrMap const > getApCorrMap() const
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
ColumnViewT< ExposureRecord > ColumnView
ExposureCatalogT< ExposureRecord const > ConstExposureCatalog
An object passed to Persistable::write to allow it to persist itself.
ExposureCatalogT(Base const &other)
ExposureCatalogT(std::shared_ptr< Table > const &table, InputIterator first, InputIterator last, bool deep=false)
Construct a vector from a table and an iterator range.
Table class used to store exposure metadata.
A custom container class for records, based on std::vector.
ColumnViewT< ExposureRecord > ExposureColumnView
ExposureCatalogT(std::shared_ptr< Table > const &table=std::shared_ptr< Table >())
Construct a vector from a table (or nothing).
A mapping between the keys of two Schemas, used to copy data between them.
table::PointKey< int > bboxMin
ExposureCatalogT< Record const > ConstCatalog
static Schema makeMinimalSchema()
Return a minimal schema for Exposure tables and records.
void disconnectAliases()
Sever the connection between this schema and any others with which it shares aliases.
std::shared_ptr< ExposureRecord > copyRecord(BaseRecord const &other)
Deep-copy a record, requiring that it have the same schema as this table.
static ExposureCatalogT readFits(std::string const &filename, int hdu=INT_MIN, int flags=0)
Read a FITS binary table from a regular file.
Implementation of the WCS standard for a any projection.
table::PointKey< int > bboxMax
void setVisitInfo(std::shared_ptr< image::VisitInfo const > visitInfo)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
ColumnViewT< ExposureRecord > ColumnView
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
std::shared_ptr< ExposureRecord > copyRecord(BaseRecord const &other, SchemaMapper const &mapper)
Deep-copy a record, requiring that it have the same schema as this table.
std::shared_ptr< detection::Psf const > getPsf() const
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
static ExposureCatalogT readFits(fits::Fits &fitsfile, int flags=0)
Read a FITS binary table from a file object already at the correct extension.
ExposureCatalogT(ExposureCatalogT< OtherRecordT > const &other)
Shallow copy constructor from a container containing a related record type.
std::shared_ptr< image::Calib const > getCalib() const
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
ExposureCatalogT< Record > Catalog
static ExposureCatalogT readFits(fits::MemFileManager &manager, int hdu=INT_MIN, int flags=0)
Read a FITS binary table from a RAM file.
An integer coordinate rectangle.
void setWcs(std::shared_ptr< image::Wcs const > wcs)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
ExposureCatalogT< ExposureRecord const > ConstCatalog
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.
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
Lifetime-management for memory that goes into FITS memory files.
Iterator class for CatalogT.
void setCalib(std::shared_ptr< image::Calib const > calib)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
void writeFits(fits::Fits &fitsfile, std::shared_ptr< io::OutputArchive > archive, int flags=0) const
Write a FITS binary table to an open file object.
static PointKey< int > getBBoxMinKey()
Key for the minimum point of the bbox.
void setPsf(std::shared_ptr< detection::Psf const > psf)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
Base class for all records.
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid ExposureTable schema.
Base::const_iterator const_iterator
Custom catalog class for ExposureRecord/Table.
std::shared_ptr< image::VisitInfo const > getVisitInfo() const
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
std::shared_ptr< ExposureRecord > makeRecord()
Default-construct an associated record.
Record class used to store exposure metadata.
std::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
ExposureCatalogT< ExposureRecord > ExposureCatalog
ExposureCatalogT< ExposureRecord > Catalog
This is the base class for spherical coordinates.
static ExposureCatalogT readFits(fits::Fits &fitsfile, std::shared_ptr< io::InputArchive > archive, int flags=0)
Read a FITS binary table from a file object already at the correct extension.
ExposureCatalogT(Schema const &schema)
Construct a vector from a schema, creating a table with Table::make(schema).
ExposureCatalogT subset(std::ptrdiff_t startd, std::ptrdiff_t stopd, std::ptrdiff_t step) const
Shallow copy a subset of another ExposureCatalog.
Base class for all tables.
afw::table::Schema schema
void setApCorrMap(std::shared_ptr< image::ApCorrMap const > apCorrMap)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
static PointKey< int > getBBoxMaxKey()
Key for the maximum point of the bbox.