[Mne_analysis] EOG artifac correction with ICA

Maria Hakonen maria.hakonen at gmail.com
Sat Aug 5 06:21:11 EDT 2017
Search archives:

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:





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:



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, 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()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170805/a2c675dc/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ak_sentences16b_scores.png
Type: image/png
Size: 22051 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170805/a2c675dc/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ak_sentences16b_scores2.png
Type: image/png
Size: 33927 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170805/a2c675dc/attachment-0003.png 


More information about the Mne_analysis mailing list