Mark4Payload

class baseband.mark4.Mark4Payload(words, header=None, *, sample_shape=(1,), bps=2, fanout=1, magnitude_bit=None, complex_data=False)[source] [edit on github]

Bases: PayloadBase

Container for decoding and encoding Mark 4 payloads.

Parameters:
wordsndarray

Array containg LSB unsigned words (with the right size) that encode the payload.

headerMark4Header, optional

If given, used to infer the number of channels, bps, and fanout.

sample_shapetuple

Shape of the samples (e.g., (nchan,)). Default: (1,).

bpsint, optional

Number of bits per sample, used if header is not given. Default: 2.

fanoutint, optional

Number of tracks every bit stream is spread over, used if header is not given. Default: 1.

magnitude_bitint, optional

Magnitude bits for all tracks packed together. Used to index encoder and decoder. Default: assume standard Mark 4 payload, for which number of channels, bps, and fanout suffice.

Notes

The total number of tracks is nchan * bps * fanout.

Attributes Summary

complex_data

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 Summary

fromdata(data, header)

Encode data as payload, using header information.

fromfile(fh[, header])

Read payload from filehandle and decode it into data.

tofile(fh)

Write payload to filehandle.

Attributes Documentation

complex_data
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)[source] [edit on github]

Encode data as payload, using header information.

classmethod fromfile(fh, header=None, **kwargs)[source] [edit on github]

Read payload from filehandle and decode it into data.

Parameters:
fhfilehandle

From which data is read.

headerMark4Header

Used to infer payload_nbytes, bps, sample_shape, and dtype. If not given, those have to be passed in.

tofile(fh) [edit on github]

Write payload to filehandle.