GSBPayload

class baseband.gsb.payload.GSBPayload(words, *, header=None, sample_shape=(), bps=2, complex_data=False)[source] [edit on github]

Bases: PayloadBase

Container for decoding and encoding GSB payloads.

Parameters:
wordsndarray

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

sample_shapetuple, optional

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

bpsint, optional

Bits per elementary sample. Default: 2.

complex_databool, optional

Whether data are complex. Default: False.

Attributes Summary

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, bps])

Encode data as a payload.

fromfile(fh, *[, payload_nbytes, ...])

Read payloads from several threads.

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

Encode data as a payload.

Parameters:
datandarray

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.

classmethod fromfile(fh, *, payload_nbytes=4194304, sample_shape=(1,), bps=4, complex_data=False)[source] [edit on github]

Read payloads from several threads.

Parameters:
fhfilehandle or tuple of tuple of filehandle

Handles to the sets of files from which data are read. The outer tuple holds distinct threads, while the inner ones holds parts of those threads. Typically, these are the two polarisations and the two parts of each in which phased baseband data are stored.

payload_nbytesint, optional

Number of bytes to read from each part. Default: 2**22 (4 MB)

sample_shapetuple

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

bpsint, optional

Bits per elementary sample. Default: 4.

complex_databool, optional

Whether data are complex. Default: False.

tofile(fh)[source] [edit on github]

Write payload to filehandle.