automatic blink detection to produce a plot of EOG epochs

Hi everyone,
I am having trouble using automatic blink detection to produce a plot of EOG epochs and creating epochs for every blinks detected.
In general the code works very well, but I have a some of data where the plot that comes out is not what I expect.
In the cases that the code works well I have about 600 epochs and a nice curve in the plot. But in a lot of data it only detects 3 - 10 epochs and therefore the plots I get are very strange and noisy. (I’ve added some images for an example of a good plot vs an incorrect plot)

Could someone help me figure out why this happens and what I could try to solve this problem?

I personally don’t think something is wrong with this specific part of the code, but maybe somewhere else in the data. Does anybody have suggestions what I can try?

This is the part of the code that plots the EOG epochs


# Use automatic blink detection to produce a plot of EOG epochs
# Create epochs for every blinks detected
eog_epochs = mne.preprocessing.create_eog_epochs(raw_evented, baseline=(-0.5, -0.2))

# Show mean power in each blink epoch
eog_epochs.plot_image(combine="mean")

# Average of all epochs power of the mean power per epoch
eog_epochs.average().plot_joint() 

eog_epochs.plot()

And I am using:

  • Spyder version: 6.0.4 (standalone)
  • Python version: 3.11.11 64-bit
  • Qt version: 5.15.8
  • PyQt5 version: 5.15.9
  • Operating System: Windows-10-10.0.26100-SP0

Example of correct EOG mean plot:

Example of incorrect EOG mean plots:


Two things to try:

  1. Take a look at your EOG channels: did they make a good connection and is the signal looking clean?
  2. Check the raw data to see if there are segments of bad data (subject moving/talking) that need to be annotated first: Rejecting bad data spans and breaks — MNE 1.9.0 documentation

Have you tried adjusting the threshold via thresh=...? For some datasets, the default doesn’t work that well.

Richard

Thanks for your suggestion, I have been looking into the threshold but I could not find what kind of value would be appropriate. What unit is the threshold, and do you maybe have any recommendations on how I can determine the threshold value?

Hello, you’ll just have to play with the threshold and see what works with your data, at least that’s what I always did. Sorry I cannot provide better advice

Good luck,
Richard