Mark4FileReaderInfo

class baseband.mark4.file_info.Mark4FileReaderInfo[source] [edit on github]

Bases: baseband.vlbi_base.file_info.VLBIFileReaderInfo

Standardized information on Mark 4 file readers.

The info descriptor has a number of standard attributes, which are determined from arguments passed in opening the file, from the first header (info.header0) and from possibly scanning the file to determine the duration of frames. This class has two additional attributes specific to Mark 4 files (ntrack and offset0, see below).

Examples

The most common use is simply to print information:

>>> from baseband.data import SAMPLE_MARK4
>>> from baseband import mark4
>>> fh = mark4.open(SAMPLE_MARK4, 'rb')
>>> fh.info
File information:
format = mark4
frame_rate = 400.0 Hz
sample_rate = 32.0 MHz
samples_per_frame = 80000
sample_shape = (8,)
bps = 2
complex_data = False
readable = True
offset0 = 2696

missing:  decade, ref_time: needed to infer full times.

errors:  start_time: unsupported operand type(s) for //: 'NoneType' and 'int'
>>> fh.close()

>>> fh = mark4.open(SAMPLE_MARK4, 'rb', decade=2010)
>>> fh.info
File information:
format = mark4
frame_rate = 400.0 Hz
sample_rate = 32.0 MHz
samples_per_frame = 80000
sample_shape = (8,)
bps = 2
complex_data = False
start_time = 2014-06-16T07:38:12.475000000
readable = True
offset0 = 2696
>>> fh.close()
Attributes
formatstr or None

File format, or None if the underlying file cannot be parsed.

frame_rateQuantity

Number of data frames per unit of time.

sample_rateQuantity

Complete samples per unit of time.

samples_per_frameint

Number of complete samples in each frame.

sample_shapetuple

Dimensions of each complete sample (e.g., (nchan,)).

bpsint

Number of bits used to encode each elementary sample.

complex_databool

Whether the data are complex.

start_timeTime

Time of the first complete sample.

ntrackint

Number of “tape tracks” simulated in the disk file.

offset0int

Offset in bytes from the start of the file to the location of the first header.

readablebool

Whether the first sample could be read and decoded.

missingdict

Entries are keyed by names of arguments that should be passed to the file reader to obtain full information. The associated entries explain why these arguments are needed. For Mark 4, the possible entries are decade and ref_time.

errorsdict

Any exceptions raised while trying to determine attributes. Keyed by the attributes.

Attributes Summary

attr_names

bps

complex_data

format

frame_rate

ntrack

offset0

readable

sample_rate

sample_shape

samples_per_frame

start_time

Methods Summary

__call__(self)

Create a dict with file information, including missing pieces.

Attributes Documentation

attr_names = ('format', 'frame_rate', 'sample_rate', 'samples_per_frame', 'sample_shape', 'bps', 'complex_data', 'start_time', 'readable', 'ntrack', 'offset0')
bps = None
complex_data = None
format = None
frame_rate = None
ntrack = None
offset0 = None
readable = None
sample_rate = None
sample_shape = None
samples_per_frame = None
start_time = None

Methods Documentation

__call__(self) [edit on github]

Create a dict with file information, including missing pieces.