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_index : int
- Index into the header words for this key.
- bit_index : int
- Index to the starting bit of the part used for this key.
- bit_length : int
- Number of bits.
- default : int 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
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 Summary
clear
()copy
()Make an independent copy. fromkeys
(S[, v])If not specified, the value defaults to None. get
(k[,d])has_key
(k)items
()iteritems
()od.iteritems -> an iterator over the (key, value) pairs in od iterkeys
()itervalues
()od.itervalues -> an iterator over the values in od keys
()pop
(k[,d])value. popitem
()Pairs are returned in LIFO order if last is true or FIFO order if false. setdefault
(k[,d])update
(other)Update the parser with the information from another one. values
()viewitems
()viewkeys
()viewvalues
()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
() → None. Remove all items from od. [edit on github]¶
-
copy
()[source] [edit on github]¶ Make an independent copy.
-
classmethod
fromkeys
(S[, v]) → New ordered dictionary with keys from S. [edit on github]¶ If not specified, the value defaults to None.
-
get
(k[, d]) → D[k] if k in D, else d. d defaults to None.¶
-
has_key
(k) → True if D has a key k, else False¶
-
items
() → list of (key, value) pairs in od [edit on github]¶
-
iteritems
() [edit on github]¶ od.iteritems -> an iterator over the (key, value) pairs in od
-
iterkeys
() → an iterator over the keys in od [edit on github]¶
-
itervalues
() [edit on github]¶ od.itervalues -> an iterator over the values in od
-
keys
() → list of keys in od [edit on github]¶
-
pop
(k[, d]) → v, remove specified key and return the corresponding [edit on github]¶ value. If key is not found, d is returned if given, otherwise KeyError is raised.
-
popitem
() → (k, v), return and remove a (key, value) pair. [edit on github]¶ Pairs are returned in LIFO order if last is true or FIFO order if false.
-
setdefault
(k[, d]) → od.get(k,d), also set od[k]=d if k not in od [edit on github]¶
-
update
(other)[source] [edit on github]¶ Update the parser with the information from another one.
-
values
() → list of values in od [edit on github]¶
-
viewitems
() → a set-like object providing a view on od's items [edit on github]¶
-
viewkeys
() → a set-like object providing a view on od's keys [edit on github]¶
-
viewvalues
() → an object providing a view on od's values [edit on github]¶