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: