-
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
BUG: Fix annotation rejection idx #12895
base: main
Are you sure you want to change the base?
BUG: Fix annotation rejection idx #12895
Conversation
- Keep bad annotations that end at the start sample (annotations that are potentialy one sample long): end = start - Do not discard bad annotations that are exactly one sample long: onset = end - Also discard last sample of bad annotation: end - start + 1
- Fix now broken tests - Add tests for annotations that are one sample long
for more information, see https://pre-commit.ci
Thanks for the PR!
Indeed, but that's where this private helper function comes in:
I suspect you will find |
Thank you for the helpful comment! So, I have been thinking about the function sfreq = 10
info = mne.create_info(1, sfreq, "eeg")
raw = mne.io.RawArray(np.random.RandomState(0).randn(1, 30 * sfreq), info)
annotations = Annotations([0], [10], ['BAD'], raw.info['meas_date'])
raw.set_annotations(annotations)
starts, stops = _annotations_starts_stops(raw, 'BAD')
print(starts, stops) 100 is in fact the last sample of the bad segment, so if I do The question is if we still want to go ahead with the change in |
Reference issue (if any)
Addresses #12893
What does this implement/fix?
As discussed in the issue above, I implemented a fix that implements the last sample of "bad" annotations in
raw.get_data
being rejected now as well.However, I noticed that some other functions, for example
filter
, have a similar behavior asget_data
before, where the last sample of the "bad" annotation is not rejected. This means that for consistent behavior, we should also adapt these functions accordingly, right?I'm happy about any other feedback and comments.
Changes