VLBIFrameBase¶
-
class
baseband.vlbi_base.frame.
VLBIFrameBase
(header, payload, valid=True, verify=True)[source] [edit on github]¶ Bases:
object
Representation of a VLBI data frame, consisting of a header and payload.
- Parameters
- header
baseband.vlbi_base.header.VLBIHeaderBase
Wrapper around the encoded header words, providing access to the header information.
- payload
VLBIPayloadBase
Wrapper around the payload, provding mechanisms to decode it.
- validbool
Whether the data are valid. Default:
True
.- verifybool
Whether to do basic verification of integrity. Default:
True
.
- header
Notes
The Frame can also be instantiated using class methods:
fromfile : read header and payload from a filehandle
fromdata : encode data as payload
Of course, one can also do the opposite:
tofile : method to write header and payload to filehandle
data : property that yields full decoded payload
One can decode part of the payload by indexing or slicing the frame. If the frame does not contain valid data, all values returned are set to
self.fill_value
.A number of properties are defined:
shape
anddtype
are the shape and type of the data array, andnbytes
the frame size in bytes. Furthermore, the frame acts as a dictionary, with keys those of the header. Any attribute that is not defined on the frame itself, such as.time
will be looked up on the header as well.Attributes Summary
Full decoded frame.
Numeric type of the frame data.
Value to replace invalid data in the frame.
Size of the encoded frame in bytes.
Number of dimensions of the frame data.
Shape of a sample in the frame (nchan,).
Shape of the frame data.
Total number of component samples in the frame data.
Whether frame contains valid data.
Methods Summary
fromdata
(data, header, \*args[, valid, verify])Construct frame from data and header.
fromfile
(fh, \*args[, valid, verify])Read a frame from a filehandle.
keys
(self)tofile
(self, fh)Write encoded frame to filehandle.
verify
(self)Simple verification.
Attributes Documentation
-
data
¶ Full decoded frame.
-
dtype
¶ Numeric type of the frame data.
-
fill_value
¶ Value to replace invalid data in the frame.
-
nbytes
¶ Size of the encoded frame in bytes.
-
ndim
¶ Number of dimensions of the frame data.
-
sample_shape
¶ Shape of a sample in the frame (nchan,).
-
shape
¶ Shape of the frame data.
-
size
¶ Total number of component samples in the frame data.
-
valid
¶ Whether frame contains valid data.
Methods Documentation
-
classmethod
fromdata
(data, header, *args, valid=True, verify=True, **kwargs)[source] [edit on github]¶ Construct frame from data and header.
- Parameters
- data
ndarray
Array holding data to be encoded.
- header
VLBIHeaderBase
Header for the frame.
- *args, **kwargs :
Any arguments beyond the filehandle are used to help initialize the payload, except for
valid
andverify
, which are passed on to the header and class initializers.- validbool, optional
Whether this payload contains valid data.
- verifybool, optional
Whether to verify the header and frame correctness.
- data
-
classmethod
fromfile
(fh, *args, valid=True, verify=True, **kwargs)[source] [edit on github]¶ Read a frame from a filehandle.
-
keys
(self)[source] [edit on github]¶
-
tofile
(self, fh)[source] [edit on github]¶ Write encoded frame to filehandle.
-
verify
(self)[source] [edit on github]¶ Simple verification. To be added to by subclasses.