[FieldTrip] edf signal amplitude different using ft_preprocessing and edfread

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Wed May 17 16:42:20 CEST 2023


Hoi Roy,

ft_preprocessing calls ft_read_data, which calls read_edf.

As far as I can see, on line 184, there’s a field created for the EDF variable called ‘Off’, which is not used later on, only the calibration info from EDF.Cal is used, around line 425.
Could it be that the non EEG channels typically have a non-zero Offset, (while for EEG channels this is (close to) 0)?

You could check this by inspecting the hdr.orig.Off field. 

If indeed the EDF.Off should be taken into account, this should be fixed around line 425 in the read_edf function. Could you make a PR with the suggested changes, which should include a test script and a link to some shared test data that we can use to confirm and document this.

Thanks and best wishes,
Jan-Mathijs
 

> On 17 May 2023, at 15:42, Roy Cox via fieldtrip <fieldtrip at science.ru.nl> wrote:
> 
> hi all,
> 
> We've encountered some unexpected signal values when reading edf files using ft_preprocessing.
> 
> It appears that, for certain signals, ft_preprocessing returns data with an undesired change in offset. The first figure shows the same signal read in using ft_preprocessing and Matlab's edfread. The next one shows the signal in the EDFbrowser app. I also compared to eeglab's biosig plugin (not shown). All signals are/appear identical, except for the one produced by FieldTrip.
> 
> Of note, this behavior so far seems to occur only for some non-EEG signals (e.g., accelerometer from zmax device), but I didn't test extensively.
> 
> Any thoughts as to what makes ft_preprocessing decide to change the offset (and/or scaling), when it will do so, and how to not make it do that? We'd like to import the raw data "as is" without alterations.
> 
> Best,
> Roy
> <ft_preprocessing_vs_edfread.PNG>
> <edfbrowser.PNG>
>  
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!7XRt4qGjC_6wBIpFow9LQ7YRgjA6b1eZ2l6-SF3uX7MwYvu2ljfYzPOR0jfGMpwPpVnpViCxlCr_QE1i5NRGH69JJQbS6ksdPP5IWg$ 




More information about the fieldtrip mailing list