lsst.afw g093c4c12c6+d82a7d5dd9
Loading...
Searching...
No Matches
Public Member Functions | List of all members
lsst.afw.table._source.SourceCatalog Class Reference

Public Member Functions

def getChildren (self, parent, *args)
 

Detailed Description

Definition at line 33 of file _source.py.

Member Function Documentation

◆ getChildren()

def lsst.afw.table._source.SourceCatalog.getChildren (   self,
  parent,
args 
)
Return the subset of self for which the parent field equals the
given value.

In order for this method to return the correct result, it must be
sorted by parent (i.e. self.isSorted(SourceTable.getParentKey()) must
be True).  This is naturally the case with SourceCatalogs produced by
the detection and deblending tasks, but it may not be true when
concatenating multiple such catalogs.

Additional Catalogs or sequences whose elements correspond in order to
the records of self (i.e. ``zip(self, *args)`` is valid) will be
subset using the same slice object used on self, and these subsets
will be returned along with the subset of self.

Parameters
----------
parent : `int` or `iterable` of `int`
    ID(s) of the parent(s) to get children for.
args : `~lsst.afw.table.Catalog`
    Additional catalogs to subset for the children to return.

Returns
-------
children : a single iterable of `~lsst.afw.table.SourceRecord`
    Children sources if ``parent`` is of type `int`, or a generator
    yielding a `~lsst.afw.table.SourceRecord`s Children sources for
    each parent if ``parent`` is an `iterable`.

Raises
------
AssertionError
    Raised if the catalog is not sorted by the parent key.

Notes
-----
Each call to this function checks if the catalog is sorted, which is
of O(n) complexity, while fetching the children is of O(log n). To
minimize the computational overhead, it is preferable to prepare an
iterable of parent ids for which the children need to be fetched and
pass the iterable as ``parent``.

Definition at line 35 of file _source.py.


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