You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the way EDF+ implements the discontinuous extension, a naive EDF reader can still open the file but treats the signals as continuous. This is a potential footgun -- I only noticed it because the annotations referred to times that were much later than the concatenated signals referred to because the annotations assumed that the discontinuity was correctly handled.
The text was updated successfully, but these errors were encountered:
functionis_functionally_contiguous_after_start(file::EDF.File)
# EDF+ says: first annotations signal is such that the first# annotation in each list is the start time of the record
time_idx =findfirst(x ->isa(x, EDF.AnnotationsSignal), file.signals)
time_anns = file.signals[time_idx]
starts = [anns[1].onset_in_seconds for anns in time_anns.records]
# if the start of the next record is exactly seconds_per_record + the start of the previous record# then the file is "functionally" contiguousreturnall(==(file.header.seconds_per_record), diff(starts))
end
When this holds, the start may not be at the header's start, but after that all the records are contiguous and reading works. To get the signal start, you need
functionstart_offset(edf::EDF.File)
i =findfirst(s -> s isa EDF.AnnotationsSignal, edf.signals)
i ===nothing&&returnNanosecond(0)
annos = edf.signals[i]
# Shouldn't happen per the spec but who knows, nobody seems to care about the spec
(isempty(annos.records) ||isempty(first(annos.records))) &&returnNanosecond(0)
tal =first(first(annos.records))
returnNanosecond(tal.onset_in_seconds *1e9) # convert to ns since may be non-integerend
Then when mapping to Onda format, the header's start corresponds to the recording start, and the start_offset corresponds to the signal span's start.
Due to the way EDF+ implements the discontinuous extension, a naive EDF reader can still open the file but treats the signals as continuous. This is a potential footgun -- I only noticed it because the annotations referred to times that were much later than the concatenated signals referred to because the annotations assumed that the discontinuity was correctly handled.
The text was updated successfully, but these errors were encountered: