|
def | getColumnView (self) |
|
def | __getitem__ (self, key) |
|
def | __setitem__ (self, key, value) |
|
def | __delitem__ (self, key) |
|
def | append (self, record) |
|
def | insert (self, key, value) |
|
def | clear (self) |
|
def | addNew (self) |
|
def | cast (self, type_, deep=False) |
|
def | copy (self, deep=False) |
|
def | extend (self, iterable, deep=False, mapper=None) |
|
def | __reduce__ (self) |
|
def | asAstropy (self, cls=None, copy=False, unviewable="copy") |
|
def | __dir__ (self) |
|
def | __getattr__ (self, name) |
|
def | __str__ (self) |
|
def | __repr__ (self) |
|
def | extract (self, *patterns, **kwds) |
|
|
| columns = property(__getColumns, doc="a column view of the catalog") |
|
Definition at line 73 of file _base.py.
◆ __delitem__()
def lsst.afw.table._base.Catalog.__delitem__ |
( |
|
self, |
|
|
|
key |
|
) |
| |
◆ __dir__()
def 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__()
def lsst.afw.table._base.Catalog.__getattr__ |
( |
|
self, |
|
|
|
name |
|
) |
| |
◆ __getitem__()
def 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__()
def lsst.afw.table._base.Catalog.__reduce__ |
( |
|
self | ) |
|
◆ __repr__()
def lsst.afw.table._base.Catalog.__repr__ |
( |
|
self | ) |
|
◆ __setitem__()
def 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__()
def lsst.afw.table._base.Catalog.__str__ |
( |
|
self | ) |
|
◆ addNew()
def lsst.afw.table._base.Catalog.addNew |
( |
|
self | ) |
|
◆ append()
def lsst.afw.table._base.Catalog.append |
( |
|
self, |
|
|
|
record |
|
) |
| |
◆ asAstropy()
def 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()
def 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()
def lsst.afw.table._base.Catalog.clear |
( |
|
self | ) |
|
◆ copy()
def 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()
def 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()
def 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()
def lsst.afw.table._base.Catalog.getColumnView |
( |
|
self | ) |
|
◆ insert()
def lsst.afw.table._base.Catalog.insert |
( |
|
self, |
|
|
|
key, |
|
|
|
value |
|
) |
| |
◆ columns
lsst.afw.table._base.Catalog.columns = property(__getColumns, doc="a column view of the catalog") |
|
static |
The documentation for this class was generated from the following file: