# Check for ICA (toward Epochs Rejection)

**URL:** <https://mne.discourse.group/t/check-for-ica-toward-epochs-rejection/2722>\
**Category:** Support & Discussions\
**Tags:** preprocessing, ica\
**Created:** [February 18, 2021, 10:55am UTC](https://mne.discourse.group/t/check-for-ica-toward-epochs-rejection/2722 "2021-02-18T10:55:16Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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 20, 2021, 9:13am UTC](https://mne.discourse.group/t/check-for-ica-toward-epochs-rejection/2722/4 "2021-02-20T09:13:46Z")

</div>

> [@BaggioMarco](#):
>
> Regarding the ICA, I tried to replace the “fastica” with “picard” in my code but I received the error:  
> `ModuleNotFoundError: No module named 'picard'`

If you’re using `conda` (as suggested in the MNE installation instructions), you can install `picard` via

```
conda install -c conda-forge python-picard

```

Alternatively, you can install it via `pip`:

```
pip install python-picard

```

> [@BaggioMarco](#):
>
> By the ICA I try to reconstruct the signal in occurrence of eye blinks, while with the criteria added in the epoch section I just can obtain back the “seconds with no artifacts”.

To remove eye blinks, you’ll want to follow the following approach:

- epoch your data and run `ica.fit()` on your epochs to get the components
- go back to your raw data, identify eye blinks and create epochs around the blink events. MNE-Python can do this automatically for you using [`mne.preprocessing.create_eog_epochs()`](https://mne.tools/stable/generated/mne.preprocessing.create_eog_epochs.html)
- using the `ICA` fit you created in the first step, run [`ica.find_bads_eog()`](https://mne.tools/stable/generated/mne.preprocessing.ICA.html#mne.preprocessing.ICA.find_bads_eog) on the EOG epochs. This will return a list of ICs that appear to be related to ocular activity
- You can review the effects of excluding those components by adding them to `ica.exclude` and running `ica.plot_overlay()` on the averaged EOG epochs, i.e., `ica.plot_overlay(eog_epochs.average())`
- Run `ica.apply()` on your epochs to remove ocular artifacts.

If you’re brave & curious, you can have a look at [how we’re handling it in the MNE Study Template](https://github.com/mne-tools/mne-study-template/blob/7ce9a9e1e3d2b3df1f9e39df9e6c2acf0bc014ad/scripts/preprocessing/04a-run_ica.py#L255); but be warned, the code is slightly more complex than what I’ve explained above.

---

_[View the full topic](https://mne.discourse.group/t/check-for-ica-toward-epochs-rejection/2722)._
