# remove epoch from Epochs class

**URL:** <https://mne.discourse.group/t/remove-epoch-from-epochs-class/4107>\
**Category:** Support & Discussions\
**Tags:** epochs\
**Created:** [December 10, 2021, 12:14am UTC](https://mne.discourse.group/t/remove-epoch-from-epochs-class/4107 "2021-12-10T00:14:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![indridi](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/indridi/32/1045_2.png) [@indridi](https://mne.discourse.group/u/indridi)\
**Post date:** [December 10, 2021, 12:14am UTC](https://mne.discourse.group/t/remove-epoch-from-epochs-class/4107/1 "2021-12-10T00:14:57Z")

</div>

- MNE version: 0.24

I have a little question regarding the `Epochs` collection. I generate `Epochs` using a command like

```python
epochs = mne.Epochs(raw, events, 1, baseline=(None,None), tmin=0,
                            tmax=2.0, reject=None,
                            preload=True, verbose=True)

```

I have one or few long events, and cut those down into a series of short epochs.  
I pre-process each epoch and find which ones have data that I do not want to use - this is more fine-grained than what is possible with the `reject` parameter.  
Now, I want to throw out my custom detected bad epochs. When I iterate over them, I get a numpy array with no time-reference - if I had start-stop time for each epoch, I could generate a ‘bad-xyz’ annotation, but can’t find out how.  
Since I one-to-many relationship between original events and epochs, the event\_id from `Epochs.next()` can’t be used.

There is certainly something I’m missing on how to reject an epoch from an `Epochs` object, after it has been generated, but I cannot find out what - does anyone have a clue for me?

---

<div class="post-metadata">

**Author:** ![sappelhoff](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sappelhoff/32/3276_2.png) [@sappelhoff](https://mne.discourse.group/u/sappelhoff)\
**Post date:** [December 10, 2021, 8:22am UTC](https://mne.discourse.group/t/remove-epoch-from-epochs-class/4107/2 "2021-12-10T08:22:37Z")

</div>

> When I iterate over them, I get a numpy array with no time-reference

the time reference for each of theses arrays is just `epochs.times`.

EDIT: Ah, I see now that you probably want to know where the respective epoch started and stopped **with respect to the original RAW data**. I recommend you look into Epochs.drop instead, as linked below.

Also, have you looked at [`Epochs.drop`](https://mne.tools/stable/generated/mne.Epochs.html?highlight=epochs#mne.Epochs.drop)?

---

<div class="post-metadata">

**Author:** ![indridi](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/indridi/32/1045_2.png) [@indridi](https://mne.discourse.group/u/indridi)\
**Post date:** [December 10, 2021, 9:22am UTC](https://mne.discourse.group/t/remove-epoch-from-epochs-class/4107/3 "2021-12-10T09:22:54Z")

</div>

> [@sappelhoff](#):
>
> …  
> Also, have you looked at [`Epochs.drop`](https://mne.tools/stable/generated/mne.Epochs.html?highlight=epochs#mne.Epochs.drop)?

when I said

> There is certainly something I’m missing

this is exactly what I meant 🙂 - I have not looked at Epochs.drop. I seem to have overseen it in the documentation (which I did read, although obviously not well enough.).  
It appears that `drop` does exactly what I was trying to do.

Thanks.
