LSST Applications g0b6bd0c080+a72a5dd7e6,g1182afd7b4+2a019aa3bb,g17e5ecfddb+2b8207f7de,g1d67935e3f+06cf436103,g38293774b4+ac198e9f13,g396055baef+6a2097e274,g3b44f30a73+6611e0205b,g480783c3b1+98f8679e14,g48ccf36440+89c08d0516,g4b93dc025c+98f8679e14,g5c4744a4d9+a302e8c7f0,g613e996a0d+e1c447f2e0,g6c8d09e9e7+25247a063c,g7271f0639c+98f8679e14,g7a9cd813b8+124095ede6,g9d27549199+a302e8c7f0,ga1cf026fa3+ac198e9f13,ga32aa97882+7403ac30ac,ga786bb30fb+7a139211af,gaa63f70f4e+9994eb9896,gabf319e997+ade567573c,gba47b54d5d+94dc90c3ea,gbec6a3398f+06cf436103,gc6308e37c7+07dd123edb,gc655b1545f+ade567573c,gcc9029db3c+ab229f5caf,gd01420fc67+06cf436103,gd877ba84e5+06cf436103,gdb4cecd868+6f279b5b48,ge2d134c3d5+cc4dbb2e3f,ge448b5faa6+86d1ceac1d,gecc7e12556+98f8679e14,gf3ee170dca+25247a063c,gf4ac96e456+ade567573c,gf9f5ea5b4d+ac198e9f13,gff490e6085+8c2580be5c,w.2022.27
LSST Data Management Base Package
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
lsst::afw::table Namespace Reference

Namespaces

namespace  _aggregates
 
namespace  _aliasMap
 
namespace  _arrays
 
namespace  _base
 
namespace  _baseColumnView
 
namespace  _exposure
 
namespace  _match
 
namespace  _schema
 
namespace  _schemaMapper
 
namespace  _simple
 
namespace  _source
 
namespace  catalogMatches
 
namespace  detail
 
namespace  io
 
namespace  multiMatch
 
namespace  python
 
namespace  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...
 
struct  TypeList
 

Typedefs

using Point2IKey = PointKey< int >
 
using Point2DKey = PointKey< double >
 
using Box2IKey = BoxKey< lsst::geom::Box2I >
 
using Box2DKey = BoxKey< lsst::geom::Box2D >
 
using ExposureColumnView = ColumnViewT< ExposureRecord >
 
using ExposureCatalog = ExposureCatalogT< ExposureRecord >
 
using ConstExposureCatalog = ExposureCatalogT< const ExposureRecord >
 
using BaseCatalog = CatalogT< BaseRecord >
 
using ConstBaseCatalog = CatalogT< const BaseRecord >
 
using SimpleColumnView = ColumnViewT< SimpleRecord >
 
using SimpleCatalog = SortedCatalogT< SimpleRecord >
 
using ConstSimpleCatalog = SortedCatalogT< const SimpleRecord >
 
using SourceColumnView = SourceColumnViewT< SourceRecord >
 
using SourceCatalog = SortedCatalogT< SourceRecord >
 
using ConstSourceCatalog = SortedCatalogT< const SourceRecord >
 
using AmpInfoColumnView = ColumnViewT< AmpInfoRecord >
 
using AmpInfoCatalog = CatalogT< AmpInfoRecord >
 
using ConstAmpInfoCatalog = CatalogT< const AmpInfoRecord >
 
using SimpleMatch = Match< SimpleRecord, SimpleRecord >
 
using ReferenceMatch = Match< SimpleRecord, SourceRecord >
 
using SourceMatch = Match< SourceRecord, SourceRecord >
 
using SimpleMatchVector = std::vector< SimpleMatch >
 
using ReferenceMatchVector = std::vector< ReferenceMatch >
 
using SourceMatchVector = std::vector< SourceMatch >
 
using RecordId = std::int64_t
 Type used for unique IDs for records. More...
 
using Angle = lsst::geom::Angle
 
using SpherePoint = lsst::geom::SpherePoint
 
using Footprint = lsst::afw::detection::Footprint
 
using FieldTypes = TypeList< 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 > >
 A compile-time list 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 class  CoordinateType { PIXEL , 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...
 
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 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 wrapAliasMap (WrapperCollection &)
 
void wrapIdFactory (WrapperCollection &)
 
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<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)
 
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<typename Cat >
std::vector< Match< typename Cat::Record, typename Cat::Record > > matchRaDec (Cat const &cat, lsst::geom::Angle radius, bool symmetric)
 
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 &)
 
SourceMatchVector matchXy (SourceCatalog const &cat1, SourceCatalog const &cat2, double radius, bool closest)
 
SourceMatchVector matchXy (SourceCatalog const &cat, double radius, bool symmetric)
 
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

using lsst::afw::table::AmpInfoCatalog = typedef CatalogT<AmpInfoRecord>

Definition at line 97 of file fwd.h.

◆ AmpInfoColumnView

using lsst::afw::table::AmpInfoColumnView = typedef ColumnViewT<AmpInfoRecord>

Definition at line 96 of file fwd.h.

◆ Angle

Definition at line 33 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

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

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

A compile-time list of all field types.

Definition at line 53 of file types.h.

◆ Footprint

Definition at line 57 of file Source.h.

◆ Point2DKey

using lsst::afw::table::Point2DKey = typedef PointKey<double>

Definition at line 118 of file aggregates.h.

◆ Point2IKey

using lsst::afw::table::Point2IKey = typedef PointKey<int>

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 21 of file misc.h.

◆ ReferenceMatch

Definition at line 104 of file fwd.h.

◆ ReferenceMatchVector

Definition at line 108 of file fwd.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 34 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.

◆ 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 52 of file Source.h.

52 {
55};
@ SOURCE_IO_NO_FOOTPRINTS
Do not read/write footprints at all.
Definition: Source.h:53
@ SOURCE_IO_NO_HEAVY_FOOTPRINTS
Read/write heavy footprints as non-heavy footprints.
Definition: Source.h:54

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 913 of file Catalog.h.

913 {
915 catalog.equal_range(value, key);
916 return std::pair<int, int>(p.first - catalog.begin(), p.second - catalog.begin());
917}

◆ _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 894 of file Catalog.h.

894 {
895 typename Catalog::const_iterator iter = catalog.find(value, key);
896 if (iter == catalog.end()) {
898 }
899 return iter; // n.b. CatalogIterator is explicitly convertible to shared_ptr
900}

◆ _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 903 of file Catalog.h.

903 {
904 return catalog.lower_bound(value, key) - catalog.begin();
905}

◆ _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 908 of file Catalog.h.

908 {
909 return catalog.upper_bound(value, key) - catalog.begin();
910}

◆ 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 
)

Definition at line 239 of file Match.cc.

241 {
242 MatchControl mc;
243 mc.symmetricMatch = symmetric;
244
245 return matchRaDec(cat, radius, mc);
246}
Pass parameters to algorithms that match list of sources.
Definition: Match.h:45
bool symmetricMatch
"Produce symmetric matches (default: true):\n" "i.e. if (s1, s2, d) is reported, then so is (s2,...
Definition: Match.h:53
template SourceMatchVector matchRaDec(SourceCatalog const &, lsst::geom::Angle, MatchControl const &)

◆ 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 {
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 using Pos = RecordPos<typename Cat::Record>;
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}
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
std::shared_ptr< RecordT > src
Definition: Match.cc:48
A class representing an angle.
Definition: Angle.h:128
Reports when the result of an operation cannot be represented by the destination type.
Definition: Runtime.h:115
constexpr AngleUnit degrees
constant with units of degrees
Definition: Angle.h:110
T push_back(T... args)
Lightweight representation of a geometric match between two records.
Definition: Match.h:67

◆ 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 
)

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}
bool findOnlyClosest
"Return only the closest match if more than one is found " "(default: true)" ;
Definition: Match.h:50

◆ 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 {
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 using Pos1 = RecordPos<typename Cat1::Record>;
181 using Pos2 = RecordPos<typename Cat2::Record>;
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}
double dec
Definition: Match.cc:41

◆ 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 
)

Definition at line 383 of file Match.cc.

383 {
384 MatchControl mc;
385 mc.symmetricMatch = symmetric;
386
387 return matchXy(cat, radius, mc);
388}
SourceMatchVector matchXy(SourceCatalog const &cat, double radius, bool symmetric)
Definition: Match.cc:383

◆ 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}
double y
Definition: Match.cc:43
double x
Definition: Match.cc:42
typename Base::const_iterator const_iterator
Definition: SortedCatalog.h:50
T isnan(T... args)
std::vector< SourceMatch > SourceMatchVector
Definition: fwd.h:109
Match< SourceRecord, SourceRecord > SourceMatch
Definition: fwd.h:105
T sort(T... args)
T sqrt(T... args)

◆ matchXy() [3/4]

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

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 158 of file BaseRecord.cc.

158 {
159 record._stream(os);
160 return os;
161}
std::ostream * os
Definition: Schema.cc:557

◆ operator<<() [2/2]

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

Definition at line 562 of file Schema.cc.

562 {
563 os << "Schema(\n";
564 schema.forEach(Stream(&os));
565 for (auto const &iter : *schema.getAliasMap()) {
566 os << " '" << iter.first << "'->'" << iter.second << "'\n";
567 }
568 return os << ")\n";
569}
table::Schema schema
Definition: python.h:134

◆ 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 {
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 using Iter = typename std::vector<Match<Record1, Record2>>::const_iterator;
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}
py::object result
Definition: _schema.cc:429
T begin(T... args)
A class used as a handle to a particular field in a table.
Definition: Key.h:53
Defines the fields and offsets for a table.
Definition: Schema.h:51
T end(T... args)
T size(T... args)

◆ 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}
void wrapExposure(lsst::utils::python::WrapperCollection &)
void wrapSchema(WrapperCollection &wrappers)
Definition: _schema.cc:539
void wrapAliasMap(WrapperCollection &)
void wrapArrays(WrapperCollection &wrappers)
Definition: _arrays.cc:101
void wrapSlots(WrapperCollection &wrappers)
Definition: _slots.cc:70
void wrapMatch(WrapperCollection &wrappers)
Definition: _match.cc:89
void wrapAggregates(WrapperCollection &wrappers)
Definition: _aggregates.cc:201
void wrapSource(WrapperCollection &wrappers)
Definition: _source.cc:182
void wrapBaseColumnView(WrapperCollection &wrappers)
void wrapBase(WrapperCollection &wrappers)
Definition: _base.cc:174
void wrapSchemaMapper(WrapperCollection &wrappers)
void wrapSimple(WrapperCollection &wrappers)
Definition: _simple.cc:92
void wrapWcsUtils(WrapperCollection &)
Definition: _wcsUtils.cc:64
void wrapIdFactory(WrapperCollection &)

◆ 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("lsst.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())
464 "Catalogs passed to unpackMatches must be sorted.");
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}
#define LOGLS_WARN(logger, message)
Log a warn-level message using an iostream-based interface.
Definition: Log.h:659
#define LOG_GET(logger)
Returns a Log object associated with logger.
Definition: Log.h:75
#define LOG_LOGGER
Definition: Log.h:714
Iterator class for CatalogT.
Definition: Catalog.h:40
Reports invalid arguments.
Definition: Runtime.h:66

◆ 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 72 of file wcsUtils.cc.

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

◆ 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 95 of file wcsUtils.cc.

95 {
96 if (sourceList.empty()) {
97 return;
98 }
99 auto const schema = getSchema(sourceList[0]);
100 Point2DKey const centroidKey(schema["slot_Centroid"]);
101 CoordKey const coordKey(schema["coord"]);
103 pixelList.reserve(sourceList.size());
104 for (auto const &source : sourceList) {
105 pixelList.emplace_back(getValue(source, centroidKey));
106 }
107 std::vector<lsst::geom::SpherePoint> const skyList = wcs.pixelToSky(pixelList);
108 auto skyCoord = skyList.cbegin();
109 for (auto &source : sourceList) {
110 setValue(source, coordKey, *skyCoord);
111 ++skyCoord;
112 }
113}
const char * source()
Source function that allows astChannel to source from a Stream.
Definition: Stream.h:224

◆ 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() [1/2]

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}
int end
Mapping class that holds aliases for a Schema.
Definition: AliasMap.h:36
py::class_< AliasMap, std::shared_ptr< AliasMap > > PyAliasMap
Definition: _aliasMap.cc:37

◆ wrapAliasMap() [2/2]

void lsst::afw::table::wrapAliasMap ( WrapperCollection &  )

◆ 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() [1/2]

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}
py::class_< IdFactory, std::shared_ptr< IdFactory > > PyIdFactory
Definition: _idFactory.cc:36

◆ wrapIdFactory() [2/2]

void lsst::afw::table::wrapIdFactory ( WrapperCollection &  )

◆ 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}
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...
Definition: Match.cc:305

◆ 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}
py::class_< SchemaMapper, std::shared_ptr< SchemaMapper > > PySchemaMapper

◆ 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 182 of file _source.cc.

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

◆ 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.