# Twice ICA components differences

**URL:** <https://mne.discourse.group/t/twice-ica-components-differences/677>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [February 27, 2014, 9:35am UTC](https://mne.discourse.group/t/twice-ica-components-differences/677 "2014-02-27T09:35:02Z")\
**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:** [February 27, 2014, 9:35am UTC](https://mne.discourse.group/t/twice-ica-components-differences/677/1 "2014-02-27T09:35:02Z")

</div>

Dear All,

When I used ICA twice continually, I got different amount of components. I  
think it must be something wrong about my script.  
Can anyone help me to check the script? By this script, I got amount of  
components:

\<ICA | raw data decomposition, fit: 13900 samples, 184 components\>  
\<ICA | raw data decomposition, fit: 13900 samples, 167 components\>

import mne  
from mne.preprocessing import ICA  
from mne.datasets import sample

data\_path = sample.data\_path()  
raw\_fname = data\_path + '/MEG/sample/sample\_audvis\_filt-0-40\_raw.fif'  
n\_components=0.99  
max\_pca\_components=None

raw = mne.fiff.Raw(raw\_fname, preload=True)  
picks = mne.fiff.pick\_types(raw.info, meg=True, exclude='bads')  
ica = ICA(n\_components=n\_components, max\_pca\_components=max\_pca\_components,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;random\_state=0)  
ica.decompose\_raw(raw, picks=picks, decim=3)  
print ica  
raw\_new = ica.pick\_sources\_raw(raw)  
picks = mne.fiff.pick\_types(raw\_new.info, meg=True, exclude='bads')  
ica = ICA(n\_components=n\_components, max\_pca\_components=max\_pca\_components,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;random\_state=0)  
ica.decompose\_raw(raw\_new, picks=picks, decim=3)  
print ica

Best wishes,  
Qunxi Dong  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20140227/42fe415b/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20140227/42fe415b/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:** [February 27, 2014, 9:59am UTC](https://mne.discourse.group/t/twice-ica-components-differences/677/2 "2014-02-27T09:59:14Z")

</div>

Hi Qunxi,

I can confirm this issue. I think I found a bug in the ICA code.  
Let's move this discussion to Github.

Best,  
Denis
