Mark5BFileWriter¶
- class baseband.mark5b.base.Mark5BFileWriter(fh_raw)[source] [edit on github]¶
Bases:
FileBase
Simple writer for Mark 5B files.
Adds
write_frame
method to the VLBI binary file wrapper.Attributes Summary
Methods Summary
close
()temporary_offset
([offset, whence])Context manager for temporarily seeking to another file position.
write_frame
(data[, header, bps, valid])Write a single frame (header plus payload).
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 forio.IOBase.seek()
.
- write_frame(data, header=None, bps=2, valid=True, **kwargs)[source] [edit on github]¶
Write a single frame (header plus payload).
- Parameters:
- data
ndarray
or :Mark5BFrame
If an array,
header
should be given, which will be used to get the information needed to encode the array, and to construct the Mark 5B frame.- header
Mark5BHeader
Can instead give keyword arguments to construct a header. Ignored if
data
is aMark5BFrame
instance.- bpsint, optional
Bits per elementary sample, to use when encoding the payload. Ignored if
data
is aMark5BFrame
instance. Default: 2.- validbool, optional
Whether the data are valid; if
False
, a payload filled with an appropriate pattern will be crated. Ignored ifdata
is aMark5BFrame
instance. Default:True
.- **kwargs
If
header
is not given, these are used to initialize one.
- data