# epoch: reject\_criteria on a sliding window is it possible?

**URL:** <https://mne.discourse.group/t/epoch-reject-criteria-on-a-sliding-window-is-it-possible/6691>\
**Category:** Support & Discussions\
**Tags:** epochs\
**Created:** [April 7, 2023, 5:27pm UTC](https://mne.discourse.group/t/epoch-reject-criteria-on-a-sliding-window-is-it-possible/6691 "2023-04-07T17:27:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Student\_clem](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@Student\_clem](https://mne.discourse.group/u/Student_clem)\
**Post date:** [April 7, 2023, 5:27pm UTC](https://mne.discourse.group/t/epoch-reject-criteria-on-a-sliding-window-is-it-possible/6691/1 "2023-04-07T17:27:30Z")

</div>

hello!

I’m using mne for EEg data.  
My question is about the rejecting epoch. Here what I’m using now:

reject\_criteria = dict(eeg=150e-6)  
epochs = mne.Epochs(reref, events=allevents, event\_id=eventsdict, tmin=tmin, tmax=tmax, on\_missing=‘warn’, reject=reject\_criteria, preload=True, baseline=None, reject\_by\_annotation=True)

If I understood well the time window correspond to the time of my epoch. But i would like to reject on a sliding window of 300ms. Where could I put this information in my code??

Thank you so much for your help!

---

<div class="post-metadata">

**Author:** ![mainakjas](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mainakjas/32/34_2.png) [@mainakjas](https://mne.discourse.group/u/mainakjas)\
**Post date:** [April 7, 2023, 10:13pm UTC](https://mne.discourse.group/t/epoch-reject-criteria-on-a-sliding-window-is-it-possible/6691/2 "2023-04-07T22:13:40Z")

</div>

Hi Laure,

You might find this snippet code useful: [https://gist.github.com/jasmainak/e361f6eefd5a254cc32e423ae56e44ff](https://gist.github.com/jasmainak/e361f6eefd5a254cc32e423ae56e44ff)

It will create annotations and the annotations can be removed during the analysis. Hopefully that satisfies your purposes.

Best,  
Mainak
