VDIFFileWriter

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

Bases: FileBase

Simple writer for VDIF files.

Adds write_frame and write_frameset methods to the basic VLBI binary file wrapper.

Attributes Summary

fh_raw

Methods Summary

close()

temporary_offset([offset, whence])

Context manager for temporarily seeking to another file position.

write_frame(data[, header])

Write a single frame (header plus payload).

write_frameset(data[, header])

Write a single frame set (headers plus payloads).

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_frame(data, header=None, **kwargs)[source] [edit on github]

Write a single frame (header plus payload).

Parameters:
datandarray or VDIFFrame

If an array, a header should be given, which will be used to get the information needed to encode the array, and to construct the VDIF frame.

headerVDIFHeader

Can instead give keyword arguments to construct a header. Ignored if data is a VDIFFrame instance.

**kwargs

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

write_frameset(data, header=None, **kwargs)[source] [edit on github]

Write a single frame set (headers plus payloads).

Parameters:
datandarray or VDIFFrameSet

If an array, a header should be given, which will be used to get the information needed to encode the array, and to construct the VDIF frame set.

headerVDIFHeader, list of same

Can instead give keyword arguments to construct a header. Ignored if data is a VDIFFrameSet instance. If a list, should have a length matching the number of threads in data; if a single header, thread_ids corresponding to the number of threads are generated automatically.

**kwargs

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