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 {
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; }
131 void setVisitInfo(std::shared_ptr<image::VisitInfo const> visitInfo) { _visitInfo = visitInfo; }
135 explicit ExposureRecord(std::shared_ptr<ExposureTable>
const& table);
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;
177 Schema r = getMinimalSchema().schema;
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;
296 template <
typename InputIterator>
299 :
Base(table, first, last, deep) {}
307 template <
typename OtherRecordT>
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;
441 #endif // !AFW_TABLE_Exposure_h_INCLUDED
std::int64_t RecordId
Type used for unique IDs for records.
Defines the fields and offsets for a table.
std::shared_ptr< ExposureTable > clone() const
Return a polymorphic deep copy of the table.
std::shared_ptr< detection::Psf const > getPsf() const
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
Writer object for FITS binary tables.
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
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.
void setBBox(geom::Box2I const &bbox)
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).
void setWcs(std::shared_ptr< image::Wcs const > wcs)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
A mapping between the keys of two Schemas, used to copy data between them.
void setCalib(std::shared_ptr< image::Calib const > calib)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
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.
ExposureTable(Schema const &schema)
std::shared_ptr< ExposureRecord > copyRecord(BaseRecord const &other)
Deep-copy a record, requiring that it have the same schema as this table.
void setApCorrMap(std::shared_ptr< image::ApCorrMap const > apCorrMap)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
void writeToArchive(io::OutputArchiveHandle &handle, bool ignoreUnpersistable=true) const
Convenience output function for Persistables that contain an ExposureCatalog.
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
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.
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.
ExposureCatalogT< Record > Catalog
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...
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.
std::shared_ptr< image::Calib const > getCalib() const
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
std::shared_ptr< BaseRecord > copyRecord(BaseRecord const &input)
Deep-copy a record, requiring that it have the same schema as this table.
ExposureCatalogT< ExposureRecord const > ConstCatalog
bool contains(Coord const &coord, bool includeValidPolygon=false) const
Return true if the bounding box contains the given celestial coordinate point, taking into account th...
SortedCatalogT< 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...
geom::Box2I getBBox() const
ExposureRecord(std::shared_ptr< ExposureTable > const &table)
void setPsf(std::shared_ptr< detection::Psf const > psf)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
std::shared_ptr< Table > getTable() const
Return the table associated with the catalog.
std::shared_ptr< BaseTable const > getTable() const
Return the table this record is associated with.
static ExposureCatalogT readFromArchive(io::InputArchive const &archive, BaseCatalog const &catalog)
Convenience input function for Persistables that contain an ExposureCatalog.
Lifetime-management for memory that goes into FITS memory files.
Iterator class for CatalogT.
std::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
ExposureCatalogT subsetContaining(Coord const &coord, bool includeValidPolygon=false) const
Return a shallow subset of the catalog with only those records that contain the given point...
static PointKey< int > getBBoxMinKey()
Key for the minimum point of the bbox.
static Key< RecordId > getIdKey()
Get keys for standard fields shared by all references.
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
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
ExposureCatalogT subset(std::ptrdiff_t startd, std::ptrdiff_t stopd, std::ptrdiff_t step) const
Shallow copy a subset of another ExposureCatalog.
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
std::shared_ptr< image::ApCorrMap const > getApCorrMap() const
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
Custom catalog class for ExposureRecord/Table.
std::shared_ptr< image::Wcs const > getWcs() 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.
static std::shared_ptr< ExposureTable > make(Schema const &schema)
Construct a new table.
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
Record class used to store exposure metadata.
ExposureCatalogT< ExposureRecord > ExposureCatalog
void writeFits(std::string const &filename, std::string const &mode="w", int flags=0) const
Write a FITS binary table to a regular file.
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.
ExposureCatalogT< ExposureRecord > Catalog
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
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.
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< ExposureTable const > getTable() const
ExposureCatalogT(Schema const &schema)
Construct a vector from a schema, creating a table with Table::make(schema).
void setValidPolygon(std::shared_ptr< geom::polygon::Polygon const > polygon)
Get/Set the the attached Wcs, Psf, Calib, or ApCorrMap. No copies are made.
Base class for all tables.
afw::table::Schema schema
virtual void _assign(BaseRecord const &other)
Called by assign() after transferring fields to allow subclass data members to be copied...
static PointKey< int > getBBoxMaxKey()
Key for the maximum point of the bbox.