24#ifndef AFW_TABLE_Source_h_INCLUDED
25#define AFW_TABLE_Source_h_INCLUDED
62template <
typename RecordT>
259 Schema r = getMinimalSchema().schema;
280 return std::static_pointer_cast<SourceRecord>(
_makeRecord());
401 struct MinimalSchema {
409 static MinimalSchema &getMinimalSchema();
420template <
typename RecordT>
424 using Table =
typename RecordT::Table;
474 ndarray::Array<double, 1>
const getX()
const {
477 ndarray::Array<double, 1>
const getY()
const {
481 ndarray::Array<double, 1>
const getIxx()
const {
484 ndarray::Array<double, 1>
const getIyy()
const {
487 ndarray::Array<double, 1>
const getIxy()
const {
492 template <
typename InputIterator>
508using SourceColumnView = SourceColumnViewT<SourceRecord>;
511 return this->
get(
getTable()->getPsfFluxSlot().getMeasKey());
515 return this->
get(
getTable()->getPsfFluxSlot().getErrKey());
519 return this->
get(
getTable()->getPsfFluxSlot().getFlagKey());
523 return this->
get(
getTable()->getModelFluxSlot().getMeasKey());
527 return this->
get(
getTable()->getModelFluxSlot().getErrKey());
531 return this->
get(
getTable()->getModelFluxSlot().getFlagKey());
535 return this->
get(
getTable()->getApFluxSlot().getMeasKey());
539 return this->
get(
getTable()->getApFluxSlot().getErrKey());
543 return this->
get(
getTable()->getApFluxSlot().getFlagKey());
547 return this->
get(
getTable()->getGaussianFluxSlot().getMeasKey());
551 return this->
get(
getTable()->getGaussianFluxSlot().getErrKey());
555 return this->
get(
getTable()->getGaussianFluxSlot().getFlagKey());
559 return this->
get(
getTable()->getCalibFluxSlot().getMeasKey());
563 return this->
get(
getTable()->getCalibFluxSlot().getErrKey());
567 return this->
get(
getTable()->getCalibFluxSlot().getFlagKey());
571 return this->
get(
getTable()->getCentroidSlot().getMeasKey());
575 return this->
get(
getTable()->getCentroidSlot().getErrKey());
579 return this->
get(
getTable()->getCentroidSlot().getFlagKey());
583 return this->
get(
getTable()->getShapeSlot().getMeasKey());
587 return this->
get(
getTable()->getShapeSlot().getErrKey());
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
An ellipse core with quadrupole moments as parameters.
Tag types used to declare specialized field types.
Column-wise view into a sequence of records that have been allocated contiguously.
static BaseColumnView make(std::shared_ptr< BaseTable > const &table, InputIterator first, InputIterator last)
Construct a BaseColumnView from an iterator range.
ndarray::ArrayRef< T, 1 > const operator[](Key< T > const &key) const
Return a 1-d array corresponding to a scalar field (or subfield).
Base class for all records.
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
std::shared_ptr< BaseTable const > getTable() const
Return the table this record is associated with.
Schema getSchema() const
Return the table's schema.
std::shared_ptr< BaseRecord > copyRecord(BaseRecord const &input)
Deep-copy a record, requiring that it have the same schema as this table.
SlotDefinition specialization for centroids.
Eigen::Matrix< float, 2, 2 > ErrValue
Type returned by accessing the slot uncertainty.
std::shared_ptr< Table > getTable() const
Return the table that owns the records.
SlotDefinition specialization for fluxes.
static std::shared_ptr< IdFactory > makeSimple()
Return a simple IdFactory that simply counts from 1.
Defines the fields and offsets for a table.
void disconnectAliases()
Sever the connection between this schema and any others with which it shares aliases.
std::shared_ptr< AliasMap > getAliasMap() const
Return the map of aliases.
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
A mapping between the keys of two Schemas, used to copy data between them.
SlotDefinition specialization for shapes.
Eigen::Matrix< float, 3, 3 > ErrValue
Type returned by accessing the slot uncertainty.
Record class that must contain a unique ID field and a celestial coordinate field.
Table class that must contain a unique ID field and a celestial coordinate field.
ndarray::Array< double, 1 > getApInstFluxErr() const
Get the uncertainty on the ApFlux slot measurement.
typename RecordT::Table Table
ndarray::Array< double, 1 > const getY() const
ndarray::Array< double, 1 > getModelInstFluxErr() const
Get the uncertainty on the ModelFlux slot measurement.
ndarray::Array< double, 1 > getPsfInstFluxErr() const
Get the uncertainty on the PsfFlux slot measurement.
SourceColumnViewT(BaseColumnView const &base)
ndarray::Array< double, 1 > getGaussianInstFluxErr() const
Get the uncertainty on the GaussianFlux slot measurement.
SourceColumnViewT & operator=(SourceColumnViewT const &)=default
SourceColumnViewT & operator=(SourceColumnViewT &&)=default
ndarray::Array< double, 1 > getCalibInstFlux() const
Get the value of the CalibFlux slot measurement.
~SourceColumnViewT()=default
static SourceColumnViewT make(std::shared_ptr< Table > const &table, InputIterator first, InputIterator last)
Construct a BaseColumnView from an iterator range.
ndarray::Array< double, 1 > getCalibInstFluxErr() const
Get the uncertainty on the CalibFlux slot measurement.
ndarray::Array< double, 1 > getApInstFlux() const
Get the value of the ApFlux slot measurement.
ndarray::Array< double, 1 > const getIyy() const
SourceColumnViewT(SourceColumnViewT &&)=default
ndarray::Array< double, 1 > getGaussianInstFlux() const
Get the value of the GaussianFlux slot measurement.
SourceColumnViewT(SourceColumnViewT const &)=default
ndarray::Array< double, 1 > const getX() const
ndarray::Array< double, 1 > const getIxx() const
ndarray::Array< double, 1 > const getIxy() const
ndarray::Array< double, 1 > getModelInstFlux() const
Get the value of the ModelFlux slot measurement.
ndarray::Array< double, 1 > getPsfInstFlux() const
Get the value of the PsfFlux slot measurement.
Record class that contains measurements made on a single exposure.
FluxSlotDefinition::ErrValue getCalibInstFluxErr() const
Get the uncertainty on the CalibFlux slot measurement.
virtual void _assign(BaseRecord const &other)
Called by assign() after transferring fields to allow subclass data members to be copied.
double getIxx() const
Return the shape slot Ixx value.
bool getCalibFluxFlag() const
Return true if the measurement in the CalibFlux slot failed.
FluxSlotDefinition::ErrValue getGaussianInstFluxErr() const
Get the uncertainty on the GaussianFlux slot measurement.
bool getShapeFlag() const
Return true if the measurement in the Shape slot failed.
double getX() const
Return the centroid slot x coordinate.
SourceRecord & operator=(const SourceRecord &)=delete
double getY() const
Return the centroid slot y coordinate.
FluxSlotDefinition::MeasValue getGaussianInstFlux() const
Get the value of the GaussianFlux slot measurement.
double getIyy() const
Return the shape slot Iyy value.
CentroidSlotDefinition::MeasValue getCentroid() const
Get the value of the Centroid slot measurement.
bool getCentroidFlag() const
Return true if the measurement in the Centroid slot failed.
FluxSlotDefinition::MeasValue getApInstFlux() const
Get the value of the ApFlux slot measurement.
std::shared_ptr< SourceTable const > getTable() const
bool getModelFluxFlag() const
Return true if the measurement in the ModelFlux slot failed.
void setParent(RecordId id)
FluxSlotDefinition::MeasValue getModelInstFlux() const
Get the value of the ModelFlux slot measurement.
double getIxy() const
Return the shape slot Ixy value.
SourceRecord(const SourceRecord &)=delete
ShapeSlotDefinition::ErrValue getShapeErr() const
Get the uncertainty on the Shape slot measurement.
FluxSlotDefinition::ErrValue getPsfInstFluxErr() const
Get the uncertainty on the PsfFlux slot measurement.
std::shared_ptr< Footprint > getFootprint() const
ShapeSlotDefinition::MeasValue getShape() const
Get the value of the Shape slot measurement.
RecordId getParent() const
Convenience accessors for the keys in the minimal source schema.
CentroidSlotDefinition::ErrValue getCentroidErr() const
Get the uncertainty on the Centroid slot measurement.
FluxSlotDefinition::MeasValue getPsfInstFlux() const
Get the value of the PsfFlux slot measurement.
SourceRecord & operator=(SourceRecord &&)=delete
FluxSlotDefinition::ErrValue getApInstFluxErr() const
Get the uncertainty on the ApFlux slot measurement.
SourceRecord(SourceRecord &&)=delete
void setFootprint(std::shared_ptr< Footprint > const &footprint)
bool getGaussianFluxFlag() const
Return true if the measurement in the GaussianFlux slot failed.
FluxSlotDefinition::ErrValue getModelInstFluxErr() const
Get the uncertainty on the ModelFlux slot measurement.
FluxSlotDefinition::MeasValue getCalibInstFlux() const
Get the value of the CalibFlux slot measurement.
bool getPsfFluxFlag() const
Return true if the measurement in the PsfFlux slot failed.
SourceRecord(ConstructionToken const &token, detail::RecordData &&data)
Constructor used by SourceTable.
bool getApFluxFlag() const
Return true if the measurement in the ApFlux slot failed.
void updateCoord(geom::SkyWcs const &wcs, bool include_covariance=true)
Update the coord field using the given Wcs and the field in the centroid slot.
Table class that contains measurements made on a single exposure.
std::shared_ptr< SourceRecord > copyRecord(BaseRecord const &other)
Deep-copy a record, requiring that it have the same schema as this table.
SourceTable & operator=(SourceTable const &)=delete
void defineCalibFlux(std::string const &name)
Set the measurement used for the CalibFlux slot.
static std::shared_ptr< SourceTable > make(Schema const &schema, std::shared_ptr< IdFactory > const &idFactory)
Construct a new table.
SourceTable(SourceTable const &other)
SourceTable & operator=(SourceTable &&)=delete
std::shared_ptr< SourceRecord > makeRecord()
Default-construct an associated record.
friend class SourceRecord
SourceTable(Schema const &schema, std::shared_ptr< IdFactory > const &idFactory)
void defineApFlux(std::string const &name)
Set the measurement used for the ApFlux slot.
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
void definePsfFlux(std::string const &name)
Set the measurement used for the PsfFlux slot.
FluxSlotDefinition const & getModelFluxSlot() const
static Schema makeMinimalSchema()
Return a minimal schema for Source tables and records.
static Key< RecordId > getParentKey()
Key for the parent ID.
void defineGaussianFlux(std::string const &name)
Set the measurement used for the GaussianFlux slot.
FluxSlotDefinition const & getGaussianFluxSlot() const
std::shared_ptr< SourceTable > clone() const
Return a polymorphic deep copy of the table.
void defineShape(std::string const &name)
Set the measurement used for the Shape slot.
std::shared_ptr< io::FitsWriter > makeFitsWriter(fits::Fits *fitsfile, int flags) const override
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
CentroidSlotDefinition const & getCentroidSlot() const
FluxSlotDefinition const & getPsfFluxSlot() const
void handleAliasChange(std::string const &alias) override
FluxSlotDefinition const & getApFluxSlot() const
ShapeSlotDefinition const & getShapeSlot() const
void defineCentroid(std::string const &name)
Set the measurement used for the Centroid slot.
static std::shared_ptr< SourceTable > make(Schema const &schema)
Construct a new table.
std::shared_ptr< SourceRecord > copyRecord(BaseRecord const &other, SchemaMapper const &mapper)
Deep-copy a record, requiring that it have the same schema as this table.
void defineModelFlux(std::string const &name)
Set the measurement used for the ModelFlux slot.
FluxSlotDefinition const & getCalibFluxSlot() const
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid SourceTable schema.
Writer object for FITS binary tables.
daf::base::PropertySet * set
SourceFitsFlags
Bitflags to be passed to SourceCatalog::readFits and SourceCatalog::writeFits.
@ SOURCE_IO_NO_FOOTPRINTS
Do not read/write footprints at all.
@ SOURCE_IO_NO_HEAVY_FOOTPRINTS
Read/write heavy footprints as non-heavy footprints.
An aggregate containing all of the current slots used in SourceTable.
CentroidSlotDefinition defCentroid
FluxSlotDefinition defModelFlux
FluxSlotDefinition defCalibFlux
FluxSlotDefinition defApFlux
FluxSlotDefinition defPsfFlux
ShapeSlotDefinition defShape
FluxSlotDefinition defGaussianFlux
Helper struct that contains the information passed from BaseTable to BaseRecord at construction.