Read ICA EEGLab error: ICA Weights Shape

  • MNE-Python version: 0.22.0
  • operating system: MacOS 10.15.5

I am attempting to import ICA components from EEGLab from a 61 channel setup. ICA was performed with AMICA (not runica) with PCA reduction to rank correct for interpolated channels.

Using run_ica_eeglab, I get a kickback from assert eeg.icaweights.shape == (n_components, n_ch). (Line 2708 of

Looking at the data in EEGLab, ICAweights = n_components x n_pcs, and ICAsphere = n_pcs x n_channels. I鈥檓 guessing run_ica_eeglab is assuming the icaweights matrix is already multiplied by icasphere. Is this a bug, or am I not working around this correctly?

Hi, I assume you鈥檙e referring to read_ica_eeglab() here? Could you provide the full traceback?
This does smell like a bug though. cc @cbrnr


Yes, referring to read_ica_eeglab().
Here鈥檚 the full output:

AssertionError                            Traceback (most recent call last)
<ipython-input-10-a6f5a4e0501a> in <module>
      5 from mne import preprocessing
----> 7 ica = preprocessing.read_ica_eeglab('full_filepath')

~/opt/anaconda3/envs/mne/lib/python3.8/site-packages/mne/preprocessing/ in read_ica_eeglab(fname)
   2755     n_ch = len(ica.ch_names)
-> 2756     assert eeg.icaweights.shape == (n_components, n_ch)
   2757     # When PCA reduction is used in EEGLAB, runica returns
   2758     # weights= weights*sphere*eigenvectors(:,1:ncomps)';


Happy to provide a test .set/.fdt file too if helpful.

Hm, this could be a bug, maybe related to the weights coming from an AMICA decomposition. I鈥檓 not sure if this has been tested, so a test file would be helpful. Also, I think you should open an issue, because your usage of the function is obviously correct. Maybe christian-oreilly is still around to check.

Thanks, both. I鈥檒l go ahead and open an issue becuase I see there has been a few other issues with read_ICA_eeglab() since it was added not too long ago.

this was addressed in Read ICA EEGLab: problems with AMICA decomposition 路 Issue #8755 路 mne-tools/mne-python 路 GitHub and MRG, BUG: fix IO or read_ica_eeglab by agramfort 路 Pull Request #8780 路 mne-tools/mne-python 路 GitHub.