lsst.afw g5a732f18d5+66d966b544
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | Properties | List of all members
lsst.afw.table._base.Catalog Class Reference
Inheritance diagram for lsst.afw.table._base.Catalog:

Public Member Functions

 getColumnView (self)
 
 __getitem__ (self, key)
 
 __setitem__ (self, key, value)
 
 __delitem__ (self, key)
 
 append (self, record)
 
 insert (self, key, value)
 
 clear (self)
 
 addNew (self)
 
 cast (self, type_, deep=False)
 
 copy (self, deep=False)
 
 extend (self, iterable, deep=False, mapper=None)
 
 __reduce__ (self)
 
 asAstropy (self, cls=None, copy=False, unviewable="copy")
 
 __dir__ (self)
 
 __getattr__ (self, name)
 
 __str__ (self)
 
 __repr__ (self)
 
 extract (self, *patterns, **kwds)
 

Public Attributes

 table
 

Protected Attributes

 _columns
 

Properties

 columns = property(__getColumns, doc="a column view of the catalog")
 

Detailed Description

Definition at line 73 of file _base.py.

Member Function Documentation

◆ __delitem__()

lsst.afw.table._base.Catalog.__delitem__ ( self,
key )

Definition at line 130 of file _base.py.

◆ __dir__()

lsst.afw.table._base.Catalog.__dir__ ( self)
This custom dir is necessary due to the custom getattr below.
Without it, not all of the methods available are returned with dir.
See DM-7199.

Definition at line 311 of file _base.py.

◆ __getattr__()

lsst.afw.table._base.Catalog.__getattr__ ( self,
name )

Definition at line 331 of file _base.py.

◆ __getitem__()

lsst.afw.table._base.Catalog.__getitem__ ( self,
key )
Return the record at index key if key is an integer,
return a column if `key` is a string field name or Key,
or return a subset of the catalog if key is a slice
or boolean NumPy array.

Definition at line 85 of file _base.py.

◆ __reduce__()

lsst.afw.table._base.Catalog.__reduce__ ( self)

Definition at line 216 of file _base.py.

◆ __repr__()

lsst.afw.table._base.Catalog.__repr__ ( self)

Definition at line 350 of file _base.py.

◆ __setitem__()

lsst.afw.table._base.Catalog.__setitem__ ( self,
key,
value )
If ``key`` is an integer, set ``catalog[key]`` to
``value``. Otherwise select column ``key`` and set it to
``value``.

Definition at line 114 of file _base.py.

◆ __str__()

lsst.afw.table._base.Catalog.__str__ ( self)

Definition at line 343 of file _base.py.

◆ addNew()

lsst.afw.table._base.Catalog.addNew ( self)

Definition at line 149 of file _base.py.

◆ append()

lsst.afw.table._base.Catalog.append ( self,
record )

Definition at line 137 of file _base.py.

◆ asAstropy()

lsst.afw.table._base.Catalog.asAstropy ( self,
cls = None,
copy = False,
unviewable = "copy" )
Return an astropy.table.Table (or subclass thereof) view into this catalog.

Parameters
----------
cls :
    Table subclass to use; `None` implies `astropy.table.Table`
    itself.  Use `astropy.table.QTable` to get Quantity columns.
copy : bool, optional
    If `True`, copy data from the LSST catalog to the astropy
    table.  Not copying is usually faster, but can keep memory
    from being freed if columns are later removed from the
    Astropy view.
unviewable : `str`, optional
    One of the following options (which is ignored if
    copy=`True` ), indicating how to handle field types (`str`
    and `Flag`) for which views cannot be constructed:

    - 'copy' (default): copy only the unviewable fields.
    - 'raise': raise ValueError if unviewable fields are present.
    - 'skip': do not include unviewable fields in the Astropy Table.

Returns
-------
cls : `astropy.table.Table`
    Astropy view into the catalog.

Raises
------
ValueError
    Raised if the `unviewable` option is not a known value, or
    if the option is 'raise' and an uncopyable field is found.

Definition at line 220 of file _base.py.

◆ cast()

lsst.afw.table._base.Catalog.cast ( self,
type_,
deep = False )
Return a copy of the catalog with the given type.

Parameters
----------
type_ :
    Type of catalog to return.
deep : `bool`, optional
    If `True`, clone the table and deep copy all records.

Returns
-------
copy :
    Copy of catalog with the requested type.

Definition at line 153 of file _base.py.

◆ clear()

lsst.afw.table._base.Catalog.clear ( self)

Definition at line 145 of file _base.py.

◆ copy()

lsst.afw.table._base.Catalog.copy ( self,
deep = False )
Copy a catalog (default is not a deep copy).

Definition at line 177 of file _base.py.

◆ extend()

lsst.afw.table._base.Catalog.extend ( self,
iterable,
deep = False,
mapper = None )
Append all records in the given iterable to the catalog.

Parameters
----------
iterable :
    Any Python iterable containing records.
deep : `bool`, optional
    If `True`, the records will be deep-copied; ignored if
    mapper is not `None` (that always implies `True`).
mapper : `lsst.afw.table.schemaMapper.SchemaMapper`, optional
    Used to translate records.

Definition at line 183 of file _base.py.

◆ extract()

lsst.afw.table._base.Catalog.extract ( self,
* patterns,
** kwds )
Extract a dictionary of {<name>: <column-array>} in which the field
names match the given shell-style glob pattern(s).

Any number of glob patterns may be passed (including none); the result
will be the union of all the result of each glob considered separately.

Note that extract("*", copy=True) provides an easy way to transform a
catalog into a set of writeable contiguous NumPy arrays.

This routines unpacks `Flag` columns into full boolean arrays.  String
fields are silently ignored.

Parameters
----------
patterns : Array of `str`
    List of glob patterns to use to select field names.
kwds : `dict`
    Dictionary of additional keyword arguments.  May contain:

    ``items`` : `list`
        The result of a call to self.schema.extract(); this will be
        used instead of doing any new matching, and allows the pattern
        matching to be reused to extract values from multiple records.
        This keyword is incompatible with any position arguments and
        the regex, sub, and ordered keyword arguments.
    ``where`` : array index expression
        Any expression that can be passed as indices to a NumPy array,
        including slices, boolean arrays, and index arrays, that will
        be used to index each column array.  This is applied before
        arrays are copied when copy is True, so if the indexing results
        in an implicit copy no unnecessary second copy is performed.
    ``copy`` : `bool`
        If True, the returned arrays will be contiguous copies rather
        than strided views into the catalog.  This ensures that the
        lifetime of the catalog is not tied to the lifetime of a
        particular catalog, and it also may improve the performance if
        the array is used repeatedly. Default is False.  Copies are
        always made if the catalog is noncontiguous, but if
        ``copy=False`` these set as read-only to ensure code does not
        assume they are views that could modify the original catalog.
    ``regex`` : `str` or `re` pattern
        A regular expression to be used in addition to any glob
        patterns passed as positional arguments.  Note that this will
        be compared with re.match, not re.search.
    ``sub`` : `str`
        A replacement string (see re.MatchObject.expand) used to set
        the dictionary keys of any fields matched by regex.
    ``ordered`` : `bool`
        If True, a collections.OrderedDict will be returned instead of
        a standard dict, with the order corresponding to the definition
        order of the Schema. Default is False.

Returns
-------
d : `dict`
    Dictionary of extracted name-column array sets.

Raises
------
ValueError
    Raised if a list of ``items`` is supplied with additional keywords.

Definition at line 353 of file _base.py.

◆ getColumnView()

lsst.afw.table._base.Catalog.getColumnView ( self)

Definition at line 75 of file _base.py.

◆ insert()

lsst.afw.table._base.Catalog.insert ( self,
key,
value )

Definition at line 141 of file _base.py.

Member Data Documentation

◆ _columns

lsst.afw.table._base.Catalog._columns
protected

Definition at line 76 of file _base.py.

◆ table

lsst.afw.table._base.Catalog.table

Definition at line 328 of file _base.py.

Property Documentation

◆ columns

lsst.afw.table._base.Catalog.columns = property(__getColumns, doc="a column view of the catalog")
static

Definition at line 83 of file _base.py.


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