GSBFileReader

class baseband.gsb.base.GSBFileReader(fh_raw, payload_nbytes, nchan=1, bps=4, complex_data=False)[source] [edit on github]

Bases: baseband.vlbi_base.base.VLBIFileBase

Simple reader for GSB data files.

Wraps a binary filehandle, providing a read_payload method to help interpret the data.

Parameters:

payload_nbytes : int

Number of bytes to read.

nchan : int, optional

Number of channels. Default: 1.

bps : int, optional

Bits per elementary sample, i.e. per real or imaginary component for complex data. Default: 4.

complex_data : bool, optional

Whether data are complex. Default: False.

Methods Summary

close()
read_payload() Read a single block.
temporary_offset(**kwds) Context manager for temporarily seeking to another file position.

Methods Documentation

close() [edit on github]
read_payload()[source] [edit on github]

Read a single block.

Returns:

frame : GSBPayload

With a .data property that returns the data encoded.

temporary_offset(**kwds) [edit on github]

Context manager for temporarily seeking to another file position.

To be used as part of a with statement:

with fh_raw.temporary_offset() [as fh_raw]:
    with-block

On exiting the with-block, the file pointer is moved back to its original position.