MKBFPayload¶
- class baseband.dada.payload.MKBFPayload(words, *, header=None, **kwargs)[source] [edit on github]¶
Bases:
DADAPayloadContainer for decoding and encoding MKBF DADA payloads.
Subclass of
DADAPayloadthat takes into account that the samples are organized in heaps of 256 samples, with order (nheap, npol, nchan, nsub=256).Some information on the instrument writing it can be found in Van der Byl et al. 2021
Attributes Summary
Full decoded payload.
Numeric type of the decoded data array.
Size of the payload in bytes.
Number of dimensions of the decoded data array.
Shape of the decoded data array.
Total number of component samples in the decoded data array.
Methods Summary
fromdata(data[, header, bps])Encode data as a payload.
fromfile(fh[, header, payload_nbytes, ...])Read payload from filehandle and decode it into data.
tofile(fh)Write payload to filehandle.
Attributes Documentation
- data¶
Full decoded payload.
- dtype¶
Numeric type of the decoded data array.
- nbytes¶
Size of the payload in bytes.
- ndim¶
Number of dimensions of the decoded data array.
- shape¶
Shape of the decoded data array.
- size¶
Total number of component samples in the decoded data array.
Methods Documentation
- classmethod fromdata(data, header=None, bps=2, **kwargs) [edit on github]¶
Encode data as a payload.
- Parameters:
- data
ndarray Data to be encoded, either complex or real. The trailing dimensions are used to infer
sample_shape.- headerheader instance, optional
If given, used to infer to get
bps.- bpsint, optional
Bits per elementary sample, i.e., per channel and per real or imaginary component, used if header is not given. Default: 2.
- **kwargs
Any other arguments to pass on to the class initializer.
- data
- classmethod fromfile(fh, header=None, *, payload_nbytes=None, dtype=None, memmap=None, **kwargs) [edit on github]¶
Read payload from filehandle and decode it into data.
- Parameters:
- fhfilehandle
From which data is read.
- headerheader instance, optional
If given, used to infer
payload_nbytes,bps,sample_shape, andcomplex_data. If not given, those have to be passed in.- payload_nbytesint, optional
Number of bytes to read. Except for fixed-length payloads, required if no
headeris given.- dtype
dtype, optional Type of words to read. Default: taken from class attribute.
- memmapbool, optional
If
False, read from file. Otherwise, map the file in memory (seememmap). Only useful for large payloads. Default: taken from class attribute.- Any other (keyword) arguments are passed on to the class initialiser.
- tofile(fh) [edit on github]¶
Write payload to filehandle.