Skip to content

apply patch from Christian on ICA reader - #8308

Closed
agramfort wants to merge 1 commit into
mne-tools:masterfrom
agramfort:FIX_ica_read_eeglab
Closed

agramfort wants to merge 1 commit into
mne-tools:masterfrom
agramfort:FIX_ica_read_eeglab

Conversation

@agramfort

@agramfort agramfort commented Sep 25, 2020 •

Copy link
Copy Markdown
Member

closes #7657

@christian-oreilly @marcpabst did I get it right?

PR:

Screenshot 2020-09-25 at 15 50 20

master:

Screenshot 2020-09-25 at 15 44 10

Comment thread mne/preprocessing/ica.py
# weights matrix (u * s) and our PCA vectors (v) back
u, s, v = _safe_svd(eeg.icaweights, full_matrices=False)
ica.unmixing_matrix_ = u * s
ica.unmixing_matrix_ = u @ s

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s is 1D so after this operation unmixing_matrix_ will be 1D. I think this can't be correct.

Maybe you mean u @ np.diag(s), but this is the same as u * s.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For more info see previous comment

#7657 (comment)

@marcpabst

Copy link
Copy Markdown

Looks good to me. This is the "ground truth" from EEGLAB:
image

@marcpabst

Copy link
Copy Markdown

I should add that with this file n_components == n_ch:.

@agramfort

agramfort commented Sep 25, 2020 via email

Copy link
Copy Markdown
Member Author

@larsoner

Copy link
Copy Markdown
Member

In particular:

mne/preprocessing/tests/test_ica.py:1230: in test_read_ica_eeglab
    ica = read_ica_eeglab(fname)
mne/preprocessing/ica.py:2675: in read_ica_eeglab
    ica._update_mixing_matrix()
mne/preprocessing/ica.py:712: in _update_mixing_matrix
    np.linalg.pinv(self.pca_components_) @ self._eeglab_icawinv
E   ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 32 is different from 25)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The computation of the mixing matrix for ICA imported from EEGLAB ICA is broken

3 participants