FileBase¶
- class baseband.base.base.FileBase(fh_raw)[source] [edit on github]¶
Bases:
objectFile wrapper, used to add frame methods to a binary data file.
The underlying file is stored in
fh_rawand 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, andget_frame_ratemethods, and also set aninfoproperty. Often the standard one will suffice, i.e.,info = FileReaderInfo().A subclass for writing should define a
write_framemethod.Attributes Summary
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
withstatement: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().