How to drop the epoch of specific event on epochs?

such as :slight_smile:
events_to_drop = [6, 10]
motor_epochs.pick(motor_epochs.events[:, 2]!= events_to_drop)

Please try at least to first skim through the documentation before opening a question on the forum.

https://mne.tools/stable/generated/mne.Epochs.html#mne.Epochs.drop

Mathieu

@mscheltienne I believe what @Annsas wants to do is drop all epochs with a certain event code; i.e., the epochs indices to be dropped (which are required by Epochs.drop()) are unknown.

Oops, I read that a bit too fast…
Anyway, between the attempt of selection based on epochs.events[:, 2] and the method Epochs.drop(), it’s very close.
One way to get the indices to drop:

idx = np.where(np.isin(motor_epochs.events[:, 2], (6, 10)))[0]

Mathieu

1 Like