26from ._base
import Catalog
27from ._table
import QuadrupoleKey, SourceCatalog, SourceColumnView, SourceRecord, SourceTable
29Catalog.register(
"Source", SourceCatalog)
36 """Return the subset of self for which the parent field equals the
39 In order for this method to return the correct result, it must be
40 sorted by parent (i.e. self.isSorted(SourceTable.getParentKey()) must
41 be True). This is naturally the case with SourceCatalogs produced by
42 the detection and deblending tasks, but it may not be true when
43 concatenating multiple such catalogs.
45 Additional Catalogs or sequences whose elements correspond in order to
46 the records of self (i.e. ``zip(self, *args)`` is valid) will be
47 subset using the same slice object used on self, and these subsets
48 will be returned along with the subset of self.
52 parent : `int` or `iterable` of `int`
53 ID(s) of the parent(s) to get children for.
54 args : `~lsst.afw.table.Catalog`
55 Additional catalogs to subset for the children to return.
59 children : a single iterable of `~lsst.afw.table.SourceRecord`
60 Children sources if ``parent`` is of type `int`, or a generator
61 yielding a `~lsst.afw.table.SourceRecord`s Children sources for
62 each parent if ``parent`` is an `iterable`.
67 Raised if the catalog is not sorted by the parent key.
71 Each call to this function checks if the catalog is sorted, which is
72 of O(n) complexity, while fetching the children is of O(log n). To
73 minimize the computational overhead, it is preferable to prepare an
74 iterable of parent ids for which the children need to be fetched and
75 pass the iterable as ``parent``.
77 if not self.isSorted(SourceTable.getParentKey()):
79 "The table is not sorted by parent, so cannot getChildren")
82 """Return the subset of self for which the parent field equals the
85 This function works as desired only if `self` is sorted by the
86 parent key, but does not check if it is sorted. This function must
87 be used only after ensuring outside of the function that
88 self.isSorted(SourceTable.getParentKey() evaluates to True.
93 ID of the parent to get children for.
97 children : iterable of `~lsst.afw.table.SourceRecord`
100 s = self.equal_range(parent, SourceTable.getParentKey())
102 return (self[s],) + tuple(arg[s]
for arg
in args)
119 return QuadrupoleKey(self.schema[
"slot_PsfShape"]).get(self)
121 raise LogicError(
"Key is not valid (if this is a SourceRecord, make sure slot aliases have been "
128 return self[
"slot_PsfShape_" + suffix]
130 raise LogicError(
"Key is not valid (if this is a SourceRecord, make sure slot aliases have been "
153 return self[
"slot_PsfShape_" + suffix]
155 raise LogicError(
"Key is not valid (if this is a SourceCatalog, make sure slot aliases have been "
172 self.schema.getAliasMap().
set(
"slot_PsfShape", name)
getChildren(self, parent, *args)
_getPsfShapeComponent(self, suffix)
_getPsfShapeComponent(self, suffix)
definePsfShape(self, name)
Tag types used to declare specialized field types.
daf::base::PropertySet * set