load_mat

Load data from MATLAB file type.

Uses scipy.io.loadmat to load recent versions of .MAT files. Version 7.3 is supported. It’ll try to make some intelligent guesses if it runs into trouble, meaning, ‘it will die trying!’. If you don’t like that philosophy, go ahead and use scipy.io.loadmat directly.

mr_utils.load_data.mat.deal_with_7_3(data)[source]

Clean up data structures for MATLAB 7.3.

Parameters:data (array_like) – Data from .mat file.

Notes

Version 7.3 has a structured datatype that needs to be translated as a complex number.

mr_utils.load_data.mat.load_mat(filename, key=None)[source]

Load data from .MAT file.

Parameters:
  • filename (str) – path to .mat file.
  • key (str, optional) – Specific key to extract.
Returns:

Contents of mat file.

Return type:

array_like

Notes

If key=None, all keys will be extracted. If there is only one key, then its value will be provided directly, no dictionary will be returned.