# ICA.plot\_sources returns straight lines

**URL:** <https://mne.discourse.group/t/ica-plot-sources-returns-straight-lines/4520>\
**Category:** Support & Discussions\
**Created:** [March 7, 2022, 2:15pm UTC](https://mne.discourse.group/t/ica-plot-sources-returns-straight-lines/4520 "2022-03-07T14:15:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![manfred1201](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@manfred1201](https://mne.discourse.group/u/manfred1201)\
**Post date:** [March 7, 2022, 2:15pm UTC](https://mne.discourse.group/t/ica-plot-sources-returns-straight-lines/4520/1 "2022-03-07T14:15:49Z")

</div>

- MNE version:0.24.0
- operating system: Windows 10  
Dear mne experts, can anyone help me with this problem?  
My raw data seems alright and I applied ICA methods to erase the eye movement.

 ![raw](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/2/2e1de9b7217e351b35ce9e61d66924f4abcc13bc.png)  
This is my raw data, it seems good here.  
After filter and re-reference, I applied the ICA method, code here:

```python
ica = mne.preprocessing.ICA(n_components=0.99999, method='picard', max_iter=1200)
        ica.fit(raw_filter)
        raw_filter.load_data()
        ica.plot_components()
        ica.plot_sources(raw_filter, show_scrollbars=True)
        plt.show(block=True)

```

after ICA, the plot\_components method seems normal, the result is:

 ![components](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/1/152590b85926836989405ac97eb76bc48f7584a6.jpeg)

But the plot\_sources method returns straight lines which are really strange.

 ![sources](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/5/54f096370a6a5d392eb906c57769f96145e34973.png)

I don’t know what went wrong. Could anybody help me with this plzzzzzz?

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [March 8, 2022, 8:22am UTC](https://mne.discourse.group/t/ica-plot-sources-returns-straight-lines/4520/2 "2022-03-08T08:22:53Z")

</div>

I would think you have a huge artifact somewhere in your data. You should mark it as BAD with  
an annotation as ICA is not good for transient artifacts

ALex

---

<div class="post-metadata">

**Author:** ![JohnAtl](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/johnatl/32/1223_2.png) [@JohnAtl](https://mne.discourse.group/u/JohnAtl)\
**Post date:** [March 13, 2022, 7:58pm UTC](https://mne.discourse.group/t/ica-plot-sources-returns-straight-lines/4520/3 "2022-03-13T19:58:01Z")

</div>

I’m not sure it’s _the_ problem, but asking ICA to explain 99.999% of the variance is asking a lot.  
I would change this to an integer one less than the number of channels you have.  
If you’ve interpolated any of those channels, you’ll want to use one less than the number of channels before interpolation.

---

<div class="post-metadata">

**Author:** ![manfred1201](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@manfred1201](https://mne.discourse.group/u/manfred1201)\
**Post date:** [March 15, 2022, 12:28am UTC](https://mne.discourse.group/t/ica-plot-sources-returns-straight-lines/4520/4 "2022-03-15T00:28:35Z")

</div>

Thank you a lot ALex!  
This is exactly the problem in my case. I forgot to stop the recording after the experiment is done and the data of subjects taking off their hats are recorded. After I deleted that part the ICA performed normally
