# trying to use ica.plot\_overlay

**URL:** <https://mne.discourse.group/t/trying-to-use-ica-plot-overlay/1323>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [October 2, 2017, 10:55pm UTC](https://mne.discourse.group/t/trying-to-use-ica-plot-overlay/1323 "2017-10-02T22:55:40Z")\
**Posts on this page:** 3\
**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:** [October 2, 2017, 10:55pm UTC](https://mne.discourse.group/t/trying-to-use-ica-plot-overlay/1323/1 "2017-10-02T22:55:40Z")

</div>

Hi all,  
I'm having trouble following the tutorial for Artifact Correction with ICA.  
[http://martinos.org/mne/stable/auto\_tutorials/plot\_artifacts\_correction\_ica.html?highlight=ica%20fit](http://martinos.org/mne/stable/auto_tutorials/plot_artifacts_correction_ica.html?highlight=ica%20fit)

I have epoched data where my artifact is timed to the event; I'm not  
investigating EOG artifact. I am able to use ica.plot\_properties and  
ica.plot\_sources fine. But when I try to do ica.plot\_overlay, it looks  
like it's not excluding my bad component. Since artifact is timed to  
event, average is just the averaged epochs.

Attached: images from ica.plot\_properties, ica.plot\_sources, and  
ica.plot\_overlay. I'm not exactly clear on what picks and exclude expects  
(list, array, int?).

Commands used are below.  
Thanks very much for any help!

Megan

random\_state = 23  
n\_components =50 # if float, select n\_components by explained variance of PCA  
method = 'fastica' # for comparison with EEGLAB try "extended-infomax" here  
decim = 3 # we need sufficient statistics, not all time points -\> saves time  
reject=None # artifact is rather large, so don't want to reject it...

ica = ICA(n\_components=n\_components, method=method, random\_state=random\_state)  
ica.fit(epochs, picks=picks\_meg, decim=decim, reject=reject)

ica.plot\_sources(epochs)

epoch\_avg= epochs.average()

ica.plot\_sources(epoch\_avg, exclude=['35'])

ica.plot\_properties(epochs, picks=35, psd\_args={'fmax': 35.},  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;image\_args={'sigma': 1.})

# Following lines included with input and output:

In [72]: ica.plot\_overlay(epoch\_avg, exclude=['35'], show=False)  
Transforming to ICA space (50 components)  
/export/research/analysis/human/jstephen/shared/programs/python/anaconda3/lib/python3.5/site-packages/numpy/lib/arraysetops.py:375:  
FutureWarning: elementwise comparison failed; returning scalar  
instead, but in the future will perform elementwise comparison  
&nbsp;&nbsp;mask &= (ar1 != a)  
Zeroing out 0 ICA components  
Out[72]: \<matplotlib.figure.Figure at 0x7f8c469d55c0\>

In [74]: mne.\_\_version\_\_  
Out[74]: '0.14.dev0'

MEG Technician  
The Mind Research Network  
1101 Yale Blvd. NE  
Albuquerque, New Mexico 87106  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20171002/46125eae/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20171002/46125eae/attachment-0001.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: Screenshot 2017-10-02 at 4.47.15 PM.png  
Type: image/png  
Size: 416492 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20171002/46125eae/attachment-0003.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20171002/46125eae/attachment-0003.png)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: Screenshot 2017-10-02 at 4.14.55 PM.png  
Type: image/png  
Size: 610496 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20171002/46125eae/attachment-0004.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20171002/46125eae/attachment-0004.png)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: Screenshot 2017-10-02 at 3.51.50 PM.png  
Type: image/png  
Size: 646946 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20171002/46125eae/attachment-0005.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20171002/46125eae/attachment-0005.png)

---

<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:** [October 3, 2017, 8:15am UTC](https://mne.discourse.group/t/trying-to-use-ica-plot-overlay/1323/2 "2017-10-03T08:15:19Z")

</div>

hi Megan,

can you try with:

ica.plot\_sources(epoch\_avg, exclude=[35])

exclude should be in an int not a string.

Alex

---

<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:** [October 3, 2017, 9:40pm UTC](https://mne.discourse.group/t/trying-to-use-ica-plot-overlay/1323/3 "2017-10-03T21:40:24Z")

</div>

Thank you, Alex! That was my problem.

Megan

MEG Technician  
The Mind Research Network  
1101 Yale Blvd. NE  
Albuquerque, New Mexico 87106
