Base¶
Routines on which the readers and writers for specific baseband formats are based.
Reference/API¶
baseband.base Package¶
Base implementations shared between all formats.
Files are considered as composed of multiple frames, each of which have a
header and payload, which are encoded in various ways. Base classes
implementing the decoding and encoding and exposing a standardized
interface are found in the corresponding header
,
payload
and frame
modules, with the
separate encoding
module providing implementations for
common encoding formats.
The base
module defines base methods for file and stream
readers and writers that read or write the frames, including possibly
dealing with corrupted data, using the offsets
module to
keep track of missing pieces. Each file and stream reader has an info
property, defined in file_info
, that provides standardized
information.
Finally, utils
contains some general utility routines such
as for BCD encoding and decoding, and cyclic redundancy checks.
baseband.base.header Module¶
Base definitions for baseband Headers, in particular for the VLBI types.
Defines a number of helpers to construct a Header class that hold header words corresponding to a frame header, and provides access to the values encoded in those words via a dict-like interface. Definitions for headers are constructed using a HeaderParser class (which is targeted specifically at the VLBI formats).
Functions¶
|
Construct a function that converts specific bits from a header. |
|
Construct a function that uses a value to set specific bits in a header. |
|
Return the default value from a header keyword. |
Classes¶
|
Create a lazily evaluated dictionary of parsers, setters, or defaults. |
Parser & setter for header keywords. |
|
Parser & setter for VLBI header keywords. |
|
|
Base class for all baseband headers using parsers. |
|
Base class for all VLBI headers. |
Class Inheritance Diagram¶
baseband.base.payload Module¶
Base definitions for payloads.
Defines a payload class PayloadBase that can be used to hold the words corresponding to a frame payload, providing access to the values encoded in it as a numpy array.
Classes¶
|
Container for decoding and encoding baseband payloads. |
Class Inheritance Diagram¶
baseband.base.frame Module¶
Base definitions for baseband frames.
Defines a frame class FrameBase that can be used to hold a header and a payload, providing access to the values encoded in both.
Classes¶
|
Representation of a baseaband frame, consisting of a header and payload. |
Class Inheritance Diagram¶
baseband.base.base Module¶
Common classes for accessing baseband data as binary files and streams.
For access as binary files, the main FileBase
class
provides a base to which simple methods such as read_frame
and
write_frame
can be added. Unlike normal binary file readers, the base can
be pickled: it stores the name and re-opens the file if unpickled. The
VLBIFileReaderBase
adds additional methods useful for
streams with small frames, to locate frames and determine the frame rate.
For access as streams, the StreamReaderBase
and
StreamWriterBase
classes allow one to process data in
terms of frames, and access them as streams of samples via the read
and
write
methods, providing a number of private methods which can be
overridden as needed for specific data formats.
The FileOpener
and FileInfo
classes are to help create the open
and info
functions that are
expected to exist for each format.
Classes¶
Error in finding a header in a stream. |
|
|
File wrapper, used to add frame methods to a binary data file. |
|
VLBI wrapped file reader base class. |
|
Baseband file wrapper, allowing access as a stream of data. |
|
Base for all stream readers, providing standard reading methods. |
|
Base for VLBI stream readers. |
|
Base for all stream writers, providing a standard write method. |
|
File information collector. |
|
File opener for a baseband format. |
Class Inheritance Diagram¶
baseband.base.offsets Module¶
Classes¶
|
File offset tracker. |
Class Inheritance Diagram¶
baseband.base.file_info Module¶
Provide a base class for “info” properties.
Loosely based on DataInfo
.
Classes¶
|
Like a lazy property, evaluated only once. |
|
Container providing a standardized interface to file information. |
|
Standardized information on file readers. |
|
Standardized information on stream readers. |
|
Info class for cases where no useful information was returned. |
Class Inheritance Diagram¶
baseband.base.encoding Module¶
Encoders and decoders for generic binary data formats.
Functions¶
|
Generic encoder for data stored using one bit. |
|
Generic encoder for data stored using two bits. |
|
Generic encoder for data stored using four bits. |
|
Generic decoder for data stored using 8 bits. |
|
Encode 8 bit VDIF data. |
Variables¶
Optimal high value for a 2-bit digitizer for which the low value is 1. |
|
Optimal level between low and high for the above OPTIMAL_2BIT_HIGH. |
|
Scaling for four-bit encoding that makes it look like 2 bit. |
|
Scaling for eight-bit encoding that makes it look like 2 bit. |
|
Levels for data encoded with different numbers of bits.. |
baseband.base.utils Module¶
Functions¶
|
Calculate the least common multiple of a and b. |
|
|
|
|
|
Convert the pattern to a byte array. |
Classes¶
|
Property that is fixed for all instances of a class. |
|
Cyclic Redundancy Check. |
|
Cyclic Redundancy Check for a bitstream. |