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 {
92 std::shared_ptr<SourceTable const>
getTable()
const {
93 return std::static_pointer_cast<
SourceTable const>(BaseRecord::getTable());
109 bool getPsfFluxFlag()
const;
118 bool getModelFluxFlag()
const;
127 bool getApFluxFlag()
const;
136 bool getInstFluxFlag()
const;
145 bool getCalibFluxFlag()
const;
154 bool getCentroidFlag()
const;
163 bool getShapeFlag()
const;
173 double getIxx()
const;
176 double getIyy()
const;
179 double getIxy()
const;
189 explicit SourceRecord(std::shared_ptr<SourceTable>
const & table);
191 virtual void _assign(
BaseRecord const & other);
223 static std::shared_ptr<SourceTable> make(
Schema const &
schema, std::shared_ptr<IdFactory>
const &
idFactory);
232 static std::shared_ptr<SourceTable>
make(
Schema const &
schema) {
return make(schema, IdFactory::makeSimple()); }
245 Schema r = getMinimalSchema().schema;
264 std::shared_ptr<SourceTable>
clone()
const {
return std::static_pointer_cast<
SourceTable>(_clone()); }
271 return std::static_pointer_cast<
SourceRecord>(BaseTable::copyRecord(other));
276 return std::static_pointer_cast<
SourceRecord>(BaseTable::copyRecord(other, mapper));
290 getSchema().getAliasMap()->set(getPsfFluxSlot().getAlias(), name);
303 return getSchema().getAliasMap()->get(getPsfFluxSlot().getAlias());
312 return getPsfFluxSlot().isValid();
321 return getPsfFluxSlot().getMeasKey();
330 return getPsfFluxSlot().getErrKey();
339 return getPsfFluxSlot().getFlagKey();
353 getSchema().getAliasMap()->set(getModelFluxSlot().getAlias(), name);
366 return getSchema().getAliasMap()->get(getModelFluxSlot().getAlias());
375 return getModelFluxSlot().isValid();
384 return getModelFluxSlot().getMeasKey();
393 return getModelFluxSlot().getErrKey();
402 return getModelFluxSlot().getFlagKey();
416 getSchema().getAliasMap()->set(getApFluxSlot().getAlias(), name);
429 return getSchema().getAliasMap()->get(getApFluxSlot().getAlias());
438 return getApFluxSlot().isValid();
447 return getApFluxSlot().getMeasKey();
456 return getApFluxSlot().getErrKey();
465 return getApFluxSlot().getFlagKey();
479 getSchema().getAliasMap()->set(getInstFluxSlot().getAlias(), name);
492 return getSchema().getAliasMap()->get(getInstFluxSlot().getAlias());
501 return getInstFluxSlot().isValid();
510 return getInstFluxSlot().getMeasKey();
519 return getInstFluxSlot().getErrKey();
528 return getInstFluxSlot().getFlagKey();
542 getSchema().getAliasMap()->set(getCalibFluxSlot().getAlias(), name);
555 return getSchema().getAliasMap()->get(getCalibFluxSlot().getAlias());
564 return getCalibFluxSlot().isValid();
573 return getCalibFluxSlot().getMeasKey();
582 return getCalibFluxSlot().getErrKey();
591 return getCalibFluxSlot().getFlagKey();
605 getSchema().getAliasMap()->set(getCentroidSlot().getAlias(), name);
618 return getSchema().getAliasMap()->get(getCentroidSlot().getAlias());
627 return getCentroidSlot().isValid();
636 return getCentroidSlot().getMeasKey();
645 return getCentroidSlot().getErrKey();
654 return getCentroidSlot().getFlagKey();
668 getSchema().getAliasMap()->set(getShapeSlot().getAlias(), name);
681 return getSchema().getAliasMap()->get(getShapeSlot().getAlias());
690 return getShapeSlot().isValid();
699 return getShapeSlot().getMeasKey();
708 return getShapeSlot().getErrKey();
717 return getShapeSlot().getFlagKey();
727 void handleAliasChange(std::string
const & alias)
override;
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;
767 return this->operator[](this->getTable()->getPsfFluxSlot().getMeasKey());
771 return this->operator[](this->getTable()->getPsfFluxSlot().getErrKey());
776 return this->operator[](this->getTable()->getApFluxSlot().getMeasKey());
780 return this->operator[](this->getTable()->getApFluxSlot().getErrKey());
785 return this->operator[](this->getTable()->getModelFluxSlot().getMeasKey());
789 return this->operator[](this->getTable()->getModelFluxSlot().getErrKey());
794 return this->operator[](this->getTable()->getInstFluxSlot().getMeasKey());
798 return this->operator[](this->getTable()->getInstFluxSlot().getErrKey());
803 return this->operator[](this->getTable()->getCalibFluxSlot().getMeasKey());
807 return this->operator[](this->getTable()->getCalibFluxSlot().getErrKey());
811 ndarray::Array<double,1>
const getX()
const {
812 return this->operator[](this->getTable()->getCentroidKey().getX());
814 ndarray::Array<double,1>
const getY()
const {
815 return this->operator[](this->getTable()->getCentroidKey().getY());
818 ndarray::Array<double,1>
const getIxx()
const {
819 return this->operator[](this->getTable()->getShapeKey().getIxx());
821 ndarray::Array<double,1>
const getIyy()
const {
822 return this->operator[](this->getTable()->getShapeKey().getIyy());
824 ndarray::Array<double,1>
const getIxy()
const {
825 return this->operator[](this->getTable()->getShapeKey().getIxy());
829 template <
typename InputIterator>
841 return this->
get(getTable()->getPsfFluxSlot().getMeasKey());
845 return this->
get(getTable()->getPsfFluxSlot().getErrKey());
848 inline bool SourceRecord::getPsfFluxFlag()
const {
849 return this->
get(getTable()->getPsfFluxSlot().getFlagKey());
853 return this->
get(getTable()->getModelFluxSlot().getMeasKey());
857 return this->
get(getTable()->getModelFluxSlot().getErrKey());
860 inline bool SourceRecord::getModelFluxFlag()
const {
861 return this->
get(getTable()->getModelFluxSlot().getFlagKey());
865 return this->
get(getTable()->getApFluxSlot().getMeasKey());
869 return this->
get(getTable()->getApFluxSlot().getErrKey());
872 inline bool SourceRecord::getApFluxFlag()
const {
873 return this->
get(getTable()->getApFluxSlot().getFlagKey());
877 return this->
get(getTable()->getInstFluxSlot().getMeasKey());
881 return this->
get(getTable()->getInstFluxSlot().getErrKey());
884 inline bool SourceRecord::getInstFluxFlag()
const {
885 return this->
get(getTable()->getInstFluxSlot().getFlagKey());
889 return this->
get(getTable()->getCalibFluxSlot().getMeasKey());
893 return this->
get(getTable()->getCalibFluxSlot().getErrKey());
896 inline bool SourceRecord::getCalibFluxFlag()
const {
897 return this->
get(getTable()->getCalibFluxSlot().getFlagKey());
901 return this->
get(getTable()->getCentroidSlot().getMeasKey());
905 return this->
get(getTable()->getCentroidSlot().getErrKey());
908 inline bool SourceRecord::getCentroidFlag()
const {
909 return this->
get(getTable()->getCentroidSlot().getFlagKey());
913 return this->
get(getTable()->getShapeSlot().getMeasKey());
917 return this->
get(getTable()->getShapeSlot().getErrKey());
920 inline bool SourceRecord::getShapeFlag()
const {
921 return this->
get(getTable()->getShapeSlot().getFlagKey());
925 inline RecordId SourceRecord::getParent()
const {
return get(SourceTable::getParentKey()); }
926 inline void SourceRecord::setParent(
RecordId id) {
set(SourceTable::getParentKey(), id); }
927 inline double SourceRecord::getX()
const {
928 return get(getTable()->getCentroidKey().getX());
930 inline double SourceRecord::getY()
const {
931 return get(getTable()->getCentroidKey().getY());
933 inline double SourceRecord::getIxx()
const {
934 return get(getTable()->getShapeKey().getIxx());
936 inline double SourceRecord::getIyy()
const {
937 return get(getTable()->getShapeKey().getIyy());
939 inline double SourceRecord::getIxy()
const {
940 return get(getTable()->getShapeKey().getIxy());
945 #endif // !AFW_TABLE_Source_h_INCLUDED std::int64_t RecordId
Type used for unique IDs for records.
An ellipse core with quadrupole moments as parameters.
bool hasCentroidSlot() const
Return true if the Centroid slot corresponds to a valid field.
Defines the fields and offsets for a table.
Key< Flag > getPsfFluxFlagKey() const
Return the key used for the PsfFlux slot failure flag.
Column-wise view into a sequence of records that have been allocated contiguously.
Writer object for FITS binary tables.
ndarray::Array< double, 1 > getModelFluxErr() const
Get the uncertainty on the ModelFlux slot measurement.
Key< Flag > getApFluxFlagKey() const
Return the key used for the ApFlux slot failure flag.
ndarray::Array< double, 1 > getPsfFluxErr() const
Get the uncertainty on the PsfFlux slot measurement.
FluxSlotDefinition const & getApFluxSlot() const
ndarray::Array< double, 1 > const getX() const
SortedCatalogT< SourceRecord const > ConstCatalog
void defineCalibFlux(std::string const &name)
Set the measurement used for the CalibFlux slot.
ndarray::Array< double, 1 > const getY() const
A mapping between the keys of two Schemas, used to copy data between them.
ndarray::Array< double, 1 > const getIxy() const
SourceColumnViewT(BaseColumnView const &base)
FluxSlotDefinition const & getInstFluxSlot() const
ndarray::Array< double, 1 > const getIyy() const
FluxSlotDefinition::ErrKey getPsfFluxErrKey() const
Return the key used for the PsfFlux slot uncertainty.
void defineInstFlux(std::string const &name)
Set the measurement used for the InstFlux slot.
SourceColumnViewT< SourceRecord > ColumnView
ShapeSlotDefinition const & getShapeSlot() const
std::shared_ptr< Footprint > getFootprint() const
FluxSlotDefinition const & getCalibFluxSlot() const
void disconnectAliases()
Sever the connection between this schema and any others with which it shares aliases.
ndarray::Array< double, 1 > getApFluxErr() const
Get the uncertainty on the ApFlux slot measurement.
SortedCatalogT< Record > Catalog
Implementation of the WCS standard for a any projection.
std::shared_ptr< SourceRecord > copyRecord(BaseRecord const &other)
Deep-copy a record, requiring that it have the same schema as this table.
FluxSlotDefinition::MeasKey getApFluxKey() const
Return the key used for the ApFlux slot measurement value.
void definePsfFlux(std::string const &name)
Set the measurement used for the PsfFlux slot.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
std::string getCentroidDefinition() const
Return the name of the field used for the Centroid slot.
An aggregate containing all of the current slots used in SourceTable.
std::string getApFluxDefinition() const
Return the name of the field used for the ApFlux slot.
std::string getInstFluxDefinition() const
Return the name of the field used for the InstFlux slot.
Table class that must contain a unique ID field and a celestial coordinate field. ...
bool hasModelFluxSlot() const
Return true if the ModelFlux slot corresponds to a valid field.
Key< Flag > getCalibFluxFlagKey() const
Return the key used for the CalibFlux slot failure flag.
A base class for image defects.
ndarray::Array< double, 1 > const getIxx() const
Key< Flag > getInstFluxFlagKey() const
Return the key used for the InstFlux slot failure flag.
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Key< Flag > getModelFluxFlagKey() const
Return the key used for the ModelFlux slot failure flag.
std::shared_ptr< SourceTable const > getTable() const
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
FluxSlotDefinition::ErrKey getModelFluxErrKey() const
Return the key used for the ModelFlux slot uncertainty.
static SourceColumnViewT make(std::shared_ptr< Table > const &table, InputIterator first, InputIterator last)
Construct a BaseColumnView from an iterator range.
FluxSlotDefinition::MeasKey getPsfFluxKey() const
Return the key used for the PsfFlux slot measurement value.
ndarray::Array< double, 1 > getInstFluxErr() const
Get the uncertainty on the InstFlux slot measurement.
CentroidSlotDefinition::MeasKey getCentroidKey() const
Return the key used for the Centroid slot measurement value.
bool hasPsfFluxSlot() const
Return true if the PsfFlux slot corresponds to a valid field.
ndarray::Array< double, 1 > getCalibFlux() const
Get the value of the CalibFlux slot measurement.
bool hasShapeSlot() const
Return true if the Shape slot corresponds to a valid field.
FluxSlotDefinition::ErrKey getCalibFluxErrKey() const
Return the key used for the CalibFlux slot uncertainty.
table::Key< std::string > name
static Schema makeMinimalSchema()
Return a minimal schema for Source tables and records.
SourceColumnViewT< SourceRecord > SourceColumnView
ndarray::Array< double, 1 > getInstFlux() const
Get the value of the InstFlux slot measurement.
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.
std::string getPsfFluxDefinition() const
Return the name of the field used for the PsfFlux slot.
FluxSlotDefinition::MeasKey getModelFluxKey() const
Return the key used for the ModelFlux slot measurement value.
SortedCatalogT< Record const > ConstCatalog
FluxSlotDefinition::MeasKey getInstFluxKey() const
Return the key used for the InstFlux slot measurement value.
std::string getCalibFluxDefinition() const
Return the name of the field used for the CalibFlux slot.
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.
Table class that contains measurements made on a single exposure.
static std::shared_ptr< SourceTable > make(Schema const &schema)
Construct a new table.
ndarray::Array< double, 1 > getApFlux() const
Get the value of the ApFlux slot measurement.
FluxSlotDefinition::ErrKey getApFluxErrKey() const
Return the key used for the ApFlux slot uncertainty.
Key< Flag > getCentroidFlagKey() const
Return the key used for the Centroid slot failure flag.
CentroidSlotDefinition::ErrKey getCentroidErrKey() const
Return the key used for the Centroid slot uncertainty.
Base class for all records.
bool hasApFluxSlot() const
Return true if the ApFlux slot corresponds to a valid field.
FluxSlotDefinition::MeasKey getCalibFluxKey() const
Return the key used for the CalibFlux slot measurement value.
Key specialization for Flag.
ndarray::Array< double, 1 > getModelFlux() const
Get the value of the ModelFlux slot measurement.
void setFootprint(std::shared_ptr< Footprint > const &footprint)
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
ndarray::Array< double, 1 > getCalibFluxErr() const
Get the uncertainty on the CalibFlux slot measurement.
ShapeSlotDefinition::MeasKey getShapeKey() const
Return the key used for the Shape slot measurement value.
ndarray::Array< double, 1 > getPsfFlux() const
Get the value of the PsfFlux slot measurement.
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 & getPsfFluxSlot() const
void defineCentroid(std::string const &name)
Set the measurement used for the Centroid slot.
double ErrValue
Type returned by accessing the slot uncertainty.
FluxSlotDefinition const & getModelFluxSlot() const
Record class that must contain a unique ID field and a celestial coordinate field.
SlotDefinition specialization for shapes.
CentroidSlotDefinition const & getCentroidSlot() const
bool hasCalibFluxSlot() const
Return true if the CalibFlux slot corresponds to a valid field.
A FunctorKey used to get or set a geom::ellipses::Quadrupole from a tuple of constituent Keys...
double MeasValue
Type returned by accessing the slot measurement.
ShapeSlotDefinition::ErrKey getShapeErrKey() const
Return the key used for the Shape slot uncertainty.
SlotDefinition specialization for fluxes.
Key< Flag > getShapeFlagKey() const
Return the key used for the Shape slot failure flag.
void defineApFlux(std::string const &name)
Set the measurement used for the ApFlux slot.
afw::table::Schema schema
bool hasInstFluxSlot() const
Return true if the InstFlux slot corresponds to a valid field.
FluxSlotDefinition::ErrKey getInstFluxErrKey() const
Return the key used for the InstFlux slot uncertainty.
std::string getShapeDefinition() const
Return the name of the field used for the Shape slot.
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid SourceTable schema.
std::string getModelFluxDefinition() const
Return the name of the field used for the ModelFlux slot.
SourceColumnViewT< SourceRecord > ColumnView
std::shared_ptr< SourceRecord > makeRecord()
Default-construct an associated record.
Eigen::Matrix< float, 2, 2 > ErrValue
Type returned by accessing the slot uncertainty.