FileBase

class baseband.base.base.FileBase(fh_raw)[source] [edit on github]

Bases: object

File wrapper, used to add frame methods to a binary data file.

The underlying file is stored in fh_raw and all attributes that do not exist on the class itself are looked up on it.

Parameters:
fh_rawfilehandle

Filehandle of the raw binary data file.

Notes

A subclass for reading should define read_header, read_frame, and get_frame_rate methods, and also set an info property. Often the standard one will suffice, i.e., info = FileReaderInfo().

A subclass for writing should define a write_frame method.

Attributes Summary

fh_raw

Methods Summary

close()

temporary_offset([offset, whence])

Context manager for temporarily seeking to another file position.

Attributes Documentation

fh_raw = None

Methods Documentation

close()[source] [edit on github]
temporary_offset(offset=None, whence=0)[source] [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 for io.IOBase.seek().