GSBTimeStampIO

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

Bases: baseband.vlbi_base.base.VLBIFileBase

Simple reader/writer for GSB time stamp files.

Wraps a binary filehandle, providing methods read_timestamp, write_timestamp, and get_frame_rate.

Parameters
fh_rawfilehandle

Filehandle to the timestamp file, opened in binary mode.

Attributes Summary

info()

Methods Summary

close(self)

get_frame_rate(self)

Determine the number of frames per second.

read_timestamp(self)

Read a single timestamp.

temporary_offset(self)

Context manager for temporarily seeking to another file position.

write_timestamp(self[, header])

Write a single timestamp.

Attributes Documentation

info

Methods Documentation

close(self) [edit on github]
get_frame_rate(self)[source] [edit on github]

Determine the number of frames per second.

The frame rate is inferred from the first two timestamps.

Returns
frame_rateQuantity

Frames per second.

read_timestamp(self)[source] [edit on github]

Read a single timestamp.

Returns
frameGSBHeader

With a .time property that returns the time encoded.

temporary_offset(self) [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.

write_timestamp(self, header=None, **kwargs)[source] [edit on github]

Write a single timestamp.

Parameters
headerGSBHeader, optional

Header holding time to be written to disk. Can instead give keyword arguments to construct a header.

**kwargs :

If header is not given, these are used to initialize one.