# Detect and remove eye artifacts with ICA

**URL:** <https://mne.discourse.group/t/detect-and-remove-eye-artifacts-with-ica/6396>\
**Category:** Support & Discussions\
**Tags:** eeg, ica\
**Created:** [February 22, 2023, 4:03pm UTC](https://mne.discourse.group/t/detect-and-remove-eye-artifacts-with-ica/6396 "2023-02-22T16:03:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Orlando](https://avatars.discourse-cdn.com/v4/letter/o/c6cbf5/32.png) [@Orlando](https://mne.discourse.group/u/Orlando)\
**Post date:** [February 22, 2023, 4:03pm UTC](https://mne.discourse.group/t/detect-and-remove-eye-artifacts-with-ica/6396/1 "2023-02-22T16:03:21Z")

</div>

- MNE version: 1.3.0
- operating system: Windows 10

Dear all,  
I am a beginner to MNE. I have to process a dataset with ONLY 12 EEG signals [‘AF7’, ‘FP1’, ‘FP2’, ‘AF8’, ‘F3’, ‘F4’, ‘P3’, ‘P4’, ‘PO7’, ‘01’, ‘O2’, ‘PO8’]. No EOG signals!

My goal is to remove the eye-artifacts with ICA. And in fact I have managed to remove them with the algorithm FastICA from the “sklearn library”. The problem now, is how to know when an eye-artifact is happening in time?

As a first approch I switched to MNE library in order to find out if there is a function or similar that can locate in time when an eye-artifact is happening. I have dived into the library for a while, and I have discovered some options

1. mne.find\_events() I am not sure how this “events” are estimated, but they seem to be related with STIM signals. If you do not have STIM signals, you get an error message, and I do not have any STIM signal
2. mne.preprocessing.find\_eog\_events(), this only works if you have an eog signal that indicated where a eye movement has happened.

To my understanding none of them seem to work for my purpose. Can somebody put some light to my doubts?

1. Is there any tool to locate/identify eye-artifacts in MNE?
2. Do I need to to locate when a eye-artifact is happening if I want to use one of the three ICA algorithms witin MNE?

Best Regards

Orlando Peña

---

<div class="post-metadata">

**Author:** ![mscheltienne](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mscheltienne/32/827_2.png) [@mscheltienne](https://mne.discourse.group/u/mscheltienne)\
**Post date:** [February 22, 2023, 4:09pm UTC](https://mne.discourse.group/t/detect-and-remove-eye-artifacts-with-ica/6396/2 "2023-02-22T16:09:17Z")

</div>

Hello,

It seems like you are confusing many different concepts. I suggest you start by looking into the [tutorials](https://mne.tools/dev/auto_tutorials/index.html), starting with:

- [Overview of MEG/EEG analysis with MNE-Python — MNE 1.4.dev0 documentation](https://mne.tools/dev/auto_tutorials/intro/10_overview.html#sphx-glr-auto-tutorials-intro-10-overview-py)
- [Parsing events from raw data — MNE 1.4.dev0 documentation](https://mne.tools/dev/auto_tutorials/intro/20_events_from_raw.html#sphx-glr-auto-tutorials-intro-20-events-from-raw-py)
- [Overview of artifact detection — MNE 1.4.dev0 documentation](https://mne.tools/dev/auto_tutorials/preprocessing/10_preprocessing_overview.html#ocular-artifacts-eog)
- [Repairing artifacts with ICA — MNE 1.4.dev0 documentation](https://mne.tools/dev/auto_tutorials/preprocessing/40_artifact_correction_ica.html)

One point I can add, you don’t actually need to detect the EOG artifacts to remove them with an ICA decomposition. The ICA decomposition will decompose your signal in independent components (regardless of the algorithm used). One of those components (among the first ones usually) should be you eye-blinks. By zeroing out this components and reconstructing the signal from the other components, you effectively remove the eye-blinks.  
The only ‘detection’ aspect here is that you need to label, manually or automatically, the components to tell MNE which component it should zero-out and which component it should keep.

Mathieu

---

<div class="post-metadata">

**Author:** ![Orlando](https://avatars.discourse-cdn.com/v4/letter/o/c6cbf5/32.png) [@Orlando](https://mne.discourse.group/u/Orlando)\
**Post date:** [February 22, 2023, 4:15pm UTC](https://mne.discourse.group/t/detect-and-remove-eye-artifacts-with-ica/6396/3 "2023-02-22T16:15:17Z")

</div>

> [@mscheltienne](#):
>
> The only ‘detection’ aspect here is that you need to label, manually or automatically, the components to tell MNE which component it should zero-out and which component it should keep.

Hello sir,  
thank you very much for your quick answer. You have just stricked the hot topic, in fact you wrote:  
“The only ‘detection’ aspect here is that you need to label, manually or **automatically,** the components to tell MNE which component it should zero-out and which component it should keep.”  
This is exactly what I want. How can I label automatically the component I should zero-out?

Best Regars

Orlando Peña

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [February 22, 2023, 4:35pm UTC](https://mne.discourse.group/t/detect-and-remove-eye-artifacts-with-ica/6396/4 "2023-02-22T16:35:30Z")

</div>

> [@Orlando](#):
>
> - Is there any tool to locate/identify eye-artifacts in MNE?

Yes, you can use [`find_eog_events()`](https://mne.tools/stable/generated/mne.preprocessing.find_eog_events.html). Pass it the name of the channel(s) closest to the eyes, i.e. those channels that are likely to contain clear ocular artifacts.

Richard

---

<div class="post-metadata">

**Author:** ![Orlando](https://avatars.discourse-cdn.com/v4/letter/o/c6cbf5/32.png) [@Orlando](https://mne.discourse.group/u/Orlando)\
**Post date:** [February 22, 2023, 5:45pm UTC](https://mne.discourse.group/t/detect-and-remove-eye-artifacts-with-ica/6396/5 "2023-02-22T17:45:48Z")

</div>

Hi Richard,  
thank you very much. I have made a test and it seems to work!!!

Thank you a lot!!!

Best Regards

Orlando
