How to save EDF+ with a break in data?

33 Views Asked by At

I'm implementing writing of EDF+ files with a possibility of a break in data gathering. The system provides a stream with samples (fixed sample rate) and their associated timestamps. I've studied the edflib, example EDF+ files as well as EDF+ specification but have not yet gathered a full understanding. The problem is that I have not found a single example EDF+ file with the data break that I could study.

The spec requires all signals to be saved in 1 second "data records", including "EDF Annotations" -signal. It also states that the first annotation of each "data record" is the start time TAL of the data record.

What I'm trying to figure out is how would I encode the "partial datarecords". Let's say that the recording is lost at time +3.2s, and recovered at +3.7s and signal sample rate is 100Hz. Would I record it as the following?

<EDF-header>
<100 samples><TAL:+0.0>
<100 samples><TAL:+1.0>
<100 samples><TAL:+2.0>
<100 samples, out of which last 80 are "dummy"><TAL:+3.0,Dur:0.2s>
<100 samples starting from 3.7s><TAL:+3.7>

Any help locating a valid example file are greatly appreciated!

Update 1:

Managed to produce an EDF+ file with short breaks. However at least EDFBrowser chokes on it giving error. If I add duration to the TAL, the check gives error:

Error when TAL has duration

If I leave the duration as -1, the check fails on next data record because the diff in onset is less than a second:

Error without duration

0

There are 0 best solutions below