-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Warn if event sample number is out of bound for raw when creating Epochs #12989
Comments
I agree that it is worthwhile to warn users about an events array containing out-of-bound samples! I'd argue that warn + drop those epochs is the right approach, as opposed to warn instead of dropping those epochs (as you suggest). (EDIT: If I'm understanding your expected results correctly). This preserves current behavior (just makes users more aware of it), and prevents an epoch from being created where there is no data (as is the case for the last event in your events array). |
We could add a new We would have to make it clear that it only will emit a warning when the event sample in the events array is out of bounds (assuming that's what we indeed want). For example if I have equally spaced events starting at sample zero but |
@larsoner do you think there will be downstream side-effects in the case of |
Good question, and not 100% sure. I'm inclined to say we shouldn't warn in this case, we should just warn in the case that the zeroth sample number is outside the bounds. But as far as downstream side effects go emitting warnings is more of a dev problem than a user problem. Users are capable of ignoring such warnings easily :) For devs it will require some work to make it so that test suites that treat uncaught warnings as errors (like ours, mne-bids, mne-bids-pipeline, etc.) pass again, which will be annoying. But it seems worth it to help users not make mistakes. |
Description of the problem
When creating
Epochs
by providing anevents
array that contains sample numbers outside of the data, the respective epochs are dropped, but no warning is given that sample numbers are actually out of bounds.This can happen e.g. if
events
is in another sampling frequency asraw
or if events contains sample numbers beforefirst_sample
.related: https://mne.discourse.group/t/dropped-epochs-when-preload-true/2503
Steps to reproduce
Expected results
I would expect that MNE warns me that the
events
array contains sample numbers that are out of bounds, instead of marking them asbad
epochs.Actual results
Out of bounds epochs are dropped.
The text was updated successfully, but these errors were encountered: