GSBFileWriter

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

Bases: baseband.base.base.FileBase

Simple writer for GSB data files.

Adds write_payload method to the basic binary file wrapper.

Attributes Summary

fh_raw

Methods Summary

close()

temporary_offset([offset, whence])

Context manager for temporarily seeking to another file position.

write_payload(data[, bps])

Write single data block.

Attributes Documentation

fh_raw = None

Methods Documentation

close() [edit on github]
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 for io.IOBase.seek().

write_payload(data, bps=4)[source] [edit on github]

Write single data block.

Parameters
datandarray or GSBPayload

If an array, bps needs to be passed in.

bpsint, optional

Bits per elementary sample, to use when encoding the payload. Ignored if data is a GSB payload. Default: 4.