HeaderParser

class baseband.base.header.HeaderParser[source] [edit on github]

Bases: HeaderParserBase

Parser & setter for VLBI header keywords.

A dictionary of header keywords, with values that describe how they are encoded in a given VLBI header. Initialisation is as a normal dict, with (ordered) key, value pairs, with each value a tuple containing:

word_indexint

Index into the header words for this key.

bit_indexint

Index to the starting bit of the part used for this key.

bit_lengthint

Number of bits.

defaultint or bool or None

Possible default value to use in initialisation (e.g., a sync pattern).

The class provides dict-like properties parsers, setters, and defaults, which return functions that get a given keyword from header words, set the corresponding part of the header words to a value, or return the default value (if defined). To speed up access to those, they are precalculated on first access rather than calculated on the fly.

Attributes Summary

defaults

Lazily evaluated dict of defaults

parsers

Lazily evaluated dict of parsers

setters

Lazily evaluated dict of setters

Methods Summary

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised

popitem()

2-tuple; but raise KeyError if D is empty.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Attributes Documentation

defaults

Lazily evaluated dict of defaults

parsers

Lazily evaluated dict of parsers

setters

Lazily evaluated dict of setters

Methods Documentation

clear() None.  Remove all items from D.
copy() a shallow copy of D [edit on github]
fromkeys(iterable, value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem() (k, v), remove and return some (key, value) pair as a

2-tuple; but raise KeyError if D is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() an object providing a view on D's values