LSSTApplications  20.0.0
LSSTDataManagementBasePackage
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
lsst::afw::table Namespace Reference

Namespaces

 _aggregates
 
 _aliasMap
 
 _arrays
 
 _base
 
 _baseColumnView
 
 _exposure
 
 _match
 
 _schema
 
 _schemaMapper
 
 _simple
 
 _source
 
 catalogMatches
 
 detail
 
 io
 
 multiMatch
 
 python
 
 testUtils
 

Classes

class  AliasMap
 Mapping class that holds aliases for a Schema. More...
 
class  Array
 Tag types used to declare specialized field types. More...
 
class  ArrayKey
 A FunctorKey used to get or set a ndarray::Array from a sequence of scalar Keys. More...
 
class  BaseColumnView
 Column-wise view into a sequence of records that have been allocated contiguously. More...
 
class  BaseRecord
 Base class for all records. More...
 
class  BaseTable
 Base class for all tables. More...
 
class  BitsColumn
 A packed representation of a collection of Flag field columns. More...
 
class  BoxKey
 A FunctorKey used to get or set a lsst::geom::Box2I or Box2D from a (min, max) pair of PointKeys. More...
 
class  CatalogIterator
 Iterator class for CatalogT. More...
 
class  CatalogT
 A custom container class for records, based on std::vector. More...
 
class  CentroidSlotDefinition
 SlotDefinition specialization for centroids. More...
 
class  ColumnViewT
 
class  ConstReferenceFunctorKey
 Base class for objects that can return a const reference to part of a record, but are not a true Key. More...
 
class  CoordKey
 A FunctorKey used to get or set celestial coordinates from a pair of lsst::geom::Angle keys. More...
 
class  CovarianceMatrixKey
 
class  EllipseKey
 A FunctorKey used to get or set a geom::ellipses::Ellipse from an (xx,yy,xy,x,y) tuple of Keys. More...
 
class  ExposureCatalogT
 Custom catalog class for ExposureRecord/Table. More...
 
class  ExposureRecord
 Record class used to store exposure metadata. More...
 
class  ExposureTable
 Table class used to store exposure metadata. More...
 
struct  Field
 A description of a field in a table. More...
 
struct  FieldBase
 Field base class default implementation (used for numeric scalars and lsst::geom::Angle). More...
 
struct  FieldBase< Array< U > >
 Field base class specialization for arrays. More...
 
struct  FieldBase< Flag >
 Specialization for Flag fields. More...
 
struct  FieldBase< std::string >
 Field base class specialization for strings. More...
 
class  FluxSlotDefinition
 SlotDefinition specialization for fluxes. More...
 
class  FunctorKey
 Convenience base class that combines the OutputFunctorKey and InputFunctorKey. More...
 
class  IdFactory
 A polymorphic functor base class for generating record IDs for a table. More...
 
class  InputFunctorKey
 Base class for objects that can set a value on a record, but are not a true Key themselves. More...
 
class  Key
 A class used as a handle to a particular field in a table. More...
 
class  Key< Flag >
 Key specialization for Flag. More...
 
class  KeyBase
 A base class for Key that allows subfield keys to be extracted for some field types. More...
 
class  KeyBase< Array< U > >
 KeyBase specialization for Arrays. More...
 
class  KeyBase< Flag >
 A base class for Key that allows the underlying storage field to be extracted. More...
 
struct  Match
 Lightweight representation of a geometric match between two records. More...
 
class  MatchControl
 Pass parameters to algorithms that match list of sources. More...
 
class  OutputFunctorKey
 Base class for objects that can extract a value from a record, but are not a true Key themselves. More...
 
class  PersistableObjectColumnReader
 
class  PointKey
 A FunctorKey used to get or set a lsst::geom::Point from an (x,y) pair of int or double Keys. More...
 
class  QuadrupoleKey
 A FunctorKey used to get or set a geom::ellipses::Quadrupole from a tuple of constituent Keys. More...
 
class  ReferenceFunctorKey
 Base class for objects that can return a non-const reference to part of a record, but are not a true Key. More...
 
class  Schema
 Defines the fields and offsets for a table. More...
 
struct  SchemaItem
 A simple pair-like struct for mapping a Field (name and description) with a Key (used for actual data access). More...
 
class  SchemaMapper
 A mapping between the keys of two Schemas, used to copy data between them. More...
 
class  ShapeSlotDefinition
 SlotDefinition specialization for shapes. More...
 
class  SimpleRecord
 Record class that must contain a unique ID field and a celestial coordinate field. More...
 
class  SimpleTable
 Table class that must contain a unique ID field and a celestial coordinate field. More...
 
class  SlotDefinition
 Base class for helper classes that define slots on SourceTable/SourceRecord. More...
 
struct  SlotSuite
 An aggregate containing all of the current slots used in SourceTable. More...
 
class  SortedCatalogT
 Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID. More...
 
class  SourceColumnViewT
 
class  SourceRecord
 Record class that contains measurements made on a single exposure. More...
 
class  SourceTable
 Table class that contains measurements made on a single exposure. More...
 
class  SubSchema
 A proxy type for name lookups in a Schema. More...
 

Typedefs

typedef PointKey< int > Point2IKey
 
typedef PointKey< double > Point2DKey
 
using Box2IKey = BoxKey< lsst::geom::Box2I >
 
using Box2DKey = BoxKey< lsst::geom::Box2D >
 
typedef ColumnViewT< ExposureRecordExposureColumnView
 
typedef ExposureCatalogT< ExposureRecordExposureCatalog
 
typedef ExposureCatalogT< ExposureRecord const > ConstExposureCatalog
 
typedef CatalogT< BaseRecordBaseCatalog
 
typedef CatalogT< BaseRecord const > ConstBaseCatalog
 
typedef ColumnViewT< SimpleRecordSimpleColumnView
 
typedef SortedCatalogT< SimpleRecordSimpleCatalog
 
typedef SortedCatalogT< SimpleRecord const > ConstSimpleCatalog
 
typedef SourceColumnViewT< SourceRecordSourceColumnView
 
typedef SortedCatalogT< SourceRecordSourceCatalog
 
typedef SortedCatalogT< SourceRecord const > ConstSourceCatalog
 
typedef ColumnViewT< AmpInfoRecord > AmpInfoColumnView
 
typedef CatalogT< AmpInfoRecord > AmpInfoCatalog
 
typedef CatalogT< AmpInfoRecord const > ConstAmpInfoCatalog
 
typedef Match< SimpleRecord, SimpleRecordSimpleMatch
 
typedef Match< SimpleRecord, SourceRecordReferenceMatch
 
typedef Match< SourceRecord, SourceRecordSourceMatch
 
typedef std::vector< SimpleMatchSimpleMatchVector
 
typedef std::vector< ReferenceMatchReferenceMatchVector
 
typedef std::vector< SourceMatchSourceMatchVector
 
typedef std::int64_t RecordId
 Type used for unique IDs for records. More...
 
typedef lsst::geom::Angle Angle
 
typedef lsst::geom::SpherePoint SpherePoint
 
typedef lsst::afw::detection::Footprint Footprint
 
typedef boost::mpl::vector< RecordId, std::uint16_t, std::int32_t, float, double, lsst::geom::Angle, std::uint8_tScalarFieldTypes
 An MPL vector of scalar field types. More...
 
typedef boost::mpl::vector< RecordId, std::uint16_t, std::int32_t, float, double, lsst::geom::Angle, std::uint8_t, Flag, std::string, Array< std::uint16_t >, Array< int >, Array< float >, Array< double >, Array< std::uint8_t > > FieldTypes
 An MPL vector of all field types. More...
 
using PyAliasMap = py::class_< AliasMap, std::shared_ptr< AliasMap > >
 
using PyIdFactory = py::class_< IdFactory, std::shared_ptr< IdFactory > >
 
using PySchemaMapper = py::class_< SchemaMapper, std::shared_ptr< SchemaMapper > >
 

Enumerations

enum  CoordinateType { CoordinateType::PIXEL, CoordinateType::CELESTIAL }
 Enum used to set units for geometric FunctorKeys. More...
 
enum  SourceFitsFlags { SOURCE_IO_NO_FOOTPRINTS = 0x1, SOURCE_IO_NO_HEAVY_FOOTPRINTS = 0x2 }
 Bitflags to be passed to SourceCatalog::readFits and SourceCatalog::writeFits. More...
 

Functions

template<typename RecordT , typename Catalog , typename T >
std::shared_ptr< RecordT > _Catalog_find (Catalog const &catalog, T const &value, Key< T > const &key)
 
template<typename Catalog , typename T >
int _Catalog_lower_bound (Catalog const &catalog, T const &value, Key< T > const &key)
 
template<typename Catalog , typename T >
int _Catalog_upper_bound (Catalog const &catalog, T const &value, Key< T > const &key)
 
template<typename Catalog , typename T >
std::pair< int, int > _Catalog_equal_range (Catalog const &catalog, T const &value, Key< T > const &key)
 
SourceMatchVector matchXy (SourceCatalog const &cat1, SourceCatalog const &cat2, double radius, MatchControl const &mc=MatchControl())
 Compute all tuples (s1,s2,d) where s1 belings to cat1, s2 belongs to cat2 and d, the distance between s1 and s2, in pixels, is at most radius. More...
 
SourceMatchVector matchXy (SourceCatalog const &cat, double radius, MatchControl const &mc=MatchControl())
 Compute all tuples (s1,s2,d) where s1 != s2, s1 and s2 both belong to cat, and d, the distance between s1 and s2, in pixels, is at most radius. More...
 
SourceMatchVector matchXy (SourceCatalog const &cat1, SourceCatalog const &cat2, double radius, bool closest)
 Compute all tuples (s1,s2,d) where s1 belings to cat1, s2 belongs to cat2 and d, the distance between s1 and s2, in pixels, is at most radius. More...
 
SourceMatchVector matchXy (SourceCatalog const &cat, double radius, bool symmetric)
 Compute all tuples (s1,s2,d) where s1 != s2, s1 and s2 both belong to cat, and d, the distance between s1 and s2, in pixels, is at most radius. More...
 
template<typename Cat1 , typename Cat2 >
std::vector< Match< typename Cat1::Record, typename Cat2::Record > > matchRaDec (Cat1 const &cat1, Cat2 const &cat2, lsst::geom::Angle radius, MatchControl const &mc=MatchControl())
 Compute all tuples (s1,s2,d) where s1 belings to cat1, s2 belongs to cat2 and d, the distance between s1 and s2, is at most radius. More...
 
template<typename Cat >
std::vector< Match< typename Cat::Record, typename Cat::Record > > matchRaDec (Cat const &cat, lsst::geom::Angle radius, MatchControl const &mc=MatchControl())
 
template<typename Cat1 , typename Cat2 >
std::vector< Match< typename Cat1::Record, typename Cat2::Record > > matchRaDec (Cat1 const &cat1, Cat2 const &cat2, lsst::geom::Angle radius, bool closest)
 Compute all tuples (s1,s2,d) where s1 belings to cat1, s2 belongs to cat2 and d, the distance between s1 and s2, is at most radius. More...
 
template<typename Cat >
std::vector< Match< typename Cat::Record, typename Cat::Record > > matchRaDec (Cat const &cat, lsst::geom::Angle radius, bool symmetric)
 Compute all tuples (s1,s2,d) where s1 != s2, s1 and s2 both belong to cat, and d, the distance between s1 and s2, is at most radius. More...
 
template<typename Record1 , typename Record2 >
BaseCatalog packMatches (std::vector< Match< Record1, Record2 > > const &matches)
 Return a table representation of a MatchVector that can be used to persist it. More...
 
template<typename Cat1 , typename Cat2 >
std::vector< Match< typename Cat1::Record, typename Cat2::Record > > unpackMatches (BaseCatalog const &matches, Cat1 const &cat1, Cat2 const &cat2)
 Reconstruct a MatchVector from a BaseCatalog representation of the matches and a pair of catalogs. More...
 
template<typename ReferenceCollection >
void updateRefCentroids (geom::SkyWcs const &wcs, ReferenceCollection &refList)
 Update centroids in a collection of reference objects. More...
 
template<typename SourceCollection >
void updateSourceCoords (geom::SkyWcs const &wcs, SourceCollection &sourceList)
 Update sky coordinates in a collection of source objects. More...
 
void wrapAggregates (WrapperCollection &wrappers)
 
void wrapAliasMap (utils::python::WrapperCollection &wrappers)
 
void wrapArrays (WrapperCollection &wrappers)
 
void wrapBase (WrapperCollection &wrappers)
 
void wrapBaseColumnView (WrapperCollection &wrappers)
 
void wrapExposure (WrapperCollection &wrappers)
 
void wrapIdFactory (utils::python::WrapperCollection &wrappers)
 
void wrapMatch (WrapperCollection &wrappers)
 
void wrapSchema (WrapperCollection &wrappers)
 
void wrapSchemaMapper (WrapperCollection &wrappers)
 
void wrapSimple (WrapperCollection &wrappers)
 
void wrapSlots (WrapperCollection &wrappers)
 
void wrapSource (WrapperCollection &wrappers)
 
void wrapWcsUtils (WrapperCollection &)
 
 PYBIND11_MODULE (_table, mod)
 
 BOOST_PP_SEQ_FOR_EACH (INSTANTIATE_COLUMNVIEW_SCALAR, _, BOOST_PP_TUPLE_TO_SEQ(AFW_TABLE_SCALAR_FIELD_TYPE_N, AFW_TABLE_SCALAR_FIELD_TYPE_TUPLE)) BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_COLUMNVIEW_ARRAY
 
std::ostreamoperator<< (std::ostream &os, BaseRecord const &record)
 
template SimpleMatchVector matchRaDec (SimpleCatalog const &, SimpleCatalog const &, lsst::geom::Angle, bool)
 
template SimpleMatchVector matchRaDec (SimpleCatalog const &, SimpleCatalog const &, lsst::geom::Angle, MatchControl const &)
 
template ReferenceMatchVector matchRaDec (SimpleCatalog const &, SourceCatalog const &, lsst::geom::Angle, bool)
 
template ReferenceMatchVector matchRaDec (SimpleCatalog const &, SourceCatalog const &, lsst::geom::Angle, MatchControl const &)
 
template SourceMatchVector matchRaDec (SourceCatalog const &, SourceCatalog const &, lsst::geom::Angle, bool)
 
template SourceMatchVector matchRaDec (SourceCatalog const &, SourceCatalog const &, lsst::geom::Angle, MatchControl const &)
 
template SimpleMatchVector matchRaDec (SimpleCatalog const &, lsst::geom::Angle, bool)
 
template SimpleMatchVector matchRaDec (SimpleCatalog const &, lsst::geom::Angle, MatchControl const &)
 
template SourceMatchVector matchRaDec (SourceCatalog const &, lsst::geom::Angle, bool)
 
template SourceMatchVector matchRaDec (SourceCatalog const &, lsst::geom::Angle, MatchControl const &)
 
template BaseCatalog packMatches (SimpleMatchVector const &)
 
template BaseCatalog packMatches (ReferenceMatchVector const &)
 
template BaseCatalog packMatches (SourceMatchVector const &)
 
template SimpleMatchVector unpackMatches (BaseCatalog const &, SimpleCatalog const &, SimpleCatalog const &)
 
template ReferenceMatchVector unpackMatches (BaseCatalog const &, SimpleCatalog const &, SourceCatalog const &)
 
template SourceMatchVector unpackMatches (BaseCatalog const &, SourceCatalog const &, SourceCatalog const &)
 
std::ostreamoperator<< (std::ostream &os, Schema const &schema)
 

Variables

 _
 

Typedef Documentation

◆ AmpInfoCatalog

Definition at line 97 of file fwd.h.

◆ AmpInfoColumnView

Definition at line 96 of file fwd.h.

◆ Angle

Definition at line 34 of file misc.h.

◆ BaseCatalog

Definition at line 72 of file fwd.h.

◆ Box2DKey

Definition at line 202 of file aggregates.h.

◆ Box2IKey

Definition at line 201 of file aggregates.h.

◆ ConstAmpInfoCatalog

typedef CatalogT<AmpInfoRecord const> lsst::afw::table::ConstAmpInfoCatalog

Definition at line 98 of file fwd.h.

◆ ConstBaseCatalog

Definition at line 73 of file fwd.h.

◆ ConstExposureCatalog

Definition at line 490 of file Exposure.h.

◆ ConstSimpleCatalog

Definition at line 80 of file fwd.h.

◆ ConstSourceCatalog

Definition at line 86 of file fwd.h.

◆ ExposureCatalog

Definition at line 489 of file Exposure.h.

◆ ExposureColumnView

Definition at line 488 of file Exposure.h.

◆ FieldTypes

An MPL vector of all field types.

Definition at line 54 of file types.h.

◆ Footprint

Definition at line 59 of file Source.h.

◆ Point2DKey

Definition at line 118 of file aggregates.h.

◆ Point2IKey

Definition at line 117 of file aggregates.h.

◆ PyAliasMap

Definition at line 37 of file _aliasMap.cc.

◆ PyIdFactory

Definition at line 36 of file _idFactory.cc.

◆ PySchemaMapper

Definition at line 43 of file _schemaMapper.cc.

◆ RecordId

Type used for unique IDs for records.

FITS isn't fond of uint64, so we can save a lot of pain by using signed ints here unless we really need unsigned.

Definition at line 22 of file misc.h.

◆ ReferenceMatch

Definition at line 104 of file fwd.h.

◆ ReferenceMatchVector

Definition at line 108 of file fwd.h.

◆ ScalarFieldTypes

An MPL vector of scalar field types.

Definition at line 51 of file types.h.

◆ SimpleCatalog

Definition at line 79 of file fwd.h.

◆ SimpleColumnView

Definition at line 78 of file fwd.h.

◆ SimpleMatch

Definition at line 103 of file fwd.h.

◆ SimpleMatchVector

Definition at line 107 of file fwd.h.

◆ SourceCatalog

Definition at line 85 of file fwd.h.

◆ SourceColumnView

Definition at line 84 of file fwd.h.

◆ SourceMatch

Definition at line 105 of file fwd.h.

◆ SourceMatchVector

Definition at line 109 of file fwd.h.

◆ SpherePoint

Definition at line 35 of file misc.h.

Enumeration Type Documentation

◆ CoordinateType

Enum used to set units for geometric FunctorKeys.

Enumerator
PIXEL 
CELESTIAL 

Definition at line 277 of file aggregates.h.

277 { PIXEL, CELESTIAL };

◆ SourceFitsFlags

Bitflags to be passed to SourceCatalog::readFits and SourceCatalog::writeFits.

Note that these flags may also be passed when reading/writing SourceCatalogs via the Butler, by passing a "flags" key/value pair as part of the data ID.

Enumerator
SOURCE_IO_NO_FOOTPRINTS 

Do not read/write footprints at all.

SOURCE_IO_NO_HEAVY_FOOTPRINTS 

Read/write heavy footprints as non-heavy footprints.

Definition at line 54 of file Source.h.

54  {
57 };

Function Documentation

◆ _Catalog_equal_range()

template<typename Catalog , typename T >
std::pair<int, int> lsst::afw::table::_Catalog_equal_range ( Catalog const &  catalog,
T const &  value,
Key< T > const &  key 
)

Definition at line 890 of file Catalog.h.

890  {
892  catalog.equal_range(value, key);
893  return std::pair<int, int>(p.first - catalog.begin(), p.second - catalog.begin());
894 }

◆ _Catalog_find()

template<typename RecordT , typename Catalog , typename T >
std::shared_ptr<RecordT> lsst::afw::table::_Catalog_find ( Catalog const &  catalog,
T const &  value,
Key< T > const &  key 
)

Definition at line 871 of file Catalog.h.

871  {
872  typename Catalog::const_iterator iter = catalog.find(value, key);
873  if (iter == catalog.end()) {
874  return std::shared_ptr<RecordT>();
875  }
876  return iter; // n.b. CatalogIterator is explicitly convertible to shared_ptr
877 }

◆ _Catalog_lower_bound()

template<typename Catalog , typename T >
int lsst::afw::table::_Catalog_lower_bound ( Catalog const &  catalog,
T const &  value,
Key< T > const &  key 
)

Definition at line 880 of file Catalog.h.

880  {
881  return catalog.lower_bound(value, key) - catalog.begin();
882 }

◆ _Catalog_upper_bound()

template<typename Catalog , typename T >
int lsst::afw::table::_Catalog_upper_bound ( Catalog const &  catalog,
T const &  value,
Key< T > const &  key 
)

Definition at line 885 of file Catalog.h.

885  {
886  return catalog.upper_bound(value, key) - catalog.begin();
887 }

◆ BOOST_PP_SEQ_FOR_EACH()

lsst::afw::table::BOOST_PP_SEQ_FOR_EACH ( INSTANTIATE_COLUMNVIEW_SCALAR  ,
_  ,
BOOST_PP_TUPLE_TO_SEQ(AFW_TABLE_SCALAR_FIELD_TYPE_N, AFW_TABLE_SCALAR_FIELD_TYPE_TUPLE  
)

◆ matchRaDec() [1/14]

template<typename Cat >
std::vector< Match< typename Cat::Record, typename Cat::Record > > lsst::afw::table::matchRaDec ( Cat const &  cat,
lsst::geom::Angle  radius,
bool  symmetric 
)

Compute all tuples (s1,s2,d) where s1 != s2, s1 and s2 both belong to cat, and d, the distance between s1 and s2, is at most radius.

The match is performed in ra, dec space.

Deprecated:
. Use the matchRaDec(..., MatchControl) version
Parameters
[in]catthe catalog to self-match
[in]radiusmatch radius
[in]symmetricif cat to true symmetric matches are produced: i.e. if (s1, s2, d) is reported, then so is (s2, s1, d).

This is instantiated for Simple and Source catalogs.

Definition at line 239 of file Match.cc.

241  {
242  MatchControl mc;
243  mc.symmetricMatch = symmetric;
244 
245  return matchRaDec(cat, radius, mc);
246 }

◆ matchRaDec() [2/14]

template<typename Cat >
std::vector< Match< typename Cat::Record, typename Cat::Record > > lsst::afw::table::matchRaDec ( Cat const &  cat,
lsst::geom::Angle  radius,
MatchControl const &  mc = MatchControl() 
)
Parameters
catthe catalog to self-match
radiusmatch radius
mchow to do the matching (obeys MatchControl::symmetricMatch)

Definition at line 249 of file Match.cc.

251  {
252  typedef Match<typename Cat::Record, typename Cat::Record> MatchT;
253  std::vector<MatchT> matches;
254 
255  if (radius < 0.0 || radius > (45.0 * lsst::geom::degrees)) {
256  throw LSST_EXCEPT(pex::exceptions::RangeError, "match radius out of range (0 to 45 degrees)");
257  }
258  if (cat.size() == 0) {
259  return matches;
260  }
261  // setup match parameters
262  double const d2Limit = toUnitSphereDistanceSquared(radius);
263 
264  // Build position list
265  size_t len = cat.size();
266  typedef RecordPos<typename Cat::Record> Pos;
267  std::unique_ptr<Pos[]> pos(new Pos[len]);
268  len = makeRecordPositions(cat, pos.get());
269 
270  for (size_t i = 0; i < len; ++i) {
271  double maxDec = pos[i].dec + radius.asRadians();
272  for (size_t j = i + 1; j < len && pos[j].dec <= maxDec; ++j) {
273  double dx = pos[i].x - pos[j].x;
274  double dy = pos[i].y - pos[j].y;
275  double dz = pos[i].z - pos[j].z;
276  double d2 = dx * dx + dy * dy + dz * dz;
277  if (d2 < d2Limit) {
278  lsst::geom::Angle d = fromUnitSphereDistanceSquared(d2);
279  matches.push_back(MatchT(pos[i].src, pos[j].src, d));
280  if (mc.symmetricMatch) {
281  matches.push_back(MatchT(pos[j].src, pos[i].src, d));
282  }
283  }
284  }
285  }
286  return matches;
287 }

◆ matchRaDec() [3/14]

template<typename Cat1 , typename Cat2 >
std::vector< Match< typename Cat1::Record, typename Cat2::Record > > lsst::afw::table::matchRaDec ( Cat1 const &  cat1,
Cat2 const &  cat2,
lsst::geom::Angle  radius,
bool  closest 
)

Compute all tuples (s1,s2,d) where s1 belings to cat1, s2 belongs to cat2 and d, the distance between s1 and s2, is at most radius.

If cat1 and cat2 are identical, then this call is equivalent to matchRaDec(cat1,radius). The match is performed in ra, dec space.

Deprecated:
. Use the matchRaDec(..., MatchControl) version
Parameters
[in]cat1first catalog
[in]cat2second catalog
[in]radiusmatch radius
[in]closestif true then just return the closest match

This is instantiated for Simple-Simple, Simple-Source, and Source-Source catalog combinations.

Definition at line 147 of file Match.cc.

150  {
151  MatchControl mc;
152  mc.findOnlyClosest = closest;
153 
154  return matchRaDec(cat1, cat2, radius, mc);
155 }

◆ matchRaDec() [4/14]

template<typename Cat1 , typename Cat2 >
std::vector< Match< typename Cat1::Record, typename Cat2::Record > > lsst::afw::table::matchRaDec ( Cat1 const &  cat1,
Cat2 const &  cat2,
lsst::geom::Angle  radius,
MatchControl const &  mc = MatchControl() 
)

Compute all tuples (s1,s2,d) where s1 belings to cat1, s2 belongs to cat2 and d, the distance between s1 and s2, is at most radius.

If cat1 and cat2 are identical, then this call is equivalent to matchRaDec(cat1,radius). The match is performed in ra, dec space.

This is instantiated for Simple-Simple, Simple-Source, and Source-Source catalog combinations.

Parameters
cat1first catalog
cat2second catalog
radiusmatch radius
mchow to do the matching (obeys MatchControl::findOnlyClosest)

Definition at line 158 of file Match.cc.

161  {
162  typedef Match<typename Cat1::Record, typename Cat2::Record> MatchT;
163  std::vector<MatchT> matches;
164 
165  if (doSelfMatchIfSame(matches, cat1, cat2, radius)) return matches;
166 
167  if (radius < 0.0 || (radius > (45. * lsst::geom::degrees))) {
168  throw LSST_EXCEPT(pex::exceptions::RangeError, "match radius out of range (0 to 45 degrees)");
169  }
170  if (cat1.size() == 0 || cat2.size() == 0) {
171  return matches;
172  }
173  // setup match parameters
174  double const d2Limit = toUnitSphereDistanceSquared(radius);
175 
176  // Build position lists
177  size_t len1 = cat1.size();
178  size_t len2 = cat2.size();
179 
180  typedef RecordPos<typename Cat1::Record> Pos1;
181  typedef RecordPos<typename Cat2::Record> Pos2;
182  std::unique_ptr<Pos1[]> pos1(new Pos1[len1]);
183  std::unique_ptr<Pos2[]> pos2(new Pos2[len2]);
184  len1 = makeRecordPositions(cat1, pos1.get());
185  len2 = makeRecordPositions(cat2, pos2.get());
187 
188  for (size_t i = 0, start = 0; i < len1; ++i) {
189  double minDec = pos1[i].dec - radius.asRadians();
190  while (start < len2 && pos2[start].dec < minDec) {
191  ++start;
192  }
193  if (start == len2) {
194  break;
195  }
196  double maxDec = pos1[i].dec + radius.asRadians();
197  size_t closestIndex = -1; // Index of closest match (if any)
198  double d2Include = d2Limit; // Squared distance for inclusion of match
199  bool found = false; // Found anything?
200  size_t nMatches = 0; // Number of matches
201  for (size_t j = start; j < len2 && pos2[j].dec <= maxDec; ++j) {
202  double dx = pos1[i].x - pos2[j].x;
203  double dy = pos1[i].y - pos2[j].y;
204  double dz = pos1[i].z - pos2[j].z;
205  double d2 = dx * dx + dy * dy + dz * dz;
206  if (d2 < d2Include) {
207  if (mc.findOnlyClosest) {
208  d2Include = d2;
209  closestIndex = j;
210  found = true;
211  } else {
212  matches.push_back(MatchT(pos1[i].src, pos2[j].src, fromUnitSphereDistanceSquared(d2)));
213  }
214  ++nMatches;
215  }
216  }
217  if (mc.includeMismatches && nMatches == 0) {
218  matches.push_back(MatchT(pos1[i].src, nullRecord, NAN));
219  }
220  if (mc.findOnlyClosest && found) {
221  matches.push_back(
222  MatchT(pos1[i].src, pos2[closestIndex].src, fromUnitSphereDistanceSquared(d2Include)));
223  }
224  }
225  return matches;
226 }

◆ matchRaDec() [5/14]

template SimpleMatchVector lsst::afw::table::matchRaDec ( SimpleCatalog const &  ,
lsst::geom::Angle  ,
bool   
)

◆ matchRaDec() [6/14]

template SimpleMatchVector lsst::afw::table::matchRaDec ( SimpleCatalog const &  ,
lsst::geom::Angle  ,
MatchControl const &   
)

◆ matchRaDec() [7/14]

template SimpleMatchVector lsst::afw::table::matchRaDec ( SimpleCatalog const &  ,
SimpleCatalog const &  ,
lsst::geom::Angle  ,
bool   
)

◆ matchRaDec() [8/14]

template SimpleMatchVector lsst::afw::table::matchRaDec ( SimpleCatalog const &  ,
SimpleCatalog const &  ,
lsst::geom::Angle  ,
MatchControl const &   
)

◆ matchRaDec() [9/14]

template ReferenceMatchVector lsst::afw::table::matchRaDec ( SimpleCatalog const &  ,
SourceCatalog const &  ,
lsst::geom::Angle  ,
bool   
)

◆ matchRaDec() [10/14]

template ReferenceMatchVector lsst::afw::table::matchRaDec ( SimpleCatalog const &  ,
SourceCatalog const &  ,
lsst::geom::Angle  ,
MatchControl const &   
)

◆ matchRaDec() [11/14]

template SourceMatchVector lsst::afw::table::matchRaDec ( SourceCatalog const &  ,
lsst::geom::Angle  ,
bool   
)

◆ matchRaDec() [12/14]

template SourceMatchVector lsst::afw::table::matchRaDec ( SourceCatalog const &  ,
lsst::geom::Angle  ,
MatchControl const &   
)

◆ matchRaDec() [13/14]

template SourceMatchVector lsst::afw::table::matchRaDec ( SourceCatalog const &  ,
SourceCatalog const &  ,
lsst::geom::Angle  ,
bool   
)

◆ matchRaDec() [14/14]

template SourceMatchVector lsst::afw::table::matchRaDec ( SourceCatalog const &  ,
SourceCatalog const &  ,
lsst::geom::Angle  ,
MatchControl const &   
)

◆ matchXy() [1/4]

SourceMatchVector lsst::afw::table::matchXy ( SourceCatalog const &  cat,
double  radius,
bool  symmetric 
)

Compute all tuples (s1,s2,d) where s1 != s2, s1 and s2 both belong to cat, and d, the distance between s1 and s2, in pixels, is at most radius.

The match is performed in pixel space (2d cartesian).

Deprecated:
Please use the matchXy(..., MatchControl const&) API
Parameters
[in]catthe catalog to self-match
[in]radiusmatch radius (pixels)
[in]symmetricif cat to true symmetric matches are produced: i.e. if (s1, s2, d) is reported, then so is (s2, s1, d).

Definition at line 383 of file Match.cc.

383  {
384  MatchControl mc;
385  mc.symmetricMatch = symmetric;
386 
387  return matchXy(cat, radius, mc);
388 }

◆ matchXy() [2/4]

SourceMatchVector lsst::afw::table::matchXy ( SourceCatalog const &  cat,
double  radius,
MatchControl const &  mc = MatchControl() 
)

Compute all tuples (s1,s2,d) where s1 != s2, s1 and s2 both belong to cat, and d, the distance between s1 and s2, in pixels, is at most radius.

The match is performed in pixel space (2d cartesian).

Parameters
catthe catalog to self-match
radiusmatch radius (pixels)
mchow to do the matching (obeys MatchControl::symmetricMatch)

Definition at line 390 of file Match.cc.

390  {
391  // setup match parameters
392  double const r2 = radius * radius;
393 
394  // copy and sort array of pointers on y
395  size_t len = cat.size();
397  size_t n = 0;
398  for (SourceCatalog::const_iterator i(cat.begin()), e(cat.end()); i != e; ++i) {
399  if (std::isnan(i->getX()) || std::isnan(i->getY())) {
400  continue;
401  }
402  pos[n] = i;
403  ++n;
404  }
405  len = n;
406 
407  std::sort(pos.get(), pos.get() + len, CmpRecordPtr());
408 
409  SourceMatchVector matches;
410  for (size_t i = 0; i < len; ++i) {
411  double x = pos[i]->getX();
412  double y = pos[i]->getY();
413  double maxY = y + radius;
414  double y2;
415  for (size_t j = i + 1; j < len && (y2 = pos[j]->getY()) <= maxY; ++j) {
416  double dx = x - pos[j]->getX();
417  double dy = y - y2;
418  double d2 = dx * dx + dy * dy;
419  if (d2 < r2) {
420  double d = std::sqrt(d2);
421  matches.push_back(SourceMatch(pos[i], pos[j], d));
422  if (mc.symmetricMatch) {
423  matches.push_back(SourceMatch(pos[j], pos[i], d));
424  }
425  }
426  }
427  }
428  return matches;
429 }

◆ matchXy() [3/4]

SourceMatchVector lsst::afw::table::matchXy ( SourceCatalog const &  cat1,
SourceCatalog const &  cat2,
double  radius,
bool  closest 
)

Compute all tuples (s1,s2,d) where s1 belings to cat1, s2 belongs to cat2 and d, the distance between s1 and s2, in pixels, is at most radius.

If cat1 and cat2 are identical, then this call is equivalent to matchXy(cat1,radius). The match is performed in pixel space (2d cartesian).

Deprecated:
Please use the matchXy(..., MatchControl const&) API
Parameters
[in]cat1first catalog
[in]cat2second catalog
[in]radiusmatch radius (pixels)
[in]closestif true then just return the closest match

Definition at line 298 of file Match.cc.

298  {
299  MatchControl mc;
300  mc.findOnlyClosest = closest;
301 
302  return matchXy(cat1, cat2, radius, mc);
303 }

◆ matchXy() [4/4]

SourceMatchVector lsst::afw::table::matchXy ( SourceCatalog const &  cat1,
SourceCatalog const &  cat2,
double  radius,
MatchControl const &  mc = MatchControl() 
)

Compute all tuples (s1,s2,d) where s1 belings to cat1, s2 belongs to cat2 and d, the distance between s1 and s2, in pixels, is at most radius.

If cat1 and cat2 are identical, then this call is equivalent to matchXy(cat1,radius). The match is performed in pixel space (2d cartesian).

Parameters
cat1first catalog
cat2second catalog
radiusmatch radius (pixels)
mchow to do the matching (obeys MatchControl::findOnlyClosest)

Definition at line 305 of file Match.cc.

306  {
307  if (&cat1 == &cat2) {
308  return matchXy(cat1, radius);
309  }
310  // setup match parameters
311  double const r2 = radius * radius;
312 
313  // copy and sort array of pointers on y
314  size_t len1 = cat1.size();
315  size_t len2 = cat2.size();
319  size_t n = 0;
320  for (SourceCatalog::const_iterator i(cat1.begin()), e(cat1.end()); i != e; ++i) {
321  if (std::isnan(i->getX()) || std::isnan(i->getY())) {
322  continue;
323  }
324  pos1[n] = i;
325  ++n;
326  }
327  len1 = n;
328  n = 0;
329  for (SourceCatalog::const_iterator i(cat2.begin()), e(cat2.end()); i != e; ++i) {
330  if (std::isnan(i->getX()) || std::isnan(i->getY())) {
331  continue;
332  }
333  pos2[n] = i;
334  ++n;
335  }
336  len2 = n;
337 
338  std::sort(pos1.get(), pos1.get() + len1, CmpRecordPtr());
339  std::sort(pos2.get(), pos2.get() + len2, CmpRecordPtr());
340 
341  SourceMatchVector matches;
342  for (size_t i = 0, start = 0; i < len1; ++i) {
343  double y = pos1[i]->getY();
344  double minY = y - radius;
345  while (start < len2 && pos2[start]->getY() < minY) {
346  ++start;
347  }
348  if (start == len2) {
349  break;
350  }
351  double x = pos1[i]->getX();
352  double maxY = y + radius;
353  double y2;
354  size_t closestIndex = -1; // Index of closest match (if any)
355  double r2Include = r2; // Squared radius for inclusion of match
356  bool found = false; // Found anything?
357  size_t nMatches = 0; // Number of matches
358  for (size_t j = start; j < len2 && (y2 = pos2[j]->getY()) <= maxY; ++j) {
359  double dx = x - pos2[j]->getX();
360  double dy = y - y2;
361  double d2 = dx * dx + dy * dy;
362  if (d2 < r2Include) {
363  if (mc.findOnlyClosest) {
364  r2Include = d2;
365  closestIndex = j;
366  found = true;
367  } else {
368  matches.push_back(SourceMatch(pos1[i], pos2[j], std::sqrt(d2)));
369  }
370  ++nMatches;
371  }
372  }
373  if (mc.includeMismatches && nMatches == 0) {
374  matches.push_back(SourceMatch(pos1[i], nullRecord, NAN));
375  }
376  if (mc.findOnlyClosest && found) {
377  matches.push_back(SourceMatch(pos1[i], pos2[closestIndex], std::sqrt(r2Include)));
378  }
379  }
380  return matches;
381 }

◆ operator<<() [1/2]

std::ostream& lsst::afw::table::operator<< ( std::ostream os,
BaseRecord const &  record 
)

Definition at line 159 of file BaseRecord.cc.

159  {
160  record._stream(os);
161  return os;
162 }

◆ operator<<() [2/2]

std::ostream& lsst::afw::table::operator<< ( std::ostream os,
Schema const &  schema 
)

Definition at line 751 of file Schema.cc.

751  {
752  os << "Schema(\n";
753  schema.forEach(Stream(&os));
754  for (auto iter = schema.getAliasMap()->begin(); iter != schema.getAliasMap()->end(); ++iter) {
755  os << " '" << iter->first << "'->'" << iter->second << "'\n";
756  }
757  return os << ")\n";
758 }

◆ packMatches() [1/4]

template BaseCatalog lsst::afw::table::packMatches ( ReferenceMatchVector const &  )

◆ packMatches() [2/4]

template BaseCatalog lsst::afw::table::packMatches ( SimpleMatchVector const &  )

◆ packMatches() [3/4]

template BaseCatalog lsst::afw::table::packMatches ( SourceMatchVector const &  )

◆ packMatches() [4/4]

template<typename Record1 , typename Record2 >
BaseCatalog lsst::afw::table::packMatches ( std::vector< Match< Record1, Record2 > > const &  matches)

Return a table representation of a MatchVector that can be used to persist it.

The schema of the returned object has "first" (RecordId), "second" (RecordID), and "distance" (double) fields.

Parameters
[in]matchesA std::vector of Match objects to convert to table form.

Definition at line 432 of file Match.cc.

432  {
433  Schema schema;
434  Key<RecordId> outKey1 = schema.addField<RecordId>("first", "ID for first source record in match.");
435  Key<RecordId> outKey2 = schema.addField<RecordId>("second", "ID for second source record in match.");
436  Key<double> keyD = schema.addField<double>("distance", "Distance between matches sources.");
438  result.getTable()->preallocate(matches.size());
439  result.reserve(matches.size());
440  typedef typename std::vector<Match<Record1, Record2> >::const_iterator Iter;
441  for (Iter i = matches.begin(); i != matches.end(); ++i) {
442  std::shared_ptr<BaseRecord> record = result.addNew();
443  record->set(outKey1, i->first->getId());
444  record->set(outKey2, i->second->getId());
445  record->set(keyD, i->distance);
446  }
447  return result;
448 }

◆ PYBIND11_MODULE()

lsst::afw::table::PYBIND11_MODULE ( _table  ,
mod   
)

Definition at line 52 of file _table.cc.

52  {
53  WrapperCollection wrappers(mod, "lsst.afw.table");
54  wrapAliasMap(wrappers);
55  wrapSchema(wrappers);
56  wrapSchemaMapper(wrappers);
57  wrapBaseColumnView(wrappers);
58  wrapBase(wrappers);
59  wrapIdFactory(wrappers);
60  wrapArrays(wrappers);
61  wrapAggregates(wrappers);
62  wrapSlots(wrappers);
63  wrapSimple(wrappers);
64  wrapSource(wrappers);
65  wrapExposure(wrappers);
66  wrapMatch(wrappers);
67  wrapWcsUtils(wrappers);
68  wrappers.finish();
69 }

◆ unpackMatches() [1/4]

template SimpleMatchVector lsst::afw::table::unpackMatches ( BaseCatalog const &  ,
SimpleCatalog const &  ,
SimpleCatalog const &   
)

◆ unpackMatches() [2/4]

template ReferenceMatchVector lsst::afw::table::unpackMatches ( BaseCatalog const &  ,
SimpleCatalog const &  ,
SourceCatalog const &   
)

◆ unpackMatches() [3/4]

template SourceMatchVector lsst::afw::table::unpackMatches ( BaseCatalog const &  ,
SourceCatalog const &  ,
SourceCatalog const &   
)

◆ unpackMatches() [4/4]

template<typename Cat1 , typename Cat2 >
std::vector< Match< typename Cat1::Record, typename Cat2::Record > > lsst::afw::table::unpackMatches ( BaseCatalog const &  matches,
Cat1 const &  cat1,
Cat2 const &  cat2 
)

Reconstruct a MatchVector from a BaseCatalog representation of the matches and a pair of catalogs.

Note
The first and second catalog arguments must be sorted in ascending ID order on input; this will allow us to use binary search algorithms to find the records referred to by the match table.

If an ID cannot be found in the given tables, that pointer will be set to null in the returned match vector.

Parameters
[in]matchesA normalized BaseCatalog representation, as produced by packMatches.
[in]cat1A CatalogT containing the records used on the 'first' side of the match, sorted by ascending ID.
[in]cat2A CatalogT containing the records used on the 'second' side of the match, sorted by ascending ID. May be the same as first.

This is instantiated for Simple-Simple, Simple-Source, and Source-Source catalog combinations.

Definition at line 455 of file Match.cc.

457  {
458  LOG_LOGGER tableLog = LOG_GET("afw.table");
459  Key<RecordId> inKey1 = matches.getSchema()["first"];
460  Key<RecordId> inKey2 = matches.getSchema()["second"];
461  Key<double> keyD = matches.getSchema()["distance"];
462  if (!first.isSorted() || !second.isSorted())
463  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
464  "Catalogs passed to unpackMatches must be sorted.");
465  typedef Match<typename Cat1::Record, typename Cat2::Record> MatchT;
467  result.resize(matches.size());
468  typename std::vector<MatchT>::iterator j = result.begin();
469  for (BaseCatalog::const_iterator i = matches.begin(); i != matches.end(); ++i, ++j) {
470  typename Cat1::const_iterator k1 = first.find(i->get(inKey1));
471  typename Cat2::const_iterator k2 = second.find(i->get(inKey2));
472  if (k1 != first.end()) {
473  j->first = k1;
474  } else {
475  LOGLS_WARN(tableLog,
476  "Persisted match record with ID " << i->get(inKey1) << " not found in catalog 1.");
477  }
478  if (k2 != second.end()) {
479  j->second = k2;
480  } else {
481  LOGLS_WARN(tableLog,
482  "Persisted match record with ID " << i->get(inKey2) << " not found in catalog 2.");
483  }
484  j->distance = i->get(keyD);
485  }
486  return result;
487 }

◆ updateRefCentroids()

template<typename ReferenceCollection >
void lsst::afw::table::updateRefCentroids ( geom::SkyWcs const &  wcs,
ReferenceCollection &  refList 
)

Update centroids in a collection of reference objects.

Template Parameters
RefCollectionType of sequence of reference objects, e.g. lsst::afw::table::SimpleCatalog or std::vector<std::shared_ptr<lsst::afw::table::SimpleRecord>>
Parameters
[in]wcsWCS to map from sky to pixels
[in,out]refListCollection of reference objects. The schema must have three fields:
  • "coord": a field containing an ICRS lsst::afw::SpherePoint; this field is read
  • "centroid": a field containing lsst::geom::Point2D; this field is written
  • "hasCentroid": a flag; this field is written
Exceptions
lsst::pex::exceptions::NotFoundErrorif refList's schema does not have the required fields.

Definition at line 73 of file wcsUtils.cc.

73  {
74  if (refList.empty()) {
75  return;
76  }
77  auto const schema = getSchema(refList[0]);
78  CoordKey const coordKey(schema["coord"]);
79  Point2DKey const centroidKey(schema["centroid"]);
80  Key<Flag> const hasCentroidKey(schema["hasCentroid"]);
82  skyList.reserve(refList.size());
83  for (auto const &record : refList) {
84  skyList.emplace_back(getValue(record, coordKey));
85  }
86  std::vector<lsst::geom::Point2D> const pixelList = wcs.skyToPixel(skyList);
87  auto pixelPos = pixelList.cbegin();
88  for (auto &refObj : refList) {
89  setValue(refObj, centroidKey, *pixelPos);
90  setValue(refObj, hasCentroidKey, true);
91  ++pixelPos;
92  }
93 }

◆ updateSourceCoords()

template<typename SourceCollection >
void lsst::afw::table::updateSourceCoords ( geom::SkyWcs const &  wcs,
SourceCollection &  sourceList 
)

Update sky coordinates in a collection of source objects.

Template Parameters
SourceCollectionType of sequence of sources, e.g. lsst::afw::table::SourceCatalog or std::vector<std::shared_ptr<lsst::afw::table::SourceRecord>>
Parameters
[in]wcsWCS to map from pixels to sky
[in,out]sourceListCollection of sources. The schema must have two fields:
  • "slot_Centroid": a field containing lsst::geom::Point2D; this field is read
  • "coord": a field containing an ICRS lsst::afw::SpherePoint; this field is written
Exceptions
lsst::pex::exceptions::NotFoundErrorif refList's schema does not have the required fields.

Definition at line 96 of file wcsUtils.cc.

96  {
97  if (sourceList.empty()) {
98  return;
99  }
100  auto const schema = getSchema(sourceList[0]);
101  Point2DKey const centroidKey(schema["slot_Centroid"]);
102  CoordKey const coordKey(schema["coord"]);
104  pixelList.reserve(sourceList.size());
105  for (auto const &source : sourceList) {
106  pixelList.emplace_back(getValue(source, centroidKey));
107  }
108  std::vector<lsst::geom::SpherePoint> const skyList = wcs.pixelToSky(pixelList);
109  auto skyCoord = skyList.cbegin();
110  for (auto &source : sourceList) {
111  setValue(source, coordKey, *skyCoord);
112  ++skyCoord;
113  }
114 }

◆ wrapAggregates()

void lsst::afw::table::wrapAggregates ( WrapperCollection wrappers)

Definition at line 201 of file _aggregates.cc.

201  {
202  // TODO: uncomment once afw.geom uses WrapperCollection
203  // wrappers.addSignatureDependency("lsst.afw.geom.ellipses");
204 
205  wrappers.wrapType(py::enum_<CoordinateType>(wrappers.module, "CoordinateType"), [](auto &mod, auto &enm) {
206  enm.value("PIXEL", CoordinateType::PIXEL);
207  enm.value("CELESTIAL", CoordinateType::CELESTIAL);
208  enm.export_values();
209  });
210 
211  declarePointKey<double>(wrappers, "2D");
212  declarePointKey<int>(wrappers, "2I");
213 
214  declareBoxKey<lsst::geom::Box2D>(wrappers, "2D");
215  declareBoxKey<lsst::geom::Box2I>(wrappers, "2I");
216 
217  declareCoordKey(wrappers);
218  declareQuadrupoleKey(wrappers);
219  declareEllipseKey(wrappers);
220 
221  declareCovarianceMatrixKey<float, 2>(wrappers, "2f");
222  declareCovarianceMatrixKey<float, 3>(wrappers, "3f");
223  declareCovarianceMatrixKey<float, 4>(wrappers, "4f");
224  declareCovarianceMatrixKey<float, Eigen::Dynamic>(wrappers, "Xf");
225  declareCovarianceMatrixKey<double, 2>(wrappers, "2d");
226  declareCovarianceMatrixKey<double, 3>(wrappers, "3d");
227  declareCovarianceMatrixKey<double, 4>(wrappers, "4d");
228  declareCovarianceMatrixKey<double, Eigen::Dynamic>(wrappers, "Xd");
229 }

◆ wrapAliasMap()

void lsst::afw::table::wrapAliasMap ( utils::python::WrapperCollection wrappers)

Definition at line 39 of file _aliasMap.cc.

39  {
40  wrappers.wrapType(PyAliasMap(wrappers.module, "AliasMap"), [](auto &mod, auto &cls) {
41  cls.def(py::init<>());
42  cls.def(py::init<AliasMap const &>());
43 
44  cls.def("__len__", &AliasMap::size);
45  cls.def("empty", &AliasMap::empty);
46  cls.def("apply", &AliasMap::apply, "name"_a);
47  cls.def("get", &AliasMap::get, "alias"_a);
48  cls.def("__getitem__", &AliasMap::get, "alias"_a);
49  cls.def("set", &AliasMap::set, "alias"_a, "target"_a);
50  cls.def("__setitem__", &AliasMap::set);
51  cls.def("erase", &AliasMap::erase, "alias"_a);
52  cls.def("__delitem__", &AliasMap::erase, "alias"_a);
53  cls.def("__eq__", [](AliasMap &self, AliasMap &other) { return self == other; });
54  cls.def("__ne__", [](AliasMap &self, AliasMap &other) { return self != other; });
55  cls.def("contains", &AliasMap::contains, "other"_a);
56  cls.def("__contains__", &AliasMap::contains);
57  cls.def("items", [](AliasMap &self) { return py::make_iterator(self.begin(), self.end()); },
58  py::keep_alive<0, 1>());
59  });
60 }

◆ wrapArrays()

void lsst::afw::table::wrapArrays ( WrapperCollection wrappers)

Definition at line 101 of file _arrays.cc.

101  {
102  declareArrayKey<float>(wrappers, "F");
103  declareArrayKey<double>(wrappers, "D");
104 }

◆ wrapBase()

void lsst::afw::table::wrapBase ( WrapperCollection wrappers)

Definition at line 174 of file _base.cc.

174  {
175  wrappers.addSignatureDependency("lsst.daf.base");
176 
177  auto clsBaseTable = declareBaseTable(wrappers);
178  auto clsBaseRecord = declareBaseRecord(wrappers);
179  auto clsBaseCatalog = table::python::declareCatalog<BaseRecord>(wrappers, "Base");
180  auto clsBaseColumnView = table::python::declareColumnView<BaseRecord>(wrappers, "Base");
181 
182  clsBaseRecord.attr("Table") = clsBaseTable;
183  clsBaseRecord.attr("ColumnView") = clsBaseColumnView;
184  clsBaseRecord.attr("Catalog") = clsBaseCatalog;
185  clsBaseTable.attr("Record") = clsBaseRecord;
186  clsBaseTable.attr("ColumnView") = clsBaseColumnView;
187  clsBaseTable.attr("Catalog") = clsBaseCatalog;
188  clsBaseCatalog.attr("Record") = clsBaseRecord;
189  clsBaseCatalog.attr("Table") = clsBaseTable;
190  clsBaseCatalog.attr("ColumnView") = clsBaseColumnView;
191 }

◆ wrapBaseColumnView()

void lsst::afw::table::wrapBaseColumnView ( WrapperCollection wrappers)

Definition at line 128 of file _baseColumnView.cc.

128  {
129  declareBaseColumnView(wrappers);
130  declareBitsColumn(wrappers);
131 }

◆ wrapExposure()

void lsst::afw::table::wrapExposure ( WrapperCollection wrappers)

Definition at line 175 of file _exposure.cc.

175  {
176  // wrappers.addSignatureDependency("lsst.afw.geom");
177  // TODO: afw.geom, afw.image, and afw.detection cannot be imported due to
178  // circular dependencies until at least afw.image uses WrapperCollection
179  // in DM-20703
180 
181  auto clsExposureRecord = declareExposureRecord(wrappers);
182  auto clsExposureTable = declareExposureTable(wrappers);
183  auto clsExposureColumnView = table::python::declareColumnView<ExposureRecord>(wrappers, "Exposure");
184  auto clsExposureCatalog = declareExposureCatalog(wrappers);
185 
186  clsExposureRecord.attr("Table") = clsExposureTable;
187  clsExposureRecord.attr("ColumnView") = clsExposureColumnView;
188  clsExposureRecord.attr("Catalog") = clsExposureCatalog;
189  clsExposureTable.attr("Record") = clsExposureRecord;
190  clsExposureTable.attr("ColumnView") = clsExposureColumnView;
191  clsExposureTable.attr("Catalog") = clsExposureCatalog;
192  clsExposureCatalog.attr("Record") = clsExposureRecord;
193  clsExposureCatalog.attr("Table") = clsExposureTable;
194  clsExposureCatalog.attr("ColumnView") = clsExposureColumnView;
195 }

◆ wrapIdFactory()

void lsst::afw::table::wrapIdFactory ( utils::python::WrapperCollection wrappers)

Definition at line 38 of file _idFactory.cc.

38  {
39  wrappers.wrapType(PyIdFactory(wrappers.module, "IdFactory"), [](auto& mod, auto& cls) {
40  cls.def("__call__", &IdFactory::operator());
41  cls.def("notify", &IdFactory::notify, "id"_a);
42  cls.def("clone", &IdFactory::clone);
43  cls.def_static("makeSimple", IdFactory::makeSimple);
44  cls.def_static("makeSource", IdFactory::makeSource, "expId"_a, "reserved"_a);
45  cls.def_static("computeReservedFromMaxBits", IdFactory::computeReservedFromMaxBits, "maxBits"_a);
46  });
47 }

◆ wrapMatch()

void lsst::afw::table::wrapMatch ( WrapperCollection wrappers)

Definition at line 89 of file _match.cc.

89  {
90  wrappers.wrapType(py::class_<MatchControl>(wrappers.module, "MatchControl"), [](auto &mod, auto &cls) {
91  cls.def(py::init<>());
92  LSST_DECLARE_CONTROL_FIELD(cls, MatchControl, findOnlyClosest);
93  LSST_DECLARE_CONTROL_FIELD(cls, MatchControl, symmetricMatch);
94  LSST_DECLARE_CONTROL_FIELD(cls, MatchControl, includeMismatches);
95  });
96 
97  declareMatch2<SimpleCatalog, SimpleCatalog>(wrappers, "Simple");
98  declareMatch2<SimpleCatalog, SourceCatalog>(wrappers, "Reference");
99  declareMatch2<SourceCatalog, SourceCatalog>(wrappers, "Source");
100  declareMatch1<SimpleCatalog>(wrappers);
101  declareMatch1<SourceCatalog>(wrappers);
102 
103  wrappers.wrap([](auto &mod) {
104  mod.def("matchXy",
105  (SourceMatchVector(*)(SourceCatalog const &, SourceCatalog const &, double,
106  MatchControl const &))matchXy,
107  "cat1"_a, "cat2"_a, "radius"_a, "mc"_a = MatchControl());
108  mod.def("matchXy", (SourceMatchVector(*)(SourceCatalog const &, double, MatchControl const &))matchXy,
109  "cat"_a, "radius"_a, "mc"_a = MatchControl());
110  });
111 }

◆ wrapSchema()

void lsst::afw::table::wrapSchema ( WrapperCollection wrappers)

Definition at line 539 of file _schema.cc.

539  {
540  // We'll add instantiations of Field, Key, and SchemaItem to these private
541  // dicts, and then in schemaContinued.py we'll add them to a TemplateMeta
542  // ABC.
543  auto &mod = wrappers.module;
544  mod.attr("_Field") = py::dict();
545  mod.attr("_Key") = py::dict();
546  mod.attr("_SchemaItem") = py::dict();
547 
548  declareSchemaType<std::uint8_t>(wrappers);
549  declareSchemaType<std::uint16_t>(wrappers);
550  declareSchemaType<std::int32_t>(wrappers);
551  declareSchemaType<std::int64_t>(wrappers);
552  declareSchemaType<float>(wrappers);
553  declareSchemaType<double>(wrappers);
554  declareSchemaType<std::string>(wrappers);
555  declareSchemaType<lsst::geom::Angle>(wrappers);
556  declareSchemaType<Array<std::uint8_t>>(wrappers);
557  declareSchemaType<Array<std::uint16_t>>(wrappers);
558  declareSchemaType<Array<int>>(wrappers);
559  declareSchemaType<Array<float>>(wrappers);
560  declareSchemaType<Array<double>>(wrappers);
561  declareSchemaType<Flag>(wrappers);
562 
563  declareSchema(wrappers);
564  declareSubSchema(wrappers);
565 }

◆ wrapSchemaMapper()

void lsst::afw::table::wrapSchemaMapper ( WrapperCollection wrappers)

Definition at line 55 of file _schemaMapper.cc.

55  {
56  wrappers.wrapType(PySchemaMapper(wrappers.module, "SchemaMapper"), [](auto &mod, auto &cls) {
57  cls.def(py::init<>());
58  cls.def(py::init<Schema const &, Schema const &>());
59  cls.def(py::init<Schema const &, bool>(), "input"_a, "shareAliasMap"_a = false);
60 
61  cls.def("getInputSchema", &SchemaMapper::getInputSchema);
62  cls.def("getOutputSchema", &SchemaMapper::getOutputSchema);
63  cls.def("editOutputSchema", &SchemaMapper::editOutputSchema,
64  py::return_value_policy::reference_internal);
65  cls.def("addMinimalSchema", &SchemaMapper::addMinimalSchema, "minimal"_a, "doMap"_a = true);
66  cls.def_static("removeMinimalSchema", &SchemaMapper::removeMinimalSchema);
67  cls.def_static("join", &SchemaMapper::join, "inputs"_a, "prefixes"_a = std::vector<std::string>());
68 
69  declareSchemaMapperOverloads<std::uint8_t>(cls, "B");
70  declareSchemaMapperOverloads<std::uint16_t>(cls, "U");
71  declareSchemaMapperOverloads<std::int32_t>(cls, "I");
72  declareSchemaMapperOverloads<std::int64_t>(cls, "L");
73  declareSchemaMapperOverloads<float>(cls, "F");
74  declareSchemaMapperOverloads<double>(cls, "D");
75  declareSchemaMapperOverloads<std::string>(cls, "String");
76  declareSchemaMapperOverloads<lsst::geom::Angle>(cls, "Angle");
77  declareSchemaMapperOverloads<lsst::afw::table::Flag>(cls, "Flag");
78  declareSchemaMapperOverloads<lsst::afw::table::Array<std::uint8_t>>(cls, "ArrayB");
79  declareSchemaMapperOverloads<lsst::afw::table::Array<std::uint16_t>>(cls, "ArrayU");
80  declareSchemaMapperOverloads<lsst::afw::table::Array<int>>(cls, "ArrayI");
81  declareSchemaMapperOverloads<lsst::afw::table::Array<float>>(cls, "ArrayF");
82  declareSchemaMapperOverloads<lsst::afw::table::Array<double>>(cls, "ArrayD");
83  });
84 }

◆ wrapSimple()

void lsst::afw::table::wrapSimple ( WrapperCollection wrappers)

Definition at line 92 of file _simple.cc.

92  {
93  auto clsSimpleRecord = declareSimpleRecord(wrappers);
94  auto clsSimpleTable = declareSimpleTable(wrappers);
95  auto clsSimpleColumnView = table::python::declareColumnView<SimpleRecord>(wrappers, "Simple");
96  auto clsSimpleCatalog = table::python::declareSortedCatalog<SimpleRecord>(wrappers, "Simple");
97 
98  clsSimpleRecord.attr("Table") = clsSimpleTable;
99  clsSimpleRecord.attr("ColumnView") = clsSimpleColumnView;
100  clsSimpleRecord.attr("Catalog") = clsSimpleCatalog;
101  clsSimpleTable.attr("Record") = clsSimpleRecord;
102  clsSimpleTable.attr("ColumnView") = clsSimpleColumnView;
103  clsSimpleTable.attr("Catalog") = clsSimpleCatalog;
104  clsSimpleCatalog.attr("Record") = clsSimpleRecord;
105  clsSimpleCatalog.attr("Table") = clsSimpleTable;
106  clsSimpleCatalog.attr("ColumnView") = clsSimpleColumnView;
107 }

◆ wrapSlots()

void lsst::afw::table::wrapSlots ( WrapperCollection wrappers)

Definition at line 70 of file _slots.cc.

70  {
71  // TODO: uncomment once afw.geom uses WrapperCollection
72  // wrappers.addSignatureDependency("lsst.afw.geom.ellipses");
73 
74  declareSlotDefinition(wrappers);
75  declareSlotDefinitionSubclass<FluxSlotDefinition>(wrappers, "Flux");
76  declareSlotDefinitionSubclass<CentroidSlotDefinition>(wrappers, "Centroid");
77  declareSlotDefinitionSubclass<ShapeSlotDefinition>(wrappers, "Shape");
78 }

◆ wrapSource()

void lsst::afw::table::wrapSource ( WrapperCollection wrappers)

Definition at line 192 of file _source.cc.

192  {
193  // TODO: uncomment once afw.geom uses WrapperCollection
194  // wrappers.addSignatureDependency("lsst.afw.geom.ellipses");
195 
196  // SourceFitsFlags enum values are used as integer masks, so wrap as attributes instead of an enum
197  // static_cast is required to avoid an import error (py::cast and py::int_ do not work by themselves
198  // and are not required with the static_cast)
199  auto &mod = wrappers.module;
200  mod.attr("SOURCE_IO_NO_FOOTPRINTS") = static_cast<int>(SourceFitsFlags::SOURCE_IO_NO_FOOTPRINTS);
201  mod.attr("SOURCE_IO_NO_HEAVY_FOOTPRINTS") =
203 
204  auto clsSourceRecord = declareSourceRecord(wrappers);
205  auto clsSourceTable = declareSourceTable(wrappers);
206  auto clsSourceColumnView = declareSourceColumnView(wrappers);
207  auto clsSourceCatalog = table::python::declareSortedCatalog<SourceRecord>(wrappers, "Source");
208 
209  clsSourceRecord.attr("Table") = clsSourceTable;
210  clsSourceRecord.attr("ColumnView") = clsSourceColumnView;
211  clsSourceRecord.attr("Catalog") = clsSourceCatalog;
212  clsSourceTable.attr("Record") = clsSourceRecord;
213  clsSourceTable.attr("ColumnView") = clsSourceColumnView;
214  clsSourceTable.attr("Catalog") = clsSourceCatalog;
215  clsSourceCatalog.attr("Record") = clsSourceRecord;
216  clsSourceCatalog.attr("Table") = clsSourceTable;
217  clsSourceCatalog.attr("ColumnView") = clsSourceColumnView;
218 }

◆ wrapWcsUtils()

void lsst::afw::table::wrapWcsUtils ( WrapperCollection wrappers)

Definition at line 64 of file _wcsUtils.cc.

64  {
65  declareUpdateRefCentroids<std::vector<std::shared_ptr<lsst::afw::table::SimpleRecord>>>(wrappers);
66  declareUpdateRefCentroids<lsst::afw::table::SimpleCatalog>(wrappers);
67 
68  declareUpdateSourceCoords<std::vector<std::shared_ptr<lsst::afw::table::SourceRecord>>>(wrappers);
69  declareUpdateSourceCoords<lsst::afw::table::SourceCatalog>(wrappers);
70 }

Variable Documentation

◆ _

lsst::afw::table::_

Definition at line 188 of file BaseColumnView.cc.

lsst::geom::degrees
constexpr AngleUnit degrees
constant with units of degrees
Definition: Angle.h:109
schema
table::Schema schema
Definition: Amplifier.cc:115
lsst::afw::table::wrapSlots
void wrapSlots(WrapperCollection &wrappers)
Definition: _slots.cc:70
LOG_LOGGER
#define LOG_LOGGER
Definition: Log.h:703
lsst::afw::table::CoordinateType::CELESTIAL
@ CELESTIAL
lsst::afw::table::CoordinateType::PIXEL
@ PIXEL
lsst::afw::table::PyIdFactory
py::class_< IdFactory, std::shared_ptr< IdFactory > > PyIdFactory
Definition: _idFactory.cc:36
std::shared_ptr< RecordT >
lsst::afw::table::RecordId
std::int64_t RecordId
Type used for unique IDs for records.
Definition: misc.h:22
lsst::afw::table._match.second
second
Definition: _match.py:78
lsst::afw::table::PyAliasMap
py::class_< AliasMap, std::shared_ptr< AliasMap > > PyAliasMap
Definition: _aliasMap.cc:37
lsst::afw::table::wrapBaseColumnView
void wrapBaseColumnView(WrapperCollection &wrappers)
Definition: _baseColumnView.cc:128
std::pair
std::vector::reserve
T reserve(T... args)
wcs
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:71
lsst::afw::table::wrapAliasMap
void wrapAliasMap(utils::python::WrapperCollection &wrappers)
Definition: _aliasMap.cc:39
std::vector< MatchT >
std::vector::size
T size(T... args)
dec
double dec
Definition: Match.cc:41
lsst::afw::table._match.first
first
Definition: _match.py:76
LOG_GET
#define LOG_GET(logger)
Definition: Log.h:75
lsst::afw::table::PySchemaMapper
py::class_< SchemaMapper, std::shared_ptr< SchemaMapper > > PySchemaMapper
Definition: _schemaMapper.cc:43
lsst::afw::table::wrapExposure
void wrapExposure(WrapperCollection &wrappers)
Definition: _exposure.cc:175
lsst::afw::table::Point2DKey
PointKey< double > Point2DKey
Definition: aggregates.h:118
std::sort
T sort(T... args)
std::sqrt
T sqrt(T... args)
end
int end
Definition: BoundedField.cc:105
src
std::shared_ptr< RecordT > src
Definition: Match.cc:48
lsst::afw::table::SourceCatalog
SortedCatalogT< SourceRecord > SourceCatalog
Definition: fwd.h:85
lsst::afw::geom.transform.transformContinued.cls
cls
Definition: transformContinued.py:33
std::vector::push_back
T push_back(T... args)
lsst::afw::table::wrapSchema
void wrapSchema(WrapperCollection &wrappers)
Definition: _schema.cc:539
LOGLS_WARN
#define LOGLS_WARN(logger, message)
Definition: Log.h:648
std::isnan
T isnan(T... args)
ast::detail::source
const char * source()
Source function that allows astChannel to source from a Stream.
Definition: Stream.h:224
lsst::afw::table::SOURCE_IO_NO_FOOTPRINTS
@ SOURCE_IO_NO_FOOTPRINTS
Do not read/write footprints at all.
Definition: Source.h:55
astshim.fitsChanContinued.contains
def contains(self, name)
Definition: fitsChanContinued.py:127
lsst::afw::table::wrapIdFactory
void wrapIdFactory(utils::python::WrapperCollection &wrappers)
Definition: _idFactory.cc:38
other
ItemVariant const * other
Definition: Schema.cc:56
lsst::afw::table::wrapBase
void wrapBase(WrapperCollection &wrappers)
Definition: _base.cc:174
lsst::afw::table::matchRaDec
template SourceMatchVector matchRaDec(SourceCatalog const &, lsst::geom::Angle, MatchControl const &)
lsst::afw::table._match.matchXy
matchXy
Definition: _match.py:156
result
py::object result
Definition: _schema.cc:429
lsst::afw::table::wrapSchemaMapper
void wrapSchemaMapper(WrapperCollection &wrappers)
Definition: _schemaMapper.cc:55
LSST_EXCEPT
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
lsst::afw::table::wrapSource
void wrapSource(WrapperCollection &wrappers)
Definition: _source.cc:192
os
std::ostream * os
Definition: Schema.cc:746
y
double y
Definition: Match.cc:43
std::vector::emplace_back
T emplace_back(T... args)
lsst::afw::table::BaseCatalog
CatalogT< BaseRecord > BaseCatalog
Definition: fwd.h:71
lsst::afw::table::wrapArrays
void wrapArrays(WrapperCollection &wrappers)
Definition: _arrays.cc:101
lsst::afw::table::SourceMatchVector
std::vector< SourceMatch > SourceMatchVector
Definition: fwd.h:109
lsst.pipe.tasks.insertFakes.radius
radius
Definition: insertFakes.py:288
x
double x
Definition: Match.cc:42
lsst::afw::table::SourceMatch
Match< SourceRecord, SourceRecord > SourceMatch
Definition: fwd.h:105
lsst::afw::table::wrapMatch
void wrapMatch(WrapperCollection &wrappers)
Definition: _match.cc:89
std::vector::begin
T begin(T... args)
lsst::afw::table::SOURCE_IO_NO_HEAVY_FOOTPRINTS
@ SOURCE_IO_NO_HEAVY_FOOTPRINTS
Read/write heavy footprints as non-heavy footprints.
Definition: Source.h:56
key
Key< U > key
Definition: Schema.cc:281
lsst::geom::Angle
A class representing an angle.
Definition: Angle.h:127
std::vector::end
T end(T... args)
lsst::afw::table::wrapAggregates
void wrapAggregates(WrapperCollection &wrappers)
Definition: _aggregates.cc:201
lsst::afw::table::wrapSimple
void wrapSimple(WrapperCollection &wrappers)
Definition: _simple.cc:92
lsst::afw::table::wrapWcsUtils
void wrapWcsUtils(WrapperCollection &)
Definition: _wcsUtils.cc:64
std::unique_ptr
STL class.
astshim.fitsChanContinued.iter
def iter(self)
Definition: fitsChanContinued.py:88