mne-python: can’t import my set file using read_epochs_eeglab()

Description of the problem

I get the error: “TypeError: ‘int’ object is not iterable”.I am not sure where I could be making a mistake.

Steps to reproduce

these are my codes:
import mne
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import pickle
import pymatreader
import mffpy
#single sub evoked
eeg1 = mne.io.read_epochs_eeglab(‘1_LH.set’)

Link to data

No response

Expected results

how to solve the problem

Actual results

eeg1 = mne.io.read_epochs_eeglab(‘1_LH.set’) Extracting parameters from E:\code\EEG ML code\EEG\part2\2_extra_features\Example_data\1_LH.set… Traceback (most recent call last):

File “C:\Users\Administrator\AppData\Local\Temp/ipykernel_17044/1102068857.py”, line 1, in <module> eeg1 = mne.io.read_epochs_eeglab(‘1_LH.set’)

File “C:\ProgramData\Anaconda3\lib\site-packages\mne\io\eeglab\eeglab.py”, line 337, in read_epochs_eeglab epochs = EpochsEEGLAB(input_fname=input_fname, events=events, eog=eog,

File “<decorator-gen-296>”, line 12, in init

File “C:\ProgramData\Anaconda3\lib\site-packages\mne\io\eeglab\eeglab.py”, line 569, in init info, eeg_montage, _ = _get_info(eeg, eog=eog, scale_units=scale_units)

File “C:\ProgramData\Anaconda3\lib\site-packages\mne\io\eeglab\eeglab.py”, line 199, in _get_info _get_montage_information(eeg, has_pos, scale_units=scale_units)

File “C:\ProgramData\Anaconda3\lib\site-packages\mne\io\eeglab\eeglab.py”, line 150, in _get_montage_information for item in list(zip(*eeg.chaninfo[‘nodatchans’].values())):

TypeError: ‘int’ object is not iterable

Additional information

my mne version is 1.3.1 windows 11

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Please provide a quick fix or workaround.

The workaround is to load the data in EEGLAB and export as some other format besides .set (such as EDF). I’m sorry, I know that’s not a very satisfactory answer, but we (MNE-Python maintainers) are not all EEGLAB users (much less experts) and those that are have limited time.

I am one of the non-EEGLAB experts and I just spent ~45 minutes in the python debugger, reading EEGLAB source code, loading the file in Octave, etc. I can tell you that the reason for the error is that eeg.chaninfo['nodatchans']['datachan'] = 0 and our code expects all entries in eeg.chaninfo['nodatchans'] to be iterables (lists or arrays). But I have little idea what the value represents so I can’t propose a reasonable fix to the code. maybe @cbrnr or @agramfort or @smathot has some ideas?