VLBIHeaderBase¶
-
class
baseband.vlbi_base.header.
VLBIHeaderBase
(words, verify=True)[source] [edit on github]¶ Bases:
object
Base class for all VLBI headers.
Defines a number of common routines.
Generally, the actual class should define:
_struct:
Struct
instance that can pack/unpack header words._header_parser:
HeaderParser
instance corresponding to this class._properties: tuple of properties accessible/usable in initialisation
It also should define properties (getters and setters):
payload_nbytes: number of bytes used by payload
frame_nbytes: total number of bytes for header + payload
- get_time, set_time, and a corresponding time property:
- time at start of payload
Parameters: words : tuple or list of int, or None
header words (generally, 32 bit unsigned int). If
None
, set to a list of zeros for later initialisation. If given as a tuple, the header is immutable.verify : bool
Whether to do basic verification of integrity. For the base class, checks that the number of words is consistent with the struct size.
Attributes Summary
mutable
Whether the header can be modified. nbytes
Size of the header in bytes. Methods Summary
copy
(**kwargs)Create a mutable and independent copy of the header. fromfile
(fh, *args, **kwargs)Read VLBI Header from file. fromkeys
(*args, **kwargs)Initialise a header from parsed values. fromvalues
(*args, **kwargs)Initialise a header from parsed values. keys
()tofile
(fh)Write VLBI frame header to filehandle. update
(**kwargs)Update the header by setting keywords or properties. verify
()Verify that the length of the words is consistent. Attributes Documentation
-
mutable
¶ Whether the header can be modified.
-
nbytes
¶ Size of the header in bytes.
Methods Documentation
-
copy
(**kwargs)[source] [edit on github]¶ Create a mutable and independent copy of the header.
Keyword arguments can be passed on as needed by possible subclasses.
-
classmethod
fromfile
(fh, *args, **kwargs)[source] [edit on github]¶ Read VLBI Header from file.
Arguments are the same as for class initialisation. The header constructed will be immutable.
-
classmethod
fromkeys
(*args, **kwargs)[source] [edit on github]¶ Initialise a header from parsed values.
Like fromvalues, but without any interpretation of keywords.
Raises: KeyError : if not all keys required are present in kwargs
-
classmethod
fromvalues
(*args, **kwargs)[source] [edit on github]¶ Initialise a header from parsed values.
Here, the parsed values must be given as keyword arguments, i.e., for any
header = cls(<words>)
,cls.fromvalues(**header) == header
.However, unlike for the
fromkeys
class method, data can also be set using arguments named after header methods, such astime
.Parameters: *args
Possible arguments required to initialize an empty header.
**kwargs
Values used to initialize header keys or methods.
-
keys
()[source] [edit on github]¶
-
tofile
(fh)[source] [edit on github]¶ Write VLBI frame header to filehandle.
-
update
(**kwargs)[source] [edit on github]¶ Update the header by setting keywords or properties.
Here, any keywords matching header keys are applied first, and any remaining ones are used to set header properties, in the order set by the class (in
_properties
).Parameters: verify : bool, optional
If
True
(default), verify integrity after updating.**kwargs
Arguments used to set keywords and properties.
-
verify
()[source] [edit on github]¶ Verify that the length of the words is consistent.
Subclasses should override this to do more thorough checks.