HeaderParser¶
-
class
baseband.vlbi_base.header.
HeaderParser
(*args, **kwargs)[source] [edit on github]¶ Bases:
collections.OrderedDict
Parser & setter for VLBI header keywords.
An ordered dict of header keywords, with values that describe how they are encoded in a given VLBI header. Initialisation is as a normal OrderedDict, with a key, value pairs. The value should be 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
, anddefaults
, 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).Note that while in principle, parsers and setters could be calculated on the fly, we precalculate the parsers to speed up header keyword access.
Attributes Summary
Dict-like allowing access to default header values.
Dict with functions to get specific header values.
Dict-like returning function to set specific header value.
Methods Summary
clear
()copy
(self)Make an independent copy.
fromkeys
(iterable[, value])Create a new ordered dictionary with keys from iterable and values set to value.
get
(self, key[, default])Return the value for key if key is in the dictionary, else default.
items
()keys
()move_to_end
(self, /, key[, last])Move an existing element to the end (or beginning if last is false).
pop
()value.
popitem
(self, /[, last])Remove and return a (key, value) pair from the dictionary.
setdefault
(self, /, key[, default])Insert key with a value of default if key is not in the dictionary.
update
(self, other)Update the parser with the information from another one.
values
()Attributes Documentation
-
defaults
¶ Dict-like allowing access to default header values.
-
parsers
¶ Dict with functions to get specific header values.
-
setters
¶ Dict-like returning function to set specific header value.
Methods Documentation
-
clear
()¶
-
copy
(self)[source] [edit on github]¶ Make an independent copy.
-
fromkeys
(iterable, value=None)¶ Create a new ordered dictionary with keys from iterable and values set to value.
-
get
(self, key, default=None, /)¶ Return the value for key if key is in the dictionary, else default.
-
items
()¶
-
keys
()¶
-
move_to_end
(self, /, key, last=True)¶ Move an existing element to the end (or beginning if last is false).
Raise KeyError if the element does not exist.
-
pop
()¶ value. If key is not found, d is returned if given, otherwise KeyError is raised.
-
popitem
(self, /, last=True)¶ Remove and return a (key, value) pair from the dictionary.
Pairs are returned in LIFO order if last is true or FIFO order if false.
-
setdefault
(self, /, 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
(self, other)[source] [edit on github]¶ Update the parser with the information from another one.
-
values
()¶