lsst.afw  16.0-79-g81b2eb930+1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Friends | List of all members
lsst::afw::table::SourceTable Class Reference

Table class that contains measurements made on a single exposure. More...

#include <Source.h>

Inheritance diagram for lsst::afw::table::SourceTable:
lsst::afw::table::SimpleTable lsst::afw::table::BaseTable std::enable_shared_from_this< BaseTable > lsst::daf::base::Citizen

Public Types

typedef SourceRecord Record
 
typedef SourceColumnViewT< SourceRecord > ColumnView
 
typedef SortedCatalogT< Record > Catalog
 
typedef SortedCatalogT< Record const > ConstCatalog
 
typedef unsigned long memId
 
typedef memId(* memNewCallback) (const memId cid)
 
typedef memId(* memCallback) (const Citizen *ptr)
 

Public Member Functions

std::shared_ptr< SourceTable > clone () const
 Return a polymorphic deep copy of the table. More...
 
std::shared_ptr< SourceRecord > makeRecord ()
 Default-construct an associated record. More...
 
std::shared_ptr< SourceRecord > copyRecord (BaseRecord const &other)
 Deep-copy a record, requiring that it have the same schema as this table. More...
 
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. More...
 
FluxSlotDefinition const & getPsfFluxSlot () const
 
void definePsfFlux (std::string const &name)
 Set the measurement used for the PsfFlux slot. More...
 
FluxSlotDefinition const & getModelFluxSlot () const
 
void defineModelFlux (std::string const &name)
 Set the measurement used for the ModelFlux slot. More...
 
FluxSlotDefinition const & getApFluxSlot () const
 
void defineApFlux (std::string const &name)
 Set the measurement used for the ApFlux slot. More...
 
FluxSlotDefinition const & getGaussianFluxSlot () const
 
void defineGaussianFlux (std::string const &name)
 Set the measurement used for the GaussianFlux slot. More...
 
FluxSlotDefinition const & getCalibFluxSlot () const
 
void defineCalibFlux (std::string const &name)
 Set the measurement used for the CalibFlux slot. More...
 
CentroidSlotDefinition const & getCentroidSlot () const
 
void defineCentroid (std::string const &name)
 Set the measurement used for the Centroid slot. More...
 
std::string getCentroidDefinition () const
 Return the name of the field used for the Centroid slot. More...
 
bool hasCentroidSlot () const
 Return true if the Centroid slot corresponds to a valid field. More...
 
CentroidSlotDefinition::MeasKey getCentroidKey () const
 Return the key used for the Centroid slot measurement value. More...
 
CentroidSlotDefinition::ErrKey getCentroidErrKey () const
 Return the key used for the Centroid slot uncertainty. More...
 
Key< Flag > getCentroidFlagKey () const
 Return the key used for the Centroid slot failure flag. More...
 
ShapeSlotDefinition const & getShapeSlot () const
 
void defineShape (std::string const &name)
 Set the measurement used for the Shape slot. More...
 
std::string getShapeDefinition () const
 Return the name of the field used for the Shape slot. More...
 
bool hasShapeSlot () const
 Return true if the Shape slot corresponds to a valid field. More...
 
ShapeSlotDefinition::MeasKey getShapeKey () const
 Return the key used for the Shape slot measurement value. More...
 
ShapeSlotDefinition::ErrKey getShapeErrKey () const
 Return the key used for the Shape slot uncertainty. More...
 
Key< Flag > getShapeFlagKey () const
 Return the key used for the Shape slot failure flag. More...
 
SourceTable & operator= (SourceTable const &)=delete
 
SourceTable & operator= (SourceTable &&)=delete
 
std::shared_ptr< IdFactory > getIdFactory ()
 Return the object that generates IDs for the table (may be null). More...
 
std::shared_ptr< IdFactory const > getIdFactory () const
 Return the object that generates IDs for the table (may be null). More...
 
void setIdFactory (std::shared_ptr< IdFactory > f)
 Switch to a new IdFactory – object that generates IDs for the table (may be null). More...
 
std::shared_ptr< daf::base::PropertyList > getMetadata () const
 Return the flexible metadata associated with the table. May be null. More...
 
void setMetadata (std::shared_ptr< daf::base::PropertyList > const &metadata)
 Set the flexible metadata associated with the table. May be null. More...
 
std::shared_ptr< daf::base::PropertyList > popMetadata ()
 Return the metadata and set the internal metadata to a null pointer. More...
 
Schema getSchema () const
 Return the table's schema. More...
 
void preallocate (std::size_t nRecords)
 Allocate contiguous space for new records in advance. More...
 
std::size_t getBufferSize () const
 Return the number of additional records space has been already been allocated for. More...
 
T shared_from_this (T... args)
 
std::string repr () const
 
void markPersistent (void)
 
memId getId () const
 

Static Public Member Functions

static std::shared_ptr< SourceTable > make (Schema const &schema, std::shared_ptr< IdFactory > const &idFactory)
 Construct a new table. More...
 
static std::shared_ptr< SourceTable > make (Schema const &schema)
 Construct a new table. More...
 
static Schema makeMinimalSchema ()
 Return a minimal schema for Source tables and records. More...
 
static bool checkSchema (Schema const &other)
 Return true if the given schema is a valid SourceTable schema. More...
 
static Key< RecordId > getParentKey ()
 Key for the parent ID. More...
 
static bool hasBeenCorrupted ()
 
static memId getNextMemId ()
 
static int init ()
 
static int census (int, memId startingMemId=0)
 
static void census (std::ostream &stream, memId startingMemId=0)
 
static const std::vector< const Citizen *> * census ()
 
static int census (int, memId startingMemId=0)
 
static void census (std::ostream &stream, memId startingMemId=0)
 
static const std::vector< const Citizen *> * census ()
 
static memId setNewCallbackId (memId id)
 
static memId setNewCallbackId (memId id)
 
static memId setDeleteCallbackId (memId id)
 
static memId setDeleteCallbackId (memId id)
 
static memNewCallback setNewCallback (memNewCallback func)
 
static memCallback setDeleteCallback (memCallback func)
 
static memCallback setCorruptionCallback (memCallback func)
 
static Key< RecordId > getIdKey ()
 Get keys for standard fields shared by all references. More...
 
static CoordKey getCoordKey ()
 Key for the celestial coordinates. More...
 

Public Attributes

 magicSentinel
 

Static Public Attributes

static int nRecordsPerBlock = 100
 Number of records in each memory block. More...
 

Protected Member Functions

 SourceTable (Schema const &schema, std::shared_ptr< IdFactory > const &idFactory)
 
 SourceTable (SourceTable const &other)
 
 SourceTable (SourceTable &&other)
 
void handleAliasChange (std::string const &alias) override
 
std::shared_ptr< BaseTable > _clone () const override
 Clone implementation with noncovariant return types. More...
 
std::shared_ptr< BaseRecord > _makeRecord () override
 Default-construct an associated record (protected implementation). More...
 
template<typename Derived >
std::shared_ptr< Derived > getSelf ()
 Convenience function for static-casting shared_from_this for use by derived classes. More...
 
template<typename Derived >
std::shared_ptr< Derived const > getSelf () const
 Convenience function for static-casting shared_from_this for use by derived classes. More...
 

Friends

class io::FitsWriter
 
class SourceRecord
 

Detailed Description

Table class that contains measurements made on a single exposure.

Definition at line 209 of file Source.h.

Member Typedef Documentation

◆ Catalog

Definition at line 213 of file Source.h.

◆ ColumnView

Definition at line 212 of file Source.h.

◆ ConstCatalog

Definition at line 214 of file Source.h.

◆ Record

Definition at line 211 of file Source.h.

Constructor & Destructor Documentation

◆ SourceTable() [1/3]

lsst::afw::table::SourceTable::SourceTable ( Schema const &  schema,
std::shared_ptr< IdFactory > const &  idFactory 
)
protected

Definition at line 393 of file Source.cc.

◆ SourceTable() [2/3]

lsst::afw::table::SourceTable::SourceTable ( SourceTable const &  other)
protected

Definition at line 396 of file Source.cc.

◆ SourceTable() [3/3]

lsst::afw::table::SourceTable::SourceTable ( SourceTable &&  other)
protected

Definition at line 398 of file Source.cc.

Member Function Documentation

◆ _clone()

std::shared_ptr< BaseTable > lsst::afw::table::SourceTable::_clone ( ) const
overrideprotectedvirtual

Clone implementation with noncovariant return types.

Reimplemented from lsst::afw::table::SimpleTable.

Definition at line 422 of file Source.cc.

◆ _makeRecord()

std::shared_ptr< BaseRecord > lsst::afw::table::SourceTable::_makeRecord ( )
overrideprotectedvirtual

Default-construct an associated record (protected implementation).

Reimplemented from lsst::afw::table::SimpleTable.

Definition at line 426 of file Source.cc.

◆ checkSchema()

static bool lsst::afw::table::SourceTable::checkSchema ( Schema const &  other)
inlinestatic

Return true if the given schema is a valid SourceTable schema.

This will always be true if the given schema was originally constructed using makeMinimalSchema(), and will rarely be true otherwise.

Definition at line 262 of file Source.h.

◆ clone()

std::shared_ptr<SourceTable> lsst::afw::table::SourceTable::clone ( void  ) const
inline

Return a polymorphic deep copy of the table.

Derived classes should reimplement by static-casting the output of _clone to a pointer-to-derived to simulate covariant return types.

Cloning a table does not clone its associated records; the new table produced by clone() does not have any associated records.

Definition at line 268 of file Source.h.

◆ copyRecord() [1/2]

std::shared_ptr<SourceRecord> lsst::afw::table::SourceTable::copyRecord ( BaseRecord const &  other)
inline

Deep-copy a record, requiring that it have the same schema as this table.

Regardless of the type or associated table of the input record, the type of the output record will be the type associated with this table and the record instance will be associated with this table.

Allowing derived-class records to be constructed from base-class records could be considered a form of type-slicing, but because we already demand that all records be constructable from nothing but a table, this isn't anything new.

Derived classes should reimplement by static-casting the output of BaseTable::copyRecord to the appropriate BaseRecord subclass.

This is implemented using makeRecord and calling record.assign on the results; override those to change the behavior.

Definition at line 276 of file Source.h.

◆ copyRecord() [2/2]

std::shared_ptr<SourceRecord> lsst::afw::table::SourceTable::copyRecord ( BaseRecord const &  other,
SchemaMapper const &  mapper 
)
inline

Deep-copy a record, requiring that it have the same schema as this table.

Regardless of the type or associated table of the input record, the type of the output record will be the type associated with this table and the record instance will be associated with this table.

Allowing derived-class records to be constructed from base-class records could be considered a form of type-slicing, but because we already demand that all records be constructable from nothing but a table, this isn't anything new.

Derived classes should reimplement by static-casting the output of BaseTable::copyRecord to the appropriate BaseRecord subclass.

This is implemented using makeRecord and calling record.assign on the results; override those to change the behavior.

Definition at line 281 of file Source.h.

◆ defineApFlux()

void lsst::afw::table::SourceTable::defineApFlux ( std::string const &  name)
inline

Set the measurement used for the ApFlux slot.

The definitions for slots are actually managed by the Schema object, and its associated AliasMap, so this simply sets the "slot_ApFlux" alias to point to the given field name prefix. See FluxSlotDefinition for more information.

Definition at line 320 of file Source.h.

◆ defineCalibFlux()

void lsst::afw::table::SourceTable::defineCalibFlux ( std::string const &  name)
inline

Set the measurement used for the CalibFlux slot.

The definitions for slots are actually managed by the Schema object, and its associated AliasMap, so this simply sets the "slot_CalibFlux" alias to point to the given field name prefix. See FluxSlotDefinition for more information.

Definition at line 346 of file Source.h.

◆ defineCentroid()

void lsst::afw::table::SourceTable::defineCentroid ( std::string const &  name)
inline

Set the measurement used for the Centroid slot.

The definitions for slots are actually managed by the Schema object, and its associated AliasMap, so this simply sets the "slot_Centroid" alias to point to the given field name prefix. See CentroidSlotDefinition for more information.

Definition at line 359 of file Source.h.

◆ defineGaussianFlux()

void lsst::afw::table::SourceTable::defineGaussianFlux ( std::string const &  name)
inline

Set the measurement used for the GaussianFlux slot.

The definitions for slots are actually managed by the Schema object, and its associated AliasMap, so this simply sets the "slot_GaussianFlux" alias to point to the given field name prefix. See FluxSlotDefinition for more information.

Definition at line 333 of file Source.h.

◆ defineModelFlux()

void lsst::afw::table::SourceTable::defineModelFlux ( std::string const &  name)
inline

Set the measurement used for the ModelFlux slot.

The definitions for slots are actually managed by the Schema object, and its associated AliasMap, so this simply sets the "slot_ModelFlux" alias to point to the given field name prefix. See FluxSlotDefinition for more information.

Definition at line 307 of file Source.h.

◆ definePsfFlux()

void lsst::afw::table::SourceTable::definePsfFlux ( std::string const &  name)
inline

Set the measurement used for the PsfFlux slot.

The definitions for slots are actually managed by the Schema object, and its associated AliasMap, so this simply sets the "slot_PsfFlux" alias to point to the given field name prefix. See FluxSlotDefinition for more information.

Definition at line 294 of file Source.h.

◆ defineShape()

void lsst::afw::table::SourceTable::defineShape ( std::string const &  name)
inline

Set the measurement used for the Shape slot.

The definitions for slots are actually managed by the Schema object, and its associated AliasMap, so this simply sets the "slot_Shape" alias to point to the given field name prefix. See ShapeSlotDefinition for more information.

Definition at line 413 of file Source.h.

◆ getApFluxSlot()

FluxSlotDefinition const& lsst::afw::table::SourceTable::getApFluxSlot ( ) const
inline

Definition at line 311 of file Source.h.

◆ getBufferSize()

std::size_t lsst::afw::table::BaseTable::getBufferSize ( ) const
inherited

Return the number of additional records space has been already been allocated for.

Unlike std::vector::capacity, this does not factor in existing records in any way.

Definition at line 113 of file BaseTable.cc.

◆ getCalibFluxSlot()

FluxSlotDefinition const& lsst::afw::table::SourceTable::getCalibFluxSlot ( ) const
inline

Definition at line 337 of file Source.h.

◆ getCentroidDefinition()

std::string lsst::afw::table::SourceTable::getCentroidDefinition ( ) const
inline

Return the name of the field used for the Centroid slot.

Exceptions
pex::exceptions::NotFoundErrorif the slot is not defined.
Deprecated:
in favor of
getSchema().getAliasMap()->get("slot_Centroid")

Definition at line 372 of file Source.h.

◆ getCentroidErrKey()

CentroidSlotDefinition::ErrKey lsst::afw::table::SourceTable::getCentroidErrKey ( ) const
inline

Return the key used for the Centroid slot uncertainty.

Deprecated:
in favor of getCentroidSlot().getErrKey().

Definition at line 395 of file Source.h.

◆ getCentroidFlagKey()

Key<Flag> lsst::afw::table::SourceTable::getCentroidFlagKey ( ) const
inline

Return the key used for the Centroid slot failure flag.

Deprecated:
in favor of getCentroidSlot().getFlagKey().

Definition at line 402 of file Source.h.

◆ getCentroidKey()

CentroidSlotDefinition::MeasKey lsst::afw::table::SourceTable::getCentroidKey ( ) const
inline

Return the key used for the Centroid slot measurement value.

Deprecated:
in favor of getCentroidSlot().getMeasKey().

Definition at line 388 of file Source.h.

◆ getCentroidSlot()

CentroidSlotDefinition const& lsst::afw::table::SourceTable::getCentroidSlot ( ) const
inline

Definition at line 350 of file Source.h.

◆ getCoordKey()

static CoordKey lsst::afw::table::SimpleTable::getCoordKey ( )
inlinestaticinherited

Key for the celestial coordinates.

Definition at line 161 of file Simple.h.

◆ getGaussianFluxSlot()

FluxSlotDefinition const& lsst::afw::table::SourceTable::getGaussianFluxSlot ( ) const
inline

Definition at line 324 of file Source.h.

◆ getIdFactory() [1/2]

std::shared_ptr<IdFactory> lsst::afw::table::SimpleTable::getIdFactory ( )
inlineinherited

Return the object that generates IDs for the table (may be null).

Definition at line 144 of file Simple.h.

◆ getIdFactory() [2/2]

std::shared_ptr<IdFactory const> lsst::afw::table::SimpleTable::getIdFactory ( ) const
inlineinherited

Return the object that generates IDs for the table (may be null).

Definition at line 147 of file Simple.h.

◆ getIdKey()

static Key<RecordId> lsst::afw::table::SimpleTable::getIdKey ( )
inlinestaticinherited

Get keys for standard fields shared by all references.

These keys are used to implement getters and setters on SimpleRecord.Key for the unique ID.

Definition at line 159 of file Simple.h.

◆ getMetadata()

std::shared_ptr<daf::base::PropertyList> lsst::afw::table::BaseTable::getMetadata ( ) const
inlineinherited

Return the flexible metadata associated with the table. May be null.

Definition at line 62 of file BaseTable.h.

◆ getModelFluxSlot()

FluxSlotDefinition const& lsst::afw::table::SourceTable::getModelFluxSlot ( ) const
inline

Definition at line 298 of file Source.h.

◆ getParentKey()

static Key<RecordId> lsst::afw::table::SourceTable::getParentKey ( )
inlinestatic

Key for the parent ID.

Definition at line 265 of file Source.h.

◆ getPsfFluxSlot()

FluxSlotDefinition const& lsst::afw::table::SourceTable::getPsfFluxSlot ( ) const
inline

Definition at line 285 of file Source.h.

◆ getSchema()

Schema lsst::afw::table::BaseTable::getSchema ( ) const
inlineinherited

Return the table's schema.

Definition at line 120 of file BaseTable.h.

◆ getSelf() [1/2]

template<typename Derived >
std::shared_ptr<Derived> lsst::afw::table::BaseTable::getSelf ( )
inlineprotectedinherited

Convenience function for static-casting shared_from_this for use by derived classes.

Definition at line 166 of file BaseTable.h.

◆ getSelf() [2/2]

template<typename Derived >
std::shared_ptr<Derived const> lsst::afw::table::BaseTable::getSelf ( ) const
inlineprotectedinherited

Convenience function for static-casting shared_from_this for use by derived classes.

Definition at line 172 of file BaseTable.h.

◆ getShapeDefinition()

std::string lsst::afw::table::SourceTable::getShapeDefinition ( ) const
inline

Return the name of the field used for the Shape slot.

Exceptions
pex::exceptions::NotFoundErrorif the slot is not defined.
Deprecated:
in favor of
getSchema().getAliasMap()->get("slot_Shape")

Definition at line 426 of file Source.h.

◆ getShapeErrKey()

ShapeSlotDefinition::ErrKey lsst::afw::table::SourceTable::getShapeErrKey ( ) const
inline

Return the key used for the Shape slot uncertainty.

Deprecated:
in favor of getShapeSlot().getErrKey().

Definition at line 449 of file Source.h.

◆ getShapeFlagKey()

Key<Flag> lsst::afw::table::SourceTable::getShapeFlagKey ( ) const
inline

Return the key used for the Shape slot failure flag.

Deprecated:
in favor of getShapeSlot().getFlagKey().

Definition at line 456 of file Source.h.

◆ getShapeKey()

ShapeSlotDefinition::MeasKey lsst::afw::table::SourceTable::getShapeKey ( ) const
inline

Return the key used for the Shape slot measurement value.

Deprecated:
in favor of getShapeSlot().getMeasKey().

Definition at line 442 of file Source.h.

◆ getShapeSlot()

ShapeSlotDefinition const& lsst::afw::table::SourceTable::getShapeSlot ( ) const
inline

Definition at line 404 of file Source.h.

◆ handleAliasChange()

void lsst::afw::table::SourceTable::handleAliasChange ( std::string const &  alias)
overrideprotectedvirtual

Reimplemented from lsst::afw::table::BaseTable.

Definition at line 400 of file Source.cc.

◆ hasCentroidSlot()

bool lsst::afw::table::SourceTable::hasCentroidSlot ( ) const
inline

Return true if the Centroid slot corresponds to a valid field.

Deprecated:
in favor of getCentroidSlot().isValid().

Definition at line 381 of file Source.h.

◆ hasShapeSlot()

bool lsst::afw::table::SourceTable::hasShapeSlot ( ) const
inline

Return true if the Shape slot corresponds to a valid field.

Deprecated:
in favor of getShapeSlot().isValid().

Definition at line 435 of file Source.h.

◆ make() [1/2]

std::shared_ptr< SourceTable > lsst::afw::table::SourceTable::make ( Schema const &  schema,
std::shared_ptr< IdFactory > const &  idFactory 
)
static

Construct a new table.

Parameters
[in]schemaSchema that defines the fields, offsets, and record size for the table.
[in]idFactoryFactory class to generate record IDs when they are not explicitly given. If null, record IDs will default to zero.

Note that not passing an IdFactory at all will call the other override of make(), which will set the ID factory to IdFactory::makeSimple().

Definition at line 384 of file Source.cc.

◆ make() [2/2]

static std::shared_ptr<SourceTable> lsst::afw::table::SourceTable::make ( Schema const &  schema)
inlinestatic

Construct a new table.

Parameters
[in]schemaSchema that defines the fields, offsets, and record size for the table.

This overload sets the ID factory to IdFactory::makeSimple().

Definition at line 236 of file Source.h.

◆ makeMinimalSchema()

static Schema lsst::afw::table::SourceTable::makeMinimalSchema ( )
inlinestatic

Return a minimal schema for Source tables and records.

The returned schema can and generally should be modified further, but many operations on sources will assume that at least the fields provided by this routine are present.

Keys for the standard fields added by this routine can be obtained from other static member functions of the SourceTable class.

Definition at line 250 of file Source.h.

◆ makeRecord()

std::shared_ptr<SourceRecord> lsst::afw::table::SourceTable::makeRecord ( )
inline

Default-construct an associated record.

Derived classes should reimplement by static-casting the output of _makeRecord to the appropriate BaseRecord subclass to simulate covariant return types.

Definition at line 271 of file Source.h.

◆ operator=() [1/2]

SourceTable& lsst::afw::table::SourceTable::operator= ( SourceTable const &  )
delete

◆ operator=() [2/2]

SourceTable& lsst::afw::table::SourceTable::operator= ( SourceTable &&  )
delete

◆ popMetadata()

std::shared_ptr<daf::base::PropertyList> lsst::afw::table::BaseTable::popMetadata ( )
inlineinherited

Return the metadata and set the internal metadata to a null pointer.

Definition at line 68 of file BaseTable.h.

◆ preallocate()

void lsst::afw::table::BaseTable::preallocate ( std::size_t  nRecords)
inherited

Allocate contiguous space for new records in advance.

If a contiguous memory block for at least n additional records has already been allocated, this is a no-op. If not, a new block will be allocated, and any remaining space on the old block will go to waste; this ensures the new records will be allocated contiguously. Note that "wasted" memory is not leaked; it will be deallocated along with any records created from that block when those records go out of scope.

Note that unlike std::vector::reserve, this does not factor in existing records in any way; nRecords refers to a number of new records to reserve space for.

Definition at line 111 of file BaseTable.cc.

◆ setIdFactory()

void lsst::afw::table::SimpleTable::setIdFactory ( std::shared_ptr< IdFactory >  f)
inlineinherited

Switch to a new IdFactory – object that generates IDs for the table (may be null).

Definition at line 150 of file Simple.h.

◆ setMetadata()

void lsst::afw::table::BaseTable::setMetadata ( std::shared_ptr< daf::base::PropertyList > const &  metadata)
inlineinherited

Set the flexible metadata associated with the table. May be null.

Definition at line 65 of file BaseTable.h.

Friends And Related Function Documentation

◆ io::FitsWriter

friend class io::FitsWriter
friend

Definition at line 485 of file Source.h.

◆ SourceRecord

friend class SourceRecord
friend

Definition at line 486 of file Source.h.

Member Data Documentation

◆ nRecordsPerBlock

int lsst::afw::table::BaseTable::nRecordsPerBlock = 100
staticinherited

Number of records in each memory block.

Definition at line 59 of file BaseTable.h.


The documentation for this class was generated from the following files: