FieldTrip Importer - pwollstadt/IDTxl GitHub Wiki

IDTxl provides a set of simple import functions for various file formats. To import FieldTrip-style data from MATLAB files (.mat) into IDTxl's data format, use the import_matarray() function. The FieldTrip raw data format is commonly use to represent neurophysiological data.

The import function reads MATLAB's hdf5 files saved with version "-v7.3" or higher. The mat file must contain a single FieldTrip structure only. The structure has to contain the fields trial (data), label (channel labels), time (time stamps for data samples), and fsample (sampling rate). The data is returned as a IDTxl Data() object together with numpy arrays containing meta information (data, label, timestamps, fsample).

Import IO functions

from idtxl import idtxl_io as io

Read FieldTrip mat-file and return Data() object and meta data

Example: FieldTrip-style MATLAB array, v7.3

(data, label, timestamps, fsample) = io.import_fieldtrip(
    file_name='test/data/ABA04_Up_10-140Hz_v7_3.mat',  # file name
    ft_struct_name='data',  # name of the MATLAB struct
    file_version='v7.3')  # file version