26from deprecated.sphinx
import deprecated
29from ._table
import KeyFlag, _BaseColumnViewBase
40 """Get the bits associated with the specified keys.
45 Key to retrieve. Unlike the C++ version, each key may be a
46 field name or a key, and if keys is `None` then all bits
52 Integer array of the requested bitmask.
55 return self.getAllBits()
59 arg.append(self.schema.find(k).key)
62 return self._getBits(arg)
64 def __getitem__(self, key):
65 """Get a column view; key may be a key object or the name of a field.
68 keyobj = self.schema.find(key).key
71 return self._basicget(keyobj)
75 def __setitem__(self, key, value):
76 """Set a full column to an array or scalar; key may be a key object or
79 self.
get(key)[:] = value
86 "Catalog.__getitem__ now provides better support for "
87 "accessing Flag/bool columns. Will be removed after v26."
90 category=FutureWarning,
93 """Get the value of a flag column as a boolean array; key must be a
94 key object or the name of a field.
98 key : `lsst.afw.table.KeyFlag`
99 Flag column to search for.
103 value : `list` of `bool`
104 Array of booleans corresponding to the flag.
109 Raised if the key is not a KeyFlag.
113 raise TypeError(
"key={} not an lsst.afw.table.KeyFlag".format(key))
116 """Extract a dictionary of {<name>: <column-array>} in which the field
117 names match the given shell-style glob pattern(s).
119 Any number of glob patterns may be passed (including none); the result
120 will be the union of all the result of each glob considered separately.
122 Note that extract("*", copy=True) provides an easy way to transform a
123 row-major ColumnView into a possibly more efficient set of contiguous
126 String fields are silently ignored. Support for `Flag` columns is
127 deprecated; at present they are copied into full boolean arrays, but
128 after v26 they will be silently ignored as well.
132 patterns : Array of `str`
133 List of glob patterns to use to select field names.
135 Dictionary of additional keyword arguments. May contain:
138 The result of a call to self.schema.extract(); this will be
139 used instead of doing any new matching, and allows the pattern
140 matching to be reused to extract values from multiple records.
141 This keyword is incompatible with any position arguments and
142 the regex, sub, and ordered keyword arguments.
143 ``where`` : array index expression
144 Any expression that can be passed as indices to a NumPy array,
145 including slices, boolean arrays, and index arrays, that will
146 be used to index each column array. This is applied before
147 arrays are copied when copy is True, so if the indexing results
148 in an implicit copy no unnecessary second copy is performed.
150 If True, the returned arrays will be contiguous copies rather
151 than strided views into the catalog. This ensures that the
152 lifetime of the catalog is not tied to the lifetime of a
153 particular catalog, and it also may improve the performance if
154 the array is used repeatedly. Default is False.
155 ``regex`` : `str` or `re` pattern
156 A regular expression to be used in addition to any glob
157 patterns passed as positional arguments. Note that this will
158 be compared with re.match, not re.search.
160 A replacement string (see re.MatchObject.expand) used to set
161 the dictionary keys of any fields matched by regex.
163 If True, a collections.OrderedDict will be returned instead of
164 a standard dict, with the order corresponding to the definition
165 order of the Schema. Default is False.
170 Dictionary of extracted name-column array sets.
175 Raised if a list of ``items`` is supplied with additional keywords.
179 copy = kwds.pop(
"copy",
False)
180 where = kwds.pop(
"where",
None)
181 d = kwds.pop(
"items",
None)
186 d = self.schema.
extract(*patterns, **kwds).copy()
189 "kwd 'items' was specified, which is not compatible with additional keywords")
192 if where
is not None:
195 a = np.ascontiguousarray(a)
199 for name, schemaItem
in list(d.items()):
201 if key.getTypeString() ==
"String":
get_bool_array(self, key)
extract(self, *patterns, **kwds)
Tag types used to declare specialized field types.
daf::base::PropertyList * list