GSBTimeStampIO¶
- class baseband.gsb.base.GSBTimeStampIO(fh_raw)[source] [edit on github]¶
Bases:
FileBaseSimple reader/writer for GSB time stamp files.
Wraps a binary filehandle, providing methods
read_timestamp,write_timestamp, andget_frame_rate.- Parameters:
- fh_rawfilehandle
Filehandle to the timestamp file, opened in binary mode.
Attributes Summary
Standardized information on a timestamp file reader.
Methods Summary
close()Determine the number of frames per second.
Read a single timestamp.
temporary_offset([offset, whence])Context manager for temporarily seeking to another file position.
write_timestamp([header])Write a single timestamp.
Attributes Documentation
- fh_raw = None¶
- info¶
Standardized information on a timestamp file reader.
The
infodescriptor has a number of standard attributes, which are determined from arguments passed in opening the file, from the first header (info.header0) and from possibly scanning the file to determine the duration of frames.
Methods Documentation
- close() [edit on github]¶
- get_frame_rate()[source] [edit on github]¶
Determine the number of frames per second.
The frame rate is inferred from the first two timestamps.
- Returns:
- frame_rate
Quantity Frames per second.
- frame_rate
- read_timestamp()[source] [edit on github]¶
Read a single timestamp.
- Returns:
- frame
GSBHeader With a
.timeproperty that returns the time 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
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().
- write_timestamp(header=None, **kwargs)[source] [edit on github]¶
Write a single timestamp.
- Parameters:
- header
GSBHeader, optional Header holding time to be written to disk. Can instead give keyword arguments to construct a header.
- **kwargs
If
headeris not given, these are used to initialize one.
- header