beacon-biosignals / EDF.jl

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

Write onsets and durations with more decimal digits #72

Open ericphanson opened 12 months ago

ericphanson commented 12 months ago

Both Onset and Duration can contain a dot ('.') but only if the fraction of a second is specified (up to arbitrary accuracy).

https://www.edfplus.info/specs/edfplus.html#tal

We are currently subjecting our onsets and durations to the strict 8-char limitation of EDF headers, but that does not seem necessary.

Note this is mostly orthogonal to #70, since that PR does not use scientific notation in TALs anyway (but it does allow underflow-to-zero there, which we can get rid of this way).

ericphanson commented 12 months ago

I've realized this totally contradicts the docstring of TimestampAnnotatedList which explicitly rounds for supposed EDF+ compliance. However I keep trying to find where in the spec it says these onsets and durations must be 8 ascii characters and fail to do so. Would love some help @ararslan

ericphanson commented 12 months ago

This does not help with my actual bug (#74) although I do think we should make sure small durations / onsets are supported. IMO that doesn't need to write them in full precision like this PR though.

ericphanson commented 12 months ago

I incorporated this into https://github.com/beacon-biosignals/EDF.jl/pull/75, there choosing 100ms precision matching EDFlib. But we could allow more precision there too.