Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight bad Epochs instead of dropping them when preload=False upon plotting #12253

Open
withmywoessner opened this issue Dec 1, 2023 · 1 comment
Labels

Comments

@withmywoessner
Copy link
Contributor

Describe the new feature or enhancement

Hello! I am currently working on a feature to drop Epoch based on callables in #12195, and thought it would be a nice feature to be able to see which Epochs would be dropped (since you may have complicated callables) if preload=False in the Epochs constructor.

Describe your proposed implementation

I think this could be implemented by displaying the rejected epochs instead of dropping them when plotting. For instance:

epochs = mne.Epochs(
    raw,
    events,
    tmin=-0.2,
    tmax=0.5,
    reject_tmax=0,
    reject=reject_criteria,
    flat=flat_criteria,
    reject_by_annotation=False,
    preload=False
)
epochs.plot()

Hypothetical output (Epochs in red will be dropped):
image

Describe possible alternatives

Maybe instead of this method. I can add another parameter, but I think this is too complicated.

Additional context

No response

@larsoner
Copy link
Member

larsoner commented Dec 1, 2023

Based on how Epochs works under the hood, I suspect this would be complicated to implement.

Another way to accomplish something similar using current API would be with something like

all_epochs = mne.Epochs(..., reject=None)
good_epochs = all_epochs.copy().drop_bad(reject=reject_criteria)
bad_epochs = all_epochs[np.setdiff1d(all_epochs.selection, good_epochs.selection)]
bad_epochs.plot()

It would only plot the bad ones but maybe it's good enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants