26 #ifndef AFW_TABLE_Source_h_INCLUDED
27 #define AFW_TABLE_Source_h_INCLUDED
29 #include "boost/array.hpp"
30 #include "boost/type_traits/is_convertible.hpp"
41 namespace lsst {
namespace afw {
88 std::shared_ptr<Footprint>
getFootprint()
const {
return _footprint; }
90 void setFootprint(std::shared_ptr<Footprint>
const & footprint) { _footprint = footprint; }
92 std::shared_ptr<SourceTable const>
getTable()
const {
189 explicit SourceRecord(std::shared_ptr<SourceTable>
const & table);
197 std::shared_ptr<Footprint> _footprint;
223 static std::shared_ptr<SourceTable>
make(
Schema const &
schema, std::shared_ptr<IdFactory>
const & idFactory);
245 Schema r = getMinimalSchema().schema;
729 std::shared_ptr<BaseTable>
_clone()
const override;
731 std::shared_ptr<BaseRecord>
_makeRecord()
override;
736 struct MinimalSchema {
744 static MinimalSchema & getMinimalSchema();
750 std::shared_ptr<io::FitsWriter> makeFitsWriter(
fits::Fits * fitsfile,
int flags)
const override;
755 template <
typename RecordT>
760 typedef typename RecordT::Table
Table;
811 ndarray::Array<double,1>
const getX()
const {
814 ndarray::Array<double,1>
const getY()
const {
818 ndarray::Array<double,1>
const getIxx()
const {
821 ndarray::Array<double,1>
const getIyy()
const {
824 ndarray::Array<double,1>
const getIxy()
const {
829 template <
typename InputIterator>
841 return this->
get(
getTable()->getPsfFluxSlot().getMeasKey());
845 return this->
get(
getTable()->getPsfFluxSlot().getErrKey());
849 return this->
get(
getTable()->getPsfFluxSlot().getFlagKey());
853 return this->
get(
getTable()->getModelFluxSlot().getMeasKey());
857 return this->
get(
getTable()->getModelFluxSlot().getErrKey());
861 return this->
get(
getTable()->getModelFluxSlot().getFlagKey());
865 return this->
get(
getTable()->getApFluxSlot().getMeasKey());
869 return this->
get(
getTable()->getApFluxSlot().getErrKey());
873 return this->
get(
getTable()->getApFluxSlot().getFlagKey());
877 return this->
get(
getTable()->getInstFluxSlot().getMeasKey());
881 return this->
get(
getTable()->getInstFluxSlot().getErrKey());
885 return this->
get(
getTable()->getInstFluxSlot().getFlagKey());
889 return this->
get(
getTable()->getCalibFluxSlot().getMeasKey());
893 return this->
get(
getTable()->getCalibFluxSlot().getErrKey());
897 return this->
get(
getTable()->getCalibFluxSlot().getFlagKey());
901 return this->
get(
getTable()->getCentroidSlot().getMeasKey());
905 return this->
get(
getTable()->getCentroidSlot().getErrKey());
909 return this->
get(
getTable()->getCentroidSlot().getFlagKey());
913 return this->
get(
getTable()->getShapeSlot().getMeasKey());
917 return this->
get(
getTable()->getShapeSlot().getErrKey());
921 return this->
get(
getTable()->getShapeSlot().getFlagKey());
928 return get(
getTable()->getCentroidKey().getX());
931 return get(
getTable()->getCentroidKey().getY());
934 return get(
getTable()->getShapeKey().getIxx());
937 return get(
getTable()->getShapeKey().getIyy());
940 return get(
getTable()->getShapeKey().getIxy());
945 #endif // !AFW_TABLE_Source_h_INCLUDED
std::shared_ptr< SourceTable const > getTable() const
std::int64_t RecordId
Type used for unique IDs for records.
void handleAliasChange(std::string const &alias) override
FluxSlotDefinition::MeasValue getInstFlux() const
Get the value of the InstFlux slot measurement.
An ellipse core with quadrupole moments as parameters.
Defines the fields and offsets for a table.
FluxSlotDefinition::MeasKey getModelFluxKey() const
Return the key used for the ModelFlux slot measurement value.
Key< Flag > getModelFluxFlagKey() const
Return the key used for the ModelFlux slot failure flag.
std::string getInstFluxDefinition() const
Return the name of the field used for the InstFlux slot.
Column-wise view into a sequence of records that have been allocated contiguously.
Writer object for FITS binary tables.
bool hasApFluxSlot() const
Return true if the ApFlux slot corresponds to a valid field.
FluxSlotDefinition const & getModelFluxSlot() const
Key< Flag > getFlagKey() const
Return the cached Key used to access the slot failure flag.
MeasKey getMeasKey() const
Return the cached Key used to access the slot measurement.
ndarray::Array< double, 1 > const getY() const
ndarray::Array< double, 1 > getModelFlux() const
Get the value of the ModelFlux slot measurement.
ndarray::Array< double, 1 > getModelFluxErr() const
Get the uncertainty on the ModelFlux slot measurement.
SortedCatalogT< SourceRecord const > ConstCatalog
ndarray::Array< double, 1 > getApFlux() const
Get the value of the ApFlux slot measurement.
ErrKey getErrKey() const
Return the cached Key used to access the slot uncertainty.
FluxSlotDefinition::MeasValue getCalibFlux() const
Get the value of the CalibFlux slot measurement.
ndarray::Array< double, 1 > getCalibFlux() const
Get the value of the CalibFlux slot measurement.
Key< Flag > getFlagKey() const
Return the cached Key used to access the slot failure flag.
void defineCalibFlux(std::string const &name)
Set the measurement used for the CalibFlux slot.
std::string getShapeDefinition() const
Return the name of the field used for the Shape slot.
FluxSlotDefinition defCalibFlux
A mapping between the keys of two Schemas, used to copy data between them.
SourceColumnViewT(BaseColumnView const &base)
ndarray::Array< double, 1 > getPsfFluxErr() const
Get the uncertainty on the PsfFlux slot measurement.
double getY() const
Return the centroid slot y coordinate.
bool getModelFluxFlag() const
Return true if the measurement in the ModelFlux slot failed.
bool getPsfFluxFlag() const
Return true if the measurement in the PsfFlux slot failed.
ndarray::Array< double, 1 > const getIxx() const
FluxSlotDefinition::ErrKey getApFluxErrKey() const
Return the key used for the ApFlux slot uncertainty.
ndarray::Array< double, 1 > getCalibFluxErr() const
Get the uncertainty on the CalibFlux slot measurement.
FluxSlotDefinition defPsfFlux
ndarray::Array< double, 1 > getInstFluxErr() const
Get the uncertainty on the InstFlux slot measurement.
void defineInstFlux(std::string const &name)
Set the measurement used for the InstFlux slot.
SourceColumnViewT< SourceRecord > ColumnView
FluxSlotDefinition::ErrValue getModelFluxErr() const
Get the uncertainty on the ModelFlux slot measurement.
std::shared_ptr< Table > getTable() const
Return the table that owns the records.
void disconnectAliases()
Sever the connection between this schema and any others with which it shares aliases.
FluxSlotDefinition::ErrValue getPsfFluxErr() const
Get the uncertainty on the PsfFlux slot measurement.
std::shared_ptr< Footprint > getFootprint() const
Key< Flag > getPsfFluxFlagKey() const
Return the key used for the PsfFlux slot failure flag.
ShapeSlotDefinition::MeasValue getShape() const
Get the value of the Shape slot measurement.
bool getCalibFluxFlag() const
Return true if the measurement in the CalibFlux slot failed.
FluxSlotDefinition const & getCalibFluxSlot() const
SortedCatalogT< Record > Catalog
Implementation of the WCS standard for a any projection.
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
CentroidSlotDefinition::ErrValue getCentroidErr() const
Get the uncertainty on the Centroid slot measurement.
std::string getApFluxDefinition() const
Return the name of the field used for the ApFlux slot.
bool getInstFluxFlag() const
Return true if the measurement in the InstFlux slot failed.
std::shared_ptr< SourceRecord > copyRecord(BaseRecord const &other)
Deep-copy a record, requiring that it have the same schema as this table.
void definePsfFlux(std::string const &name)
Set the measurement used for the PsfFlux slot.
FluxSlotDefinition::MeasKey getInstFluxKey() const
Return the key used for the InstFlux slot measurement value.
FluxSlotDefinition::ErrValue getInstFluxErr() const
Get the uncertainty on the InstFlux slot measurement.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
CentroidSlotDefinition defCentroid
ndarray::Array< double, 1 > getPsfFlux() const
Get the value of the PsfFlux slot measurement.
double getX() const
Return the centroid slot x coordinate.
CentroidSlotDefinition::ErrKey getCentroidErrKey() const
Return the key used for the Centroid slot uncertainty.
FluxSlotDefinition::ErrKey getModelFluxErrKey() const
Return the key used for the ModelFlux slot uncertainty.
bool hasCentroidSlot() const
Return true if the Centroid slot corresponds to a valid field.
An aggregate containing all of the current slots used in SourceTable.
Key< Flag > getCentroidFlagKey() const
Return the key used for the Centroid slot failure flag.
FluxSlotDefinition::ErrKey getCalibFluxErrKey() const
Return the key used for the CalibFlux slot uncertainty.
std::shared_ptr< BaseRecord > copyRecord(BaseRecord const &input)
Deep-copy a record, requiring that it have the same schema as this table.
bool isValid() const
Return true if the key associated with the measurement is valid.
CentroidSlotDefinition::MeasValue getCentroid() const
Get the value of the Centroid slot measurement.
ndarray::ArrayRef< T, 1 > const operator[](Key< T > const &key) const
Return a 1-d array corresponding to a scalar field (or subfield).
bool isValid() const
Return true if the key associated with the measurement is valid.
Table class that must contain a unique ID field and a celestial coordinate field. ...
ndarray::Array< double, 1 > const getIxy() const
ErrKey getErrKey() const
Return the cached Key used to access the slot uncertainty.
ShapeSlotDefinition::MeasKey getShapeKey() const
Return the key used for the Shape slot measurement value.
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< BaseTable const > getTable() const
Return the table this record is associated with.
ndarray::Array< double, 1 > const getX() const
static BaseColumnView make(std::shared_ptr< BaseTable > const &table, InputIterator first, InputIterator last)
Construct a BaseColumnView from an iterator range.
Key< Flag > getShapeFlagKey() const
Return the key used for the Shape slot failure flag.
ShapeSlotDefinition defShape
Key< Flag > getInstFluxFlagKey() const
Return the key used for the InstFlux slot failure flag.
static SourceColumnViewT make(std::shared_ptr< Table > const &table, InputIterator first, InputIterator last)
Construct a BaseColumnView from an iterator range.
static std::shared_ptr< IdFactory > makeSimple()
Return a simple IdFactory that simply counts from 1.
FluxSlotDefinition::MeasValue getModelFlux() const
Get the value of the ModelFlux slot measurement.
FluxSlotDefinition::ErrValue getCalibFluxErr() const
Get the uncertainty on the CalibFlux slot measurement.
ShapeSlotDefinition const & getShapeSlot() const
FluxSlotDefinition::ErrKey getInstFluxErrKey() const
Return the key used for the InstFlux slot uncertainty.
FluxSlotDefinition defModelFlux
Key< Flag > getFlagKey() const
Return the cached Key used to access the slot failure flag.
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
std::string getModelFluxDefinition() const
Return the name of the field used for the ModelFlux slot.
FluxSlotDefinition::MeasKey getCalibFluxKey() const
Return the key used for the CalibFlux slot measurement value.
table::Key< std::string > name
static Schema makeMinimalSchema()
Return a minimal schema for Source tables and records.
FluxSlotDefinition::MeasKey getApFluxKey() const
Return the key used for the ApFlux slot measurement value.
SourceColumnViewT< SourceRecord > SourceColumnView
FluxSlotDefinition const & getApFluxSlot() const
SortedCatalogT< SourceRecord > Catalog
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.
Key< Flag > getApFluxFlagKey() const
Return the key used for the ApFlux slot failure flag.
SortedCatalogT< Record const > ConstCatalog
bool hasInstFluxSlot() const
Return true if the InstFlux slot corresponds to a valid field.
bool hasShapeSlot() const
Return true if the Shape slot corresponds to a valid field.
RecordId getParent() const
Convenience accessors for the keys in the minimal source schema.
Key< Flag > getCalibFluxFlagKey() const
Return the key used for the CalibFlux slot failure flag.
ndarray::Array< double, 1 > getApFluxErr() const
Get the uncertainty on the ApFlux slot measurement.
void defineModelFlux(std::string const &name)
Set the measurement used for the ModelFlux slot.
SourceFitsFlags
Bitflags to be passed to SourceCatalog::readFits and SourceCatalog::writeFits.
FluxSlotDefinition defInstFlux
Table class that contains measurements made on a single exposure.
static std::shared_ptr< SourceTable > make(Schema const &schema)
Construct a new table.
MeasKey getMeasKey() const
Return the cached Key used to access the slot measurement.
ShapeSlotDefinition::ErrKey getShapeErrKey() const
Return the key used for the Shape slot uncertainty.
bool hasModelFluxSlot() const
Return true if the ModelFlux slot corresponds to a valid field.
Base class for all records.
MeasKey getMeasKey() const
Return the cached Key used to access the slot measurement.
bool isValid() const
Return true if the key associated with the measurement is valid.
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
CentroidSlotDefinition::MeasKey getCentroidKey() const
Return the key used for the Centroid slot measurement value.
void updateCoord(image::Wcs const &wcs)
Update the coord field using the given Wcs and the field in the centroid slot.
Key specialization for Flag.
static std::shared_ptr< SourceTable > make(Schema const &schema, std::shared_ptr< IdFactory > const &idFactory)
Construct a new table.
FluxSlotDefinition::MeasKey getPsfFluxKey() const
Return the key used for the PsfFlux slot measurement value.
FluxSlotDefinition::MeasValue getPsfFlux() const
Get the value of the PsfFlux slot measurement.
void setFootprint(std::shared_ptr< Footprint > const &footprint)
std::shared_ptr< AliasMap > getAliasMap() const
Return the map of aliases.
Eigen::Matrix< float, 3, 3 > ErrValue
Type returned by accessing the slot uncertainty.
SlotDefinition specialization for centroids.
Read/write heavy footprints as non-heavy footprints.
lsst::afw::detection::Footprint Footprint
double getIxy() const
Return the shape slot Ixy value.
FluxSlotDefinition const & getPsfFluxSlot() const
bool hasPsfFluxSlot() const
Return true if the PsfFlux slot corresponds to a valid field.
bool getCentroidFlag() const
Return true if the measurement in the Centroid slot failed.
Schema getSchema() const
Return the table's schema.
bool getApFluxFlag() const
Return true if the measurement in the ApFlux slot failed.
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
std::string getPsfFluxDefinition() const
Return the name of the field used for the PsfFlux slot.
void setParent(RecordId id)
Convenience accessors for the keys in the minimal source schema.
Do not read/write footprints at all.
Record class that contains measurements made on a single exposure.
void defineShape(std::string const &name)
Set the measurement used for the Shape slot.
static Key< RecordId > getParentKey()
Key for the parent ID.
std::shared_ptr< SourceTable > clone() const
Return a polymorphic deep copy of the table.
FluxSlotDefinition const & getInstFluxSlot() const
ShapeSlotDefinition::ErrValue getShapeErr() const
Get the uncertainty on the Shape slot measurement.
void defineCentroid(std::string const &name)
Set the measurement used for the Centroid slot.
double ErrValue
Type returned by accessing the slot uncertainty.
double getIyy() const
Return the shape slot Iyy value.
Record class that must contain a unique ID field and a celestial coordinate field.
virtual void _assign(BaseRecord const &other)
Called by assign() after transferring fields to allow subclass data members to be copied...
FluxSlotDefinition::ErrKey getPsfFluxErrKey() const
Return the key used for the PsfFlux slot uncertainty.
SlotDefinition specialization for shapes.
A FunctorKey used to get or set a geom::ellipses::Quadrupole from a tuple of constituent Keys...
ErrKey getErrKey() const
Return the cached Key used to access the slot uncertainty.
double MeasValue
Type returned by accessing the slot measurement.
std::string getCalibFluxDefinition() const
Return the name of the field used for the CalibFlux slot.
SlotDefinition specialization for fluxes.
SourceTable(Schema const &schema, std::shared_ptr< IdFactory > const &idFactory)
ndarray::Array< double, 1 > getInstFlux() const
Get the value of the InstFlux slot measurement.
CentroidSlotDefinition const & getCentroidSlot() const
SourceRecord(std::shared_ptr< SourceTable > const &table)
void defineApFlux(std::string const &name)
Set the measurement used for the ApFlux slot.
afw::table::Schema schema
FluxSlotDefinition::ErrValue getApFluxErr() const
Get the uncertainty on the ApFlux slot measurement.
bool getShapeFlag() const
Return true if the measurement in the Shape slot failed.
bool hasCalibFluxSlot() const
Return true if the CalibFlux slot corresponds to a valid field.
FluxSlotDefinition::MeasValue getApFlux() const
Get the value of the ApFlux slot measurement.
double getIxx() const
Return the shape slot Ixx value.
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid SourceTable schema.
std::string getCentroidDefinition() const
Return the name of the field used for the Centroid slot.
SourceColumnViewT< SourceRecord > ColumnView
FluxSlotDefinition defApFlux
ndarray::Array< double, 1 > const getIyy() const
std::shared_ptr< SourceRecord > makeRecord()
Default-construct an associated record.
Eigen::Matrix< float, 2, 2 > ErrValue
Type returned by accessing the slot uncertainty.