GUPPIPayload¶
-
class
baseband.guppi.payload.
GUPPIPayload
(words, header=None, sample_shape=(), bps=8, complex_data=False, channels_first=True)[source] [edit on github]¶ Bases:
baseband.vlbi_base.payload.VLBIPayloadBase
Container for decoding and encoding GUPPI payloads.
Parameters: words :
ndarray
Array containg LSB unsigned words (with the right size) that encode the payload.
header :
GUPPIHeader
Header that provides information about how the payload is encoded. If not given, the following arguments have to be passed in.
bps : int, optional
Number of bits per sample part (i.e., per channel and per real or imaginary component). Default: 8.
sample_shape : tuple, optional
Shape of the samples; e.g., (nchan,). Default: ().
complex_data : bool, optional
Whether data are complex. Default:
False
.channels_first : bool, optional
Whether the encoded payload is stored as (nchan, nsample, npol), rather than (nsample, nchan, npol). Default:
True
.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, channels_first])Encode data as a payload. fromfile
(fh[, header, memmap, payload_nbytes])Read or map encoded data in file. 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=8, channels_first=True)[source] [edit on github]¶ Encode data as a payload.
Parameters: data :
ndarray
Data to be encoded. The last dimension is taken as the number of channels.
header :
GUPPIHeader
, optionalIf given, used to infer the
bps
andchannels_first
.bps : int, optional
Bits per elementary sample, used if
header
isNone
. Default: 8.channels_first : bool, optional
-
classmethod
fromfile
(fh, header=None, memmap=False, payload_nbytes=None, **kwargs)[source] [edit on github]¶ Read or map encoded data in file.
Parameters: fh : filehandle
Handle to the file which will be read or mapped.
header :
GUPPIHeader
, optionalIf given, used to infer
payload_nbytes
,bps
,sample_shape
,complex_data
andchannels_first
. If not given, those have to be passed in.memmap : bool, optional
payload_nbytes : int, optional
Number of bytes to read (default: as given in
header
,cls._nbytes
, or, for mapping, to the end of the file).**kwargs
Additional arguments are passed on to the class initializer. These are only needed if
header
is not given.
-
tofile
(fh) [edit on github]¶ Write payload to filehandle.
-