GSBFileReader¶
- class baseband.gsb.base.GSBFileReader(fh_raw, payload_nbytes, nchan=1, bps=4, complex_data=False)[source] [edit on github]¶
Bases:
FileBase
Simple reader for GSB data files.
Wraps a binary filehandle, providing a
read_payload
method to help interpret the data.- Parameters:
- payload_nbytesint
Number of bytes to read.
- nchanint, optional
Number of channels. Default: 1.
- bpsint, optional
Bits per elementary sample, i.e. per real or imaginary component for complex data. Default: 4.
- complex_databool, optional
Whether data are complex. Default:
False
.
Attributes Summary
Methods Summary
close
()Read a single block.
temporary_offset
([offset, whence])Context manager for temporarily seeking to another file position.
Attributes Documentation
- fh_raw = None¶
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.
- frame
- temporary_offset(offset=None, whence=0) [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. As a convenience, one can pass on the offset to seek to when entering the context manager. Parameters are as forio.IOBase.seek()
.