Mark4FileReaderInfo

class baseband.mark4.file_info.Mark4FileReaderInfo(parent=None)[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
number_of_frames = 2
frame_rate = 400.0 Hz
sample_rate = 32.0 MHz
samples_per_frame = 80000
sample_shape = (8,)
bps = 2
complex_data = False
readable = True
ntrack = 64
offset0 = 2696

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

checks:  decodable: True
>>> fh.close()

>>> fh = mark4.open(SAMPLE_MARK4, 'rb', decade=2010)
>>> fh.info
File information:
format = mark4
number_of_frames = 2
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
ntrack = 64
offset0 = 2696

checks:  decodable: True
>>> 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

Attributes that the container provides.

bps

Link to header0.bps

checks

Link to checks

complex_data

decade

Link to parent.decade

decodable

Whether decoding the first frame worked.

errors

Link to errors

format

The file format.

frame0

frame_rate

Number of frames per unit time.

header0

missing

Link to missing

ntrack

Link to parent.ntrack

number_of_frames

Total number of frames.

offset0

Offset in bytes to the location of the first header.

readable

Whether the file is readable and decodable.

ref_time

Link to parent.ref_time

sample_rate

Rate of complete samples per unit time.

sample_shape

Dimensions of each complete sample.

samples_per_frame

Link to header0.samples_per_frame

start_time

Time of the first sample.

time_info

Additional time info needed to get the start time.

warnings

Link to warnings

Methods Summary

__call__(self)

Create a dict with file information.

Attributes Documentation

attr_names = ('format', 'number_of_frames', 'frame_rate', 'sample_rate', 'samples_per_frame', 'sample_shape', 'bps', 'complex_data', 'start_time', 'readable', 'ntrack', 'offset0', 'missing', 'checks', 'errors', 'warnings')

Attributes that the container provides.

bps

Link to header0.bps

checks

Link to checks

complex_data = False
decade

Link to parent.decade

decodable

Whether decoding the first frame worked.

errors

Link to errors

format

The file format.

frame0
frame_rate

Number of frames per unit time.

header0
missing

Link to missing

ntrack

Link to parent.ntrack

number_of_frames

Total number of frames.

offset0

Offset in bytes to the location of the first header.

readable

Whether the file is readable and decodable.

ref_time

Link to parent.ref_time

sample_rate

Rate of complete samples per unit time.

sample_shape

Dimensions of each complete sample.

samples_per_frame

Link to header0.samples_per_frame

start_time

Time of the first sample.

time_info

Additional time info needed to get the start time.

warnings

Link to warnings

Methods Documentation

__call__(self) [edit on github]

Create a dict with file information.

This includes information about checks done, possible missing information, as well as possible warnings and errors.