beacon-biosignals / EDF.jl

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

improve robustness against mismatched file size vs. record count in header #35

Closed jrevels closed 3 years ago

jrevels commented 4 years ago

For example, with one EDF we have at Beacon, we had to load it via MNE:

julia> mne.io.read_raw_edf("recording.edf")
Extracting EDF parameters from /home/alex/Downloads/recording.edf...
EDF file detected
/home/alex/.local/lib/python3.6/site-packages/mne/io/edf/edf.py:1184: RuntimeWarning: Number of records from the header does not match the file size (perhaps the recording was not stopped before exiting). Inferring from the file size.
  verbose=verbose)
Setting channel info structure...
Creating raw.info structure...
PyObject <RawEDF | recording.edf, 15 x 318750 (1275.0 s), ~34 kB, data not loaded>

It seems that we should print a similar warning here and perform a similar fallback (I'm assuming if it's a common enough problem that MNE needed to implement a workaround, we probably should as well).

palday commented 4 years ago

Yep -- this can also happen with hardware that is shutdown before the software is exited.