Definition at line 33 of file baseContinued.py.
◆ __repr__()
def lsst.afw.table.base.baseContinued.BaseRecord.__repr__ |
( |
|
self | ) |
|
◆ extract()
def lsst.afw.table.base.baseContinued.BaseRecord.extract |
( |
|
self, |
|
|
|
patterns, |
|
|
|
kwds |
|
) |
| |
Extract a dictionary of {<name>: <field-value>} in which the field names
match the given shell-style glob pattern(s).
Any number of glob patterns may be passed; the result will be the union of all
the result of each glob considered separately.
Parameters
----------
items : `dict`
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.
split : `bool`
If True, fields with named subfields (e.g. points) will be split
into separate items in the dict; instead of {"point":
lsst.geom.Point2I(2,3)}, for instance, you'd get {"point.x":
2, "point.y": 3}. Default is False.
regex : `str` or `re` pattern object
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`.
Definition at line 35 of file baseContinued.py.
35 def extract(self, *patterns, **kwds):
36 """Extract a dictionary of {<name>: <field-value>} in which the field names 37 match the given shell-style glob pattern(s). 39 Any number of glob patterns may be passed; the result will be the union of all 40 the result of each glob considered separately. 46 The result of a call to self.schema.extract(); this will be used 47 instead of doing any new matching, and allows the pattern matching 48 to be reused to extract values from multiple records. This 49 keyword is incompatible with any position arguments and the regex, 50 sub, and ordered keyword arguments. 53 If True, fields with named subfields (e.g. points) will be split 54 into separate items in the dict; instead of {"point": 55 lsst.geom.Point2I(2,3)}, for instance, you'd get {"point.x": 56 2, "point.y": 3}. Default is False. 58 regex : `str` or `re` pattern object 59 A regular expression to be used in addition to any glob patterns 60 passed as positional arguments. Note that this will be compared 61 with re.match, not re.search. 64 A replacement string (see `re.MatchObject.expand`) used to set the 65 dictionary keys of any fields matched by regex. 68 If `True`, a `collections.OrderedDict` will be returned instead of 69 a standard dict, with the order corresponding to the definition 70 order of the `Schema`. `Default is False`. 72 d = kwds.pop(
"items",
None)
73 split = kwds.pop(
"split",
False)
75 d = self.schema.extract(*patterns, **kwds).copy()
78 "Unrecognized keyword arguments for extract: %s" %
", ".join(kwds.keys()))
80 for name, schemaItem
in list(d.items()):
82 if split
and key.HAS_NAMED_SUBFIELDS:
83 for subname, subkey
in zip(key.subfields, key.subkeys):
84 d[
"%s.%s" % (name, subname)] = self.get(subkey)
87 d[name] = self.get(schemaItem.key)
daf::base::PropertyList * list
The documentation for this class was generated from the following file:
- /j/snowflake/release/lsstsw/stack/Linux64/afw/18.1.0/python/lsst/afw/table/base/baseContinued.py