lsst.afw  20.0.0-4-gde602ef96+1
Public Member Functions | Public Attributes | List of all members
lsst.afw.table.multiMatch.GroupView Class Reference
Inheritance diagram for lsst.afw.table.multiMatch.GroupView:

Public Member Functions

def build (cls, catalog, groupField="object")
 
def __init__ (self, schema, ids, groups)
 
def __len__ (self)
 
def __iter__ (self)
 
def __getitem__ (self, key)
 
def where (self, predicate)
 
def aggregate (self, function, field=None, dtype=float)
 
def apply (self, function, field=None, dtype=float)
 

Public Attributes

 schema
 
 ids
 
 groups
 
 count
 

Detailed Description

A mapping (i.e. dict-like object) that provides convenient
operations on the concatenated catalogs returned by a MultiMatch
object.

A GroupView provides access to a catalog of grouped objects, in
which the grouping is indicated by a field for which all records
in a group have the same value.  Once constructed, it allows
operations similar to those supported by SQL "GROUP BY", such as
filtering and aggregate calculation.

Parameters
----------
schema : `lsst.afw.table.Schema`
    Catalog schema to use for the grouped object catalog.
ids : `List`
    List of identifying keys for the groups in the catalog.
groups : `List`
    List of catalog subsets associated with each key in ids.

Definition at line 202 of file multiMatch.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.afw.table.multiMatch.GroupView.__init__ (   self,
  schema,
  ids,
  groups 
)

Definition at line 251 of file multiMatch.py.

Member Function Documentation

◆ __getitem__()

def lsst.afw.table.multiMatch.GroupView.__getitem__ (   self,
  key 
)

Definition at line 263 of file multiMatch.py.

◆ __iter__()

def lsst.afw.table.multiMatch.GroupView.__iter__ (   self)

Definition at line 260 of file multiMatch.py.

◆ __len__()

def lsst.afw.table.multiMatch.GroupView.__len__ (   self)

Definition at line 257 of file multiMatch.py.

◆ aggregate()

def lsst.afw.table.multiMatch.GroupView.aggregate (   self,
  function,
  field = None,
  dtype = float 
)
Run an aggregate function on each group, returning an array with
one element for each group.

Parameters
----------
function :
    Callable object that computes the aggregate value.  If
    `field` is None, called with the entire subset catalog as an
    argument.  If `field` is not None, called with an array view
    into that field.
field : `str`, optional
    A string name or Key object that indicates a single field the aggregate
    is computed over.
dtype :
    Data type of the output array.

Returns
-------
result : Array of `dtype`
    Aggregated values for each group.

Definition at line 293 of file multiMatch.py.

◆ apply()

def lsst.afw.table.multiMatch.GroupView.apply (   self,
  function,
  field = None,
  dtype = float 
)
Run a non-aggregate function on each group, returning an array with
one element for each record.

Parameters
----------
function :
    Callable object that computes the aggregate value.  If field is None,
    called with the entire subset catalog as an argument.  If field is not
    None, called with an array view into that field.
field : `str`
    A string name or Key object that indicates a single field the aggregate
    is computed over.
dtype :
    Data type for the output array.

Returns
-------
result : `numpy.array` of `dtype`
    Result of the function calculated on an element-by-element basis.

Definition at line 327 of file multiMatch.py.

◆ build()

def lsst.afw.table.multiMatch.GroupView.build (   cls,
  catalog,
  groupField = "object" 
)
Construct a GroupView from a concatenated catalog.

Parameters
----------
catalog : `lsst.afw.table.base.Catalog`
    Input catalog, containing records grouped by a field in
    which all records in the same group have the same value.
    Must be sorted by the group field.
groupField : `str`, optional
    Name or Key for the field that indicates groups.  Defaults
    to "object".

Returns
-------
groupCatalog : `lsst.afw.table.multiMatch.GroupView`
    Constructed GroupView from the input concatenated catalog.

Definition at line 224 of file multiMatch.py.

◆ where()

def lsst.afw.table.multiMatch.GroupView.where (   self,
  predicate 
)
Return a new GroupView that contains only groups for which the
given predicate function returns True.

The predicate function is called once for each group, and
passed a single argument: the subset catalog for that group.

Parameters
----------
predicate :
    Function to identify which groups should be included in
    the output.

Returns
-------
outGroupView : `lsst.afw.table.multiMatch.GroupView`
    Subset GroupView containing only groups that match the
    predicate.

Definition at line 269 of file multiMatch.py.

Member Data Documentation

◆ count

lsst.afw.table.multiMatch.GroupView.count

Definition at line 255 of file multiMatch.py.

◆ groups

lsst.afw.table.multiMatch.GroupView.groups

Definition at line 254 of file multiMatch.py.

◆ ids

lsst.afw.table.multiMatch.GroupView.ids

Definition at line 253 of file multiMatch.py.

◆ schema

lsst.afw.table.multiMatch.GroupView.schema

Definition at line 252 of file multiMatch.py.


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