Back to the main page.

Bug 2323 - read EDF does not use gain when negative

Status ASSIGNED
Reported 2013-10-15 15:33:00 +0200
Modified 2013-10-15 16:21:54 +0200
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P3 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Gio Piantoni - 2013-10-15 15:33:45 +0200

Hi, the header of the edf format contains information to transform from the integers stored in the file into the actual values. It uses 'physical maximum' and 'physical minimum', and 'digital maximum' and 'digital minimum'. See https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_edf.m#L155-L156 I have a dataset in which the Physical Maximum is smaller than the Physical Minimum (I cannot share it at the moment, due to permissions, also I don't know which software was used for the export). My interpretation is that when Physical Maximum is smaller than the Physical Minimum, then values should be multipled by -1. In fact, that seems the correct interpretation (although polarity is always ambiguous, the slow waves seem in the correct polarity after multiplication by -1). This seems to be the interpretation of the EDF format: http://www.edfplus.info/specs/edfplus.html at 2.1.3, point 5 "'Digital maximum' must be larger than 'Digital minimum'. In case of a negative amplifier gain the corresponding 'Physical maximum' is smaller than the 'Physical minimum'. " However, I noticed that FieldTrip "corrects" these values, and set the calibration to 1, by default. Twice in the code: https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_edf.m#L144-L148 https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_edf.m#L157-L159 I was wondering if this "correction" is necessary. From what I understand, this workaround has been in the code since the very beginning: https://github.com/fieldtrip/fieldtrip/blame/master/fileio/private/read_edf.m I can imagine the rationale (if Physical Maximum is smaller than the Physical Minimum, it's probably not meaningful), but this negative gain is meaningful at least in this dataset. What about removing these corrections in the code? Are there some side-effects that I've overlooked? Thanks