Repository navigation
EDFRawIO: treat annotations without a duration as events - #1968
Open
aaronkanzer wants to merge 1 commit into
Open
aaronkanzer wants to merge 1 commit into
aaronkanzer wants to merge 1 commit into
Conversation
pyedflib reports a missing annotation duration as -1. EDFRawIO only treated a duration of exactly 0 as an event, so every instantaneous EDF+ annotation ended up on the epoch channel with a duration of -1 s and the event channel stayed empty. The time window also used strict bounds, which dropped annotations at t=0, and event_count returned the total number of annotations for both channels.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In EDF+ files, most instantaneous annotations have no duration field, and pyedflib reports a missing duration as -1. EDFRawIO only treats a duration of exactly 0 as an event, so these annotations land on the "Epoch" channel with a duration of -1 s and the "Event" channel stays empty. Two smaller problems come with it:
event_countreturns the total number of annotations for both channels, so for a file with annotations neo's ownrawio_compliance.read_eventsfails with "Wrong shape 0, 3".Observed (0.14.6 and master):
Expected:
MNE reads the same file as
startandstimwith duration 0 andbaselinewith 1.5.Fix: classify an annotation as an event when its duration is <= 0 and as an epoch otherwise, make the window bounds inclusive, clamp negative durations when computing an annotation's end, and count events and epochs separately. A regression test builds the file with pyedflib. This is separate from the gain change in #1920, which touched the same file but not the annotation handling.