Creating info file from scratch from mat file - mTRF Speech Dataset

Hello everyone,

I am hoping to use mTRF Speech Dataset for my data analysis and created an info file from scratch as below. However when I plot, as can be seen, I am seeing something that does not frankly resemble an EEG recording. Where did I go wrong?

mat = scipy.io.loadmat(r'\speech_data.mat', struct_as_record=False)
data = mat['EEG']
data = np.transpose(data)
n_channels = 128
sampling_freq = 512
ch_types = ['eeg'] * 128
info = mne.create_info(n_channels, ch_types=ch_types, sfreq=sampling_freq)
info.set_montage('biosemi128', on_missing='ignore')
converted_mtrf_raw =  mne.io.RawArray(data, info)
converted_mtrf_raw.filter(l_freq=1, h_freq=None, picks="all")
freqs = (60, 120, 180, 240)
converted_mtrf_raw.notch_filter(freqs=freqs, picks="all")
converted_mtrf_raw.set_eeg_reference(ref_channels='average')
converted_mtrf_raw.plot(remove_dc=True)
  • MNE version: 1.0.3
  • operating system: Windows 8.1

Hello @hazalk9 and welcome to the forum!

If signal amplitudes are too big, the data browser (the thing that pops up when you run raw.plot()) clips the signal. This is probably the reason why things look odd in your example. You can try to press - (the minus / hyphen key) a couple of times to “zoom out”; this will adjust the scaling shown in the top-left (the value in red). Once you reach an appropriate scaling, the signal should be visible.

If the signal amplitude appears to be unusually big, you’ll need to ensure that the imported values are in Volts, as this is what MNE-Python uses for EEG data.

I also recommend you install our new Qt-based browser interface, which has a more modern feel to it and is faster in certain situations. It’s available from PyPI and conda-forge under the name of mne-qt-browser.

Best wishes,
Richard

Thank you, now also going over plot() parameters as well!

1 Like

note also that mTRF dataset is available natively in MNE-Python:

https://mne.tools/stable/overview/datasets_index.html#mtrf-dataset

Here’s the example section from our docs where the data get loaded:

https://mne.tools/stable/auto_examples/decoding/receptive_field_mtrf.html#load-the-data-from-the-publication

1 Like