Option to preselect dropped epochs in interactive epochs plot

Dear all,

is there a way to plot an entire epochs object (including ‘bad’ epochs) but with bad epochs already being marked red? So is there a way to prespecify a selection of epochs when calling the plot() function that will then be plotted in red as if one had already left-clicked on them in the plot?

Normally, all epochs that were marked as bad in the drop_log are omitted when plotting. When I then plot the epoch object, I can mark additional epochs as bad (by left clicking) which will then be colored red and I can also reverse this by left clicking again. However, I would like to see the omitted epochs inbetween that were dropped in earlier steps as well and potentially also be able to take them into the selection again (so to delete the “bad” mark).

I am using MNE version 1.5.1 on a Windows-10 os.

It feels like somebody would have asked this or a similiar question already or that it might be mentioned in the documentation but I wasn’t able to find it. So my apologies if I have missed it. Thank you very much in advance!

Best regards,
Mathis

Hello @MathisJording, to my knowledge, bad epochs are dropped immediately. So … there simply isn’t any data to plot! Hence, I’m afraid what you’re asking for is simply not possible in MNE-Python at the moment. Sorry!

Best wishes,
Richard

Hi @richard!

too bad but thanks a lot for the answer! Should I find some kind of workaround I will post it here.

Best
Mathis

1 Like

I’ve been wanting to do the same thing! While I haven’t yet devised a solution but what got me close is make a copy of the epochs and compare what it has against the epochs object with bads dropped. You can then plot the copied version with colors for what was dropped, but then you have to manually re-select the rejected epochs.

@mscheltienne Would it be possible to pass a list of indices for “bad” epochs to mne-qt-browser, such as:

epochs = mne.Epochs(...)
epochs_bad_idx = [0, 10, 35]
epochs.plot(bads= epochs_bad_idx)

and pre-select those indices as “bad”?

And then to take it a step further, how about a drop_bads_on_close parameter:

epochs_bad_idx_new = epochs.plot(bads=epochs_bad_idx, drop_bads_on_close=False)

… just brainstorming here …

Sounds good to me, we just need to find which variable stores internally those “bad” epochs on-the-fly. I don’t have the time to look at it this week, could you open an issue to keep track?

1 Like