VLBIFileReaderInfo

class baseband.vlbi_base.file_info.VLBIFileReaderInfo(parent=None)[source] [edit on github]

Bases: baseband.vlbi_base.file_info.VLBIInfoBase

Standardized information on 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.

Examples

The most common use is simply to print information:

>>> from baseband.data import SAMPLE_MARK5B
>>> from baseband import mark5b
>>> fh = mark5b.open(SAMPLE_MARK5B, 'rb')
>>> fh.info
File information:
format = mark5b
number_of_frames = 4
frame_rate = 6400.0 Hz
bps = 2
complex_data = False
readable = False

missing:  nchan: needed to determine sample shape, frame rate, ...
          kday, ref_time: needed to infer full times.

>>> fh.close()

>>> fh = mark5b.open(SAMPLE_MARK5B, 'rb', kday=56000, nchan=8)
>>> fh.info
File information:
format = mark5b
number_of_frames = 4
frame_rate = 6400.0 Hz
sample_rate = 32.0 MHz
samples_per_frame = 5000
sample_shape = (8,)
bps = 2
complex_data = False
start_time = 2014-06-13T05:30:01.000000000
readable = True

checks:  decodable: True
>>> fh.close()
Attributes
formatstr or None

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

number_of_framesint

Number of frames in the file.

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.

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.

checksdict

Checks that were done to determine whether the file was readable (normally the only entry is ‘decodable’).

errorsdict

Any exceptions raised while trying to determine attributes or doing checks. Keyed by the attributes/checks.

warningsdict

Any warnings about the attributes or about the checks. Keyed by the attributes/checks.

Attributes Summary

attr_names

Attributes that the container provides.

bps

Link to header0.bps

checks

Link to checks

complex_data

Link to header0.complex_data

decodable

Whether decoding the first frame worked.

errors

Link to errors

format

The file format.

frame0

First frame from the file.

frame_rate

Number of frames per unit time.

header0

Header of the first frame in the file.

missing

Link to missing

number_of_frames

Total number of frames.

readable

Whether the file is readable and decodable.

sample_rate

Rate of complete samples per unit time.

sample_shape

Link to header0.sample_shape

samples_per_frame

Link to header0.samples_per_frame

start_time

Time of the first sample.

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', 'missing', 'checks', 'errors', 'warnings')

Attributes that the container provides.

bps

Link to header0.bps

checks

Link to checks

complex_data

Link to header0.complex_data

decodable[source]

Whether decoding the first frame worked.

errors

Link to errors

format[source]

The file format.

frame0[source]

First frame from the file.

frame_rate[source]

Number of frames per unit time.

header0[source]

Header of the first frame in the file.

missing

Link to missing

number_of_frames[source]

Total number of frames.

readable[source]

Whether the file is readable and decodable.

sample_rate[source]

Rate of complete samples per unit time.

sample_shape

Link to header0.sample_shape

samples_per_frame

Link to header0.samples_per_frame

start_time[source]

Time of the first sample.

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.