EDF+ Annotation Timestamps missing submillisecond accuracy
See original GitHub issueIt was noticed that the onset time for annotations in an EDF+ file might be missing the submillisecond accuracy accociated with the start time of the recording. This results in annotation timestamps being delayed from the true event time.
Expected results
The EDF+ file used here contains patient data and cannot be shared. However, if this bug is confirmed all EDF+ files will be affected.
If the EDF+ file is brought into EDFbrowser it will be noticed that the millisecond aspect of the start time is displayed in the Start
field:
For instance, this results in the annotation timestamps being:
Actual results
When loading the data into MNE the annotation timestamps return:
If you take the difference between the MNE timestamp and the EDFbrowser timestamp it is equal to the submillisecond portion of the recording start time.
Additional information
I reached out to Teunis van Beelen, the developer of EDFbrowser, to get an explanation. The explanation provided was as follows:
EDF does not have support for subsecond precision of the starttime but EDF+ does. Because EDF+ needed to be backwards compatible with EDF and EDF doesn’t have the possibility to write subsecond precision for the starttime into the header, the subsecond part of the starttime is written outside of the EDF header. The way the subsecond part of the starttime is stored in EDF+ is described here: https://www.edfplus.info/specs/edfplus.html#timekeeping
Teunis van Beelen provided a quote from the EDF specs:
“The startdate/time of a file is specified in the EDF+ header fields ‘startdate of recording’ and ‘starttime of recording’. These fields must indicate the absolute second in which the start of the first data record falls. So, the first TAL in the first data record always starts with +0.X2020, indicating that the first data record starts a fraction, X, of a second after the startdate/time that is specified in the EDF+ header. If X=0, then the .X may be omitted.”
In other words, the subsecond part of the starttime is written in the EDF Annotations “signal”.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
@greydongilmore this is because we haven’t integrated the new EDFlib version 1.17 yet (see https://github.com/holgern/pyedflib/pull/81)
I hope I find time soon to implement the changes.
@cbrnr interestingly though pyEDFlib is a python wrapper for EDFlib and it also shows the incorrect behavior… just tested