Schema¶
- class lsst.afw.table.Schema¶
Bases:
pybind11_object
Attributes Summary
Methods Summary
addField
(field[, type, doc, units, size, ...])Add a field to the Schema.
checkUnits
([parse_strict])Check that all units in the Schema are valid Astropy unit strings.
compare
(self, other[, flags])contains
(self, other[, flags])disconnectAliases
(self)extract
(*patterns, **kwargs)Extract a dictionary of {<name>: <schema-item>} in which the field names match the given shell-style glob pattern(s).
find
(self, arg0)forEach
(self, arg0)getAliasMap
(self)getFieldCount
(self)getFlagFieldCount
(self)getNames
(self[, topOnly])getNonFlagFieldCount
(self)Return a list of field names in the order the fields were added to the Schema.
getRecordSize
(self)join
(*args, **kwargs)Overloaded function.
readFits
(*args, **kwargs)Overloaded function.
setAliasMap
(self, aliases)Attributes Documentation
- EQUAL_ALIASES = 16¶
- EQUAL_DOCS = 4¶
- EQUAL_FIELDS = 15¶
- EQUAL_KEYS = 1¶
- EQUAL_NAMES = 2¶
- EQUAL_UNITS = 8¶
- IDENTICAL = 31¶
- VERSION = 3¶
Methods Documentation
- addField(field, type=None, doc='', units='', size=None, doReplace=False, parse_strict='raise')¶
Add a field to the Schema.
- Parameters:
- field
str
orField
The string name of the Field, or a fully-constructed Field object. If the latter, all other arguments besides doReplace are ignored.
- type
str
, optional The type of field to create. Valid types are the keys of the afw.table.Field dictionary.
- doc
str
Documentation for the field.
- units
str
Units for the field, or an empty string if unitless.
- size
int
Size of the field; valid for string and array fields only.
- doReplace
bool
If a field with this name already exists, replace it instead of raising pex.exceptions.InvalidParameterError.
- parse_strict
str
One of ‘raise’ (default), ‘warn’, or ‘strict’, indicating how to handle unrecognized unit strings. See also astropy.units.Unit.
- field
- Returns:
- result
Result of the
Field
addition.
- checkUnits(parse_strict='raise')¶
Check that all units in the Schema are valid Astropy unit strings.
- Parameters:
- parse_strict
str
, optional One of ‘raise’ (default), ‘warn’, or ‘strict’, indicating how to handle unrecognized unit strings. See also astropy.units.Unit.
- parse_strict
- compare(self: lsst.afw.table.Schema, other: lsst.afw.table.Schema, flags: int = 1) int ¶
- contains(self: lsst.afw.table.Schema, other: lsst.afw.table.Schema, flags: int = 1) int ¶
- disconnectAliases(self: lsst.afw.table.Schema) None ¶
- extract(*patterns, **kwargs)¶
Extract a dictionary of {<name>: <schema-item>} 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:
- patternsArray of
str
List of glob patterns to use to select field names.
- kwargs
dict
Dictionary of additional keyword arguments. May contain:
regex
str
orre
patternA 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
, optionalIf 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.
- patternsArray of
- Returns:
- d
dict
Dictionary of extracted name-schema item sets.
- d
- Raises:
- ValueError
Raised if the
sub
keyword argument is invalid without theregex
argument.Also raised if an unknown keyword argument is supplied.
- forEach(self: lsst.afw.table.Schema, arg0: object) None ¶
- getAliasMap(self: lsst.afw.table.Schema) lsst.afw.table.AliasMap ¶
- getFieldCount(self: lsst.afw.table.Schema) int ¶
- getFlagFieldCount(self: lsst.afw.table.Schema) int ¶
- getNames(self: lsst.afw.table.Schema, topOnly: bool = False) Set[str] ¶
- getNonFlagFieldCount(self: lsst.afw.table.Schema) int ¶
- getOrderedNames()¶
Return a list of field names in the order the fields were added to the Schema.
- Returns:
- names
List
Field names in order they were added to the Schema.
- names
- getRecordSize(self: lsst.afw.table.Schema) int ¶
- join(*args, **kwargs)¶
Overloaded function.
join(self: lsst.afw.table.Schema, a: str, b: str) -> str
join(self: lsst.afw.table.Schema, a: str, b: str, c: str) -> str
join(self: lsst.afw.table.Schema, a: str, b: str, c: str, d: str) -> str
- static readFits(*args, **kwargs)¶
Overloaded function.
readFits(filename: str, hdu: int = -2147483648) -> lsst.afw.table.Schema
readFits(manager: lsst.afw.fits._fits.MemFileManager, hdu: int = -2147483648) -> lsst.afw.table.Schema
- setAliasMap(self: lsst.afw.table.Schema, aliases: lsst.afw.table.AliasMap) None ¶