file_info

baseband.io.file_info(name, format=None, **kwargs)[source] [edit on github]

Get format and other information from a baseband file.

The keyword arguments will only be used if needed, so if one is unsure what format a file is, but knows it was taken recently and has 8 channels, one would put in ref_time=Time('2015-01-01'), nchan=8. Alternatively, and perhaps easier, one can first call the function without extra arguments in which case the result will describe what is missing.

Parameters:
namestr or filehandle, or sequence of str

Raw file for which to obtain information. If a sequence of files is passed, returns information from the first file (see Notes).

formatstr, tuple of str, optional

Formats to try. If not given, try all standard formats.

**kwargs

Any arguments that might help to get information. For instance, Mark 4 and Mark 5B do not have complete timestamps, which can be addressed by passing in ref_time. Furthermore, for Mark 5B, it is needed to pass in nchan. Arguments are checked for consistency with the file even if not used (see notes below).

Returns:
info

The information on the file. Depending on how much information could be gathered, this will be an instance of either StreamReaderInfo, FileReaderInfo, or NoInfo.

Notes

All keyword arguments passed in are classified, ending up in one of the following (mostly useful if the file could be opened as a stream):

  • used_kwargs: arguments that were needed to open the file.

  • consistent_kwargs: not needed to open the file, but consistent.

  • inconsistent_kwargs: not needed to open the file, and inconsistent.

  • irrelevant_kwargs: provide information irrelevant for opening.