Sensibly choosing the threshold value in find_bads_eog

  • MNE 1.0.dev0
  • Python 3.9
  • macOS 11.6.1

I’m trying to repair blinking artifacts in simulated data using two approaches: Manually rejecting independent components visually using ica.plot_sources as well as using find_bads_eog.

I’m aware of mne.simulation.add_eog, but don’t quite understand how to use it yet, so I took some sample eeg data (4 channels, 60 seconds, fs=200 Hz) and simply added some spikes at 10 second intervals to get the following:

If using triangle spikes to simulate blinks is unreasonable, please tell me.

I then filtered my data, computed the ICs and plotted them:

raw_filt = raw.load_data().filter(l_freq=1., h_freq=None)
ica = ICA(method='fastica',n_components=4)
ica.fit(raw_filt,picks='all')
ica.plot_sources(raw_filt, show=True,block=True,show_scrollbars=True)

I decided to reject ICA000 and ICA001, closed the window, and repaired the signal as follows:

excludes=ica.exclude
raw_repaired=ica.apply(raw.copy(),exclude=excludes)

I realize ica.plot.overlay can be used to visualize the original signals along with the repaired ones, but I just used mabplotlib instead with data coming from raw and raw_repaired. For the second channel Fp2, the raw (red) and raw_repaired (blue) looks like this:

Now, I tried to use find_bads_eog instead to get the rejected ICs

eog_idx, eog_scores=ica.find_bads_eog(raw_filt,ch_name=picks,measure='correlation',threshold=.7,reject_by_annotation=False)
excludes=eog_idx

This approach gives me a graph of raw and raw_repaired for the second channel similar to that above. The same is true if I use a threshold of .8. However, when the threshold is .9, no ICs are dropped–the red and blue graphs are essentially the same.

So, if I want to use ica.find_bads_eog to find blinking artifacts “automatically” in some reasonable way, are there heuristics for choosing the threshold sensibly? The documentation states, the threshold represents the “value above which a feature is classified as outlier,” but I’m not sure what feature is being referred to.