Reading EDFs in Julia preserving floating point values

The EDF.jl currently has a limitation; namely, that it automatically converts signals into integers. This is exlicitly stated in the [official documentation:] (API · EDF.jl) under EDF.file.

I’m interested in reading EDF files but preserving floating points. Is there a way this can be done? I have not found other EDF packages.

Thanks in advance.

Can you provide a sample file somewhere?

EDF natively encodes values as Integers, so probably that is what EDF.jl is giving you. To get floats, you have to correct the values of each signal with respect to the physical/digital dimensions of that signal encoded in the header.
In general, it will be enough to do

scalling =  (physical_maximum - physical_minimum) / (digital_maximum - digital_minimum)
samples .*= scaling

Note that each signal can have different values for those.
Some people also perform offset correction to make the span of possible values centred around zero.


FYI, EDF.decode will do that decoding for you.


I was sure it should be there, but scanned the docs and missed that it is at the very bottom of the list.

Thank you, your answer hits the nail. However, the one by @ericphanson is more straightforward so I marked it as the solution for future readers. Thank you both!

1 Like