# Finding the alternative to Matlab's runica inmne

**URL:** <https://mne.discourse.group/t/finding-the-alternative-to-matlabs-runica-inmne/1361>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [November 9, 2017, 8:30pm UTC](https://mne.discourse.group/t/finding-the-alternative-to-matlabs-runica-inmne/1361 "2017-11-09T20:30:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 9, 2017, 8:30pm UTC](https://mne.discourse.group/t/finding-the-alternative-to-matlabs-runica-inmne/1361/1 "2017-11-09T20:30:49Z")

</div>

Hi all,

I'm dealing with big issues trying to find an alternative to code running  
on Matlab using runica.m. Right now the code calls runica with the  
following parameters:  
'lrate', 0.001  
'extended', 1  
'random\_setting', 'default '

Moreover, no pca is performed.

The variables that interest me in the output of the function are: weights,  
sphere.

In python - trying to follow these instruction (  
[https://martinos.org/mne/stable/auto\_tutorials/plot\_artifacts\_correction\_ica.html](https://martinos.org/mne/stable/auto_tutorials/plot_artifacts_correction_ica.html)  
just until the fitting step), that's what I did:

n\_components = 14 # if float, select n\_components by explained variance of PCA  
method = 'extended-infomax' # for comparison with EEGLAB try  
"extended-infomax" here  
decim = 1 # we need sufficient statistics, not all time points -\> saves time

# we will also set state of the random number generator - ICA is a  
# non-deterministic algorithm, but we want to have the same decomposition  
# and the same order of components each time this tutorial is run  
random\_state = 0

# create an ICA instance called ica  
ica = mne.preprocessing.ICA(n\_components=n\_components, method=method,  
random\_state=random\_state, max\_iter=512, max\_pca\_components=None)  
picks\_eeg = mne.pick\_types(raw.info, meg=False, eeg=True, eog=False,)  
ica.fit(raw, picks=picks\_eeg, decim=decim)

my questions are:

&nbsp;&nbsp;&nbsp;1. is it possible to run ICA without PCA in mne?  
&nbsp;&nbsp;&nbsp;2. what is the equevialents of Matlab's variables: weights and sphere?

Hope I'm clear enough,  
Thanks,

Igal

\<[https://www.linkedin.com/in/igal-nazar/](https://www.linkedin.com/in/igal-nazar/)\>\*Igal Nazar\*  
R&D Engineer

igal at [brainster-tech.com](http://brainster-tech.com)  
+ 972 52 6701713  
\<[https://www.brainster-tech.com/](https://www.brainster-tech.com/)\>  
\<[https://www.brainster-tech.com/](https://www.brainster-tech.com/)\> \<[https://blog.brainster-tech.com/](https://blog.brainster-tech.com/)\>  
\<[https://www.linkedin.com/company/brainster](https://www.linkedin.com/company/brainster)\>  
\<[https://www.youtube.com/channel/UCZWPcShTiLkNqxIJPdrh7Kg](https://www.youtube.com/channel/UCZWPcShTiLkNqxIJPdrh7Kg)\>  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20171109/f6c43f55/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20171109/f6c43f55/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 10, 2017, 6:52am UTC](https://mne.discourse.group/t/finding-the-alternative-to-matlabs-runica-inmne/1361/2 "2017-11-10T06:52:10Z")

</div>

Hi!

If you don't want to reduce dimensionality via PCA, set n\_components=None (note that ICA always performs PCA as the initial step, but then you can choose to discard PCA components or not).

The equivalent of EEGLAB's sphere and weights is ica.unmixing\_matrix\_ (in EEGLAB you have to multiply shpere with weights to obtain the unmixing matrix).

Clemens
