mne.Epochs reject epochs even when reject=None

Hi there,

I am working with:

  • MNE version: e.g. 0.24.1
  • operating system: macOS Monterey (version 12.3.1) Apple M1

I am trying to epoch data from audiovisual stimuli that are long (60 seconds). I have only a few trials.

When using mne.Epochs I specify that I don’t want to reject any epochs but it still does it anyway, although it initially detects all the events it is supposed to. Very puzzling…

epoch = mne.Epochs(raw, events, event_id=event_id, tmin=-0.2, tmax=60,
                   proj=False, baseline=None, preload=True, reject=None,
                   flat=None)

Thanks for the help!

Do you have any annotations starting with “BAD”? There is another parameter reject_by_annotation=True, which rejects all segments containing any such annotations.

2 Likes

Hello @cpelofi and welcome to the forum!

You can use

epochs.plot_drop_log(ignore=[])

to get a visualization of how many epochs were dropped and for what reason.

I looked into it and I have no annotations in my data.
Thanks!

What is the result of the command @richard suggested (plot_drop_log)? We could try to keep guessing why it’s happening, but looking at the x axis labels in the plot will be easier :slight_smile: Once we know the reason, we can help you avoid it.

1 Like

I think the problem comes from the fact that I resample (from 1000 to 100 Hz) earlier in the pipeline and the the events samples are not accordingly changed. Therefore the tmax that I define for my epochs ends up being too long.
If I don’t resample it rejects only the last one for the same reason (I should have kept the data running a little longer before stopping the recording)

Please see the Warning box here, it explains exactly what you need to do:

https://mne.tools/stable/generated/mne.io.Raw.html#mne.io.Raw.resample

1 Like