[Mne_analysis] EOG artifac correction with ICA

Hakonen Maria maria.hakonen at aalto.fi
Thu Aug 10 03:35:21 EDT 2017
Search archives:

Hi Denis,

Thank you for your advice!

The script seems to reject the components which have the highest correlation values when I increased the number of components to 64. I also increased the threshold, and now ICA seems to identify EOG related components correctly. I just first tested the script with low threshold since I wanted to see whether the script can identify more that one component (in the example they determined only the component with the highest correlation value but sometimes there may also be more than one EOG-related components).

Best,
Maria
________________________________________
Lähettäjä: mne_analysis-bounces at nmr.mgh.harvard.edu <mne_analysis-bounces at nmr.mgh.harvard.edu> käyttäjän Denis-Alexander Engemann <denis.engemann at gmail.com> puolesta
Lähetetty: 8. elokuuta 2017 17:15:23
Vastaanottaja: Discussion and support forum for the users of MNE Software
Aihe: Re: [Mne_analysis] EOG artifac correction with ICA

Hi Maria,

The many correlated components indicate that the ICA solution might be of poor quality.
Is there a reason why you use 25 components?
I'd recommend to use as many components as the number of orthogonal dimensions in your data, e.g. 64, depending on your SSS / maxfilter settings.
Also the score is quite low at 1.2. It will make you include many uninteresting components.
Maybe you want to give it a try and we have another look?

Denis

On Tue, 8 Aug 2017 at 15:01, Denis-Alexander Engemann <denis.engemann at gmail.com<mailto:denis.engemann at gmail.com>> wrote:
Hi Maria,

I'm currently traveling. I'll get back to you later.

Denis

On Sat, Aug 5, 2017 at 12:21 PM Maria Hakonen <maria.hakonen at gmail.com<mailto:maria.hakonen at gmail.com>> wrote:
Dear mne experts,

Could someone please help me with two questions related to the EOG artifact removal from raw MEG data with ICA?

I have created my script following this example: https://martinos.org/mne/stable/auto_tutorials/plot_artifacts_correction_ica.html?highlight=ica

I tested the script with one EOG channel and got the following result:

[ak_sentences16b_scores.png]

Question 1: Why are components 5 and 12 marked with red even if there are other components with stronger (although negative) correlation (e.g. 13 and 16)?

Thereafter, I tested the script with two EOG channels and got:
[ak_sentences16b_scores2.png]

Question 2: Why are the correlation values with EOG61 now different compared to the case when I only used EOG61 and not EOG62?

I am using mne 0.14.1.

Many thanks already in advance if you can help!

Best,
Maria

Here is yet the code that I am using (I have used low threshold value for testing purposes, but will use higher threshold, e.g. 3, in the final analysis):

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

import numpy as np

import mne

from mne.preprocessing import ICA
from mne.preprocessing import create_eog_epochs

subject = 'ak'
session = 'sentences16b'
data_path = '/m/nbe/scratch/braindata/mhhakone/intell/TaskIII/MEG-data/' + subject + '/'
raw_fname = data_path + subject + '_' + session + '_raw_tsss.fif'
raw = mne.io.read_raw_fif(raw_fname, preload=True)
raw.filter(1, 40, n_jobs=2)

picks_meg = mne.pick_types(raw.info<http://raw.info>, meg=True, eeg=False, eog=False,
                           stim=False, exclude='bads')

n_components = 25  # 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

# we will also set state of the random number generator - ICA is a
# non-deterministic algorithm, but we want to have the same decomposition
# and the same order of components each time this tutorial is run
random_state = 23

ica = ICA(n_components=n_components, method=method, random_state=random_state)
print(ica)

reject = dict(mag=5e-12, grad=4000e-13)
ica.fit(raw, picks=picks_meg, decim=decim, reject=reject)

#ica.save('my-ica.fif')

eog_average = create_eog_epochs(raw,ch_name='EOG 061', reject=dict(mag=5e-12, grad=4000e-13),
                                picks=picks_meg).average()

eog_epochs = create_eog_epochs(raw,ch_name='EOG 061',reject=reject)  # get single EOG trials
eog_inds, scores = ica.find_bads_eog(eog_epochs,ch_name='EOG 061',threshold=1.2)  # find via correlation

ica.plot_scores(scores, exclude=eog_inds)  # look at r scores of components
file_end='_scores.png'
filename = subject+'_'+session+file_end
plt.savefig(data_path+filename)
plt.close()

ica.plot_sources(eog_average, exclude=eog_inds)  # look at source time course
file_end='_sources.png'
filename = subject+'_'+session+file_end
plt.savefig(data_path+filename)
plt.close()

fig_list = ica.plot_properties(eog_epochs, picks=eog_inds, psd_args={'fmax': 35.},
                    image_args={'sigma': 1.})

for i in range(len(fig_list)):
    file_end='_properties_component'+str(i)+'.png'
    filename = subject+'_'+session+file_end
    fig_list[i].savefig(data_path+filename)

plt.close()

ica.plot_overlay(eog_average, exclude=eog_inds, show=False)
file_end='_overlay.png'
filename = subject+'_'+session+file_end
plt.savefig(data_path+filename)
plt.close()
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu<mailto:Mne_analysis at nmr.mgh.harvard.edu>
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu<mailto:Mne_analysis at nmr.mgh.harvard.edu>
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ak_sentences16b_scores.png
Type: image/png
Size: 22051 bytes
Desc: ak_sentences16b_scores.png
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170810/a2847cda/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ak_sentences16b_scores2.png
Type: image/png
Size: 33927 bytes
Desc: ak_sentences16b_scores2.png
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170810/a2847cda/attachment-0003.png 


More information about the Mne_analysis mailing list