mne.preprocessing.find_eog_events sometimes gives the time of the start of blink and not peak?

mne version 1.3.1
operating system Windows10

Hello, I am using mne.preprocessing.find_eog_events to detect and reject eyeblinks in the data. In some subjects however, it marks the data before the start of the blink and not at the peak. Images attached as example. Below is some of the code I used detect the eog events:

mne_alleeg.set_eeg_reference('average')
mne_alleeg.filter(l_freq=0.3, h_freq=40, picks=['eeg','eog']) 

### regress Eyeblink artifact
thresh = (max([max(mne_alleeg.get_data()[0]),max(mne_alleeg.get_data()[1]),max(mne_alleeg.get_data()[2])]) -  min([min(mne_alleeg.get_data()[0]),min(mne_alleeg.get_data()[1]),min(mne_alleeg.get_data()[2])])) /100
eog_events = mne.preprocessing.find_eog_events(mne_alleeg, event_id=998,  thresh=thresh) #(myevents[0,0]/250)-1 ch_name = 'EOGh',  

#check that the threshold is good for each sub
mne.viz.plot_raw(mne_alleeg, events=eog_events,   event_color='cyan',  n_channels=30)
#make eog epochs
eog_epochs = mne.preprocessing.create_eog_epochs(mne_alleeg,  thresh=thresh)
eog_evoked = eog_epochs.average("all")
eog_evoked.plot("all")

Yeah, it sometimes does that. It tries its best to detect the onset properly, but not always gets it right, especially when there are saccades and stuff.

1 Like

In these cases, you probably need some manual labor to mark stretches of time to ignore, by for example making a copy of the raw data specifically for EOG onset detection and annotating segments on that copy with a label starting with “BAD” for anything you want the detection algorithm to ignore.

1 Like

Thanks for your answer! TI’m okay with doing some manual labor, except I’m not really sure what to mark as bad? What pattern would cause the eyeblinks to be detected at the beginning instead of at the peak?