beacon-biosignals / EDF.jl

Read and write EDF files in Julia
MIT License
18 stars 5 forks source link

fix empty TAL handling #37

Closed jrevels closed 4 years ago

jrevels commented 4 years ago

So, it turns out empty strings are pretty dang important in EDF land.

Due to the way the EDF spec is worded (and the manner in which external EDF processors are implemented), TALs (even purely timestamped ones) must always contain at least one "annotation", even if it's an empty string. Another way of stating it: a totally empty TAL needs to end with \x14\x14\x00. Classic.

This fixes this with a fairly defensive approach: explicitly read in empty strings, and even if the annotations list is totally empty (which would indicated a malformed EDF, in a sense), make sure to write out the \x14\x14 that the EDF spec hungers for.