remove epoch from Epochs class

  • MNE version: 0.24

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

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?

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?

when I said

There is certainly something I’m missing

this is exactly what I meant :slight_smile: - 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.

1 Like