Do not reject epochs but slices of data before epoching

Hello there and happy new year!

I was wondering if I can reject slices of raw data (by annocations, amplitude thresholds etc ) before these are actually chunked into to epochs. Actually I am interested in resting state potentials and not ERPs so epochs will be created based on equal (and overlapping) lengths of 4seconds using make_fixed_length_events.

For example I would like to reject some milliseconds before the user starts typing (lasting a specific duration). So I have created annotations with ‘bad’ label so that these will be rejected. But the problem is that for about every 4s that is my epochs the user will start typing eventually. Does that mean that all the epochs will be rejected?

Some sample code:

durations = [0.4] * 3
descriptions = [‘bad keypress’] * 3
my_annot = mne.Annotations(onset=[3, 5, 7], duration=durations, description=descriptions)
no_events = mne.make_fixed_length_events(raw, duration=4., overlap=1.6)
event_dict = {‘fixed’: 1}
epochs = mne.Epochs(raw, no_events, event_id=event_dict, preload=True)


  • MNE version: 0.22.0
  • operating system: Windows 10

not sure to follow but any epoch that overlap even partially with a bad annotation will be dropped