Schema

class lsst.afw.table.Schema

Bases: pybind11_builtins.pybind11_object

Attributes Summary

EQUAL_ALIASES
EQUAL_DOCS
EQUAL_FIELDS
EQUAL_KEYS
EQUAL_NAMES
EQUAL_UNITS
IDENTICAL
VERSION

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)
getOrderedNames() 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 or Field

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.

unit : 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.

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.

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:
patterns : Array of str

List of glob patterns to use to select field names.

kwargs : dict

Dictionary of additional keyword arguments. May contain:

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, optional

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-schema item sets.

Raises:
ValueError

Raised if the sub keyword argument is invalid without the regex argument.

Also raised if an unknown keyword argument is supplied.

find(self: object, arg0: object) → object
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.

getRecordSize(self: lsst.afw.table.Schema) → int
join(*args, **kwargs)

Overloaded function.

  1. join(self: lsst.afw.table.Schema, a: str, b: str) -> str
  2. join(self: lsst.afw.table.Schema, a: str, b: str, c: str) -> str
  3. join(self: lsst.afw.table.Schema, a: str, b: str, c: str, d: str) -> str
readFits(*args, **kwargs)

Overloaded function.

  1. readFits(filename: str, hdu: int=-2147483648) -> lsst.afw.table.Schema
  2. 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