[FieldTrip] Warning OPENEDF: Physical Minimum larger than Maximum\n

Lepauvre, Alex alex.lepauvre at ae.mpg.de
Thu Nov 19 14:00:54 CET 2020


Dear Simeon, deaf Fieldtrip community

Thanks a lot for your helpful feedback. To give you a little bit more context, our EDFs are from iEEG data.  I have been digging a little bit more into this issue with our data. First of all, it turns out that the warning isn’t thrown by the opnedEDF function, but by the read_edf.m one. It seems that in our files, the accessed PhysMin and PhysMax are reversed. Indeed, most values in the PhysMax are negative (-8711uV, except for some misc channels), while the PhysMin is the exact opposite (+8711), which seems to be the prime reason for this error.  I am not sure why that is the case. According to what you were saying @Simeon, this might be due to our EDF export software doing something odd with the headers? Can this harm our data?

Also, another aspect I am confused about is that we are currently using fieldtrip to chop our single big EDFs into smaller more manageable files. We therefore load the data triggering the warning, then chop them and adjust the headers, and save the chunks separately. However, when reloading the newly saved data, the warning isn’t there anymore, which has me worried that the data have been altered in some way.
After digging in the function write_edf a little bit more, I am supposing that the issue doesn’t appear anymore because fieldtrip compute the max and min amplitude of the signal, and fill it in in the PhyMax and PhysMin headers itself, correct?

Finally, another issue we are facing is that for some of our EDF files, the write_EDF function doesn’t work with some of our EDFs (I am unfortunately not allowed to share any data due to strong data privacy policies In our project, my apologies). While for some of our files it did work, for at least one, the write_edf returns the following error:
[cid:image001.jpg at 01D6BE7C.60ED60C0]

I again dived into the function write_edf and located the issue here:

[cid:image002.jpg at 01D6BE7C.60ED60C0]
I am not entirely sure what the purpose of these statements is. It seems to reduce the decimal places of the physical minimum (and then maximum) to find which approximation fits the expected size (8*nchans). However, none of the 5 options fit. Surprisingly enough, going one more would work: in my signal %-8.2g fits exactly nchans*8. I am not sure why that is the case nor what it would entail for my data if I were to change it in the code myself. Could someone enlighten me?

From: fieldtrip <fieldtrip-bounces at science.ru.nl> On Behalf Of Katarina Bendtz
Sent: Wednesday, 18 November 2020 20:20
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] Warning OPENEDF: Physical Minimum larger than Maximum\n

Dear Simeon!

Thank you so much for your quick reply! I understand!

Do you think I can safely ignore this or should I try to find out which channels this applies to? That is, if the trigger channels are set to identical values, will this in some way compromise/change the data?

best,
Kat



Katarina Bendtz, PhD
Research Fellow
Kreiman Lab
Boston Children's Hospital
Harvard University

+1 (617) 390 45 16
3 Blackfan Circle
Boston, USA




On Nov 18, 2020, at 1:22 PM, Simeon Wong <simeon.wong at sickkids.ca<mailto:simeon.wong at sickkids.ca>> wrote:

Hi Katarina,

The fread command advances the file pointer. Therefore the 4 lines are reading consecutive values from the EDF file.
https://www.mathworks.com/help/matlab/ref/fread.html?searchHighlight=fread&s_tid=doc_srchtitle#d122e421874:~:text=and%20positions%20the%20file%20pointer%20after%20the%20last%20value%20read

With that being said, some EDF export software (for better or for worse) set identical physical values if channels are switched off or for channels without physical units (ie. trigger channels or misc channels).




All the best,
Simeon


<Outlook-gb44xqtx.png>

Simeon Wong
Ibrahim Lab
Neurosciences & Mental Health

686 Bay Street, Toronto ON  M5G 0A4
P 416.813.7654  x303697


________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>> on behalf of Katarina Bendtz <katarina.bendtz at gmail.com<mailto:katarina.bendtz at gmail.com>>
Sent: November 18, 2020 12:50
To: fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl> <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Subject: [FieldTrip] Warning OPENEDF: Physical Minimum larger than Maximum\n

Dear experts:
Me and my colleague at another university idependently I get this warning when we try to open an edf file:

Warning OPENEDF: Physical
Minimum larger than Maximum\n



I’m using fieldtrip 2020113. Looking at the source code
https://github.com/fieldtrip/fieldtrip/blob/master/private/openedf.m<https://urldefense.com/v3/__https:/github.com/fieldtrip/fieldtrip/blob/master/private/openedf.m__;!!D0zGoin7BXfl!tHOzBhC87IDZICVPmzh1QeJQI1pBz7wzlyRm7uCUqe_WlgHxjVh2sShWYk0yjAhO9UAo$>

I read:

if (any(EDF.PhysMin >= EDF.PhysMax))

fprintf(2,'Warning OPENEDF: Physical Minimum larger than Maximum\n');

EDF.PhysMin = EDF.DigMin;

        EDF.PhysMax = EDF.DigMax;

end

but then a couple of lines up, I see both EDF.PhysMin and EDF.PhysMax, (and also EDF.DigMin and EDF.DigMax) being set to the same thing:

EDF.PhysMin= str2num(char(fread(EDF.FILE.FID,[8,EDF.NS],'char')'));
EDF.PhysMax= str2num(char(fread(EDF.FILE.FID,[8,EDF.NS],'char')'));
EDF.DigMin = str2num(char(fread(EDF.FILE.FID,[8,EDF.NS],'char')')); %
EDF.DigMax = str2num(char(fread(EDF.FILE.FID,[8,EDF.NS],'char')')); %

So it is quite reasonable that I will get this warning. I’m puzzled.

1. What’s purpose of this warning?
2. Why are the variables set to the same value?
3. Can I safely ignore this warning?
4. Or is there something I misunderstood.

Thanks a lot,

Best,
Kat



Katarina Bendtz, PhD
Research Fellow
Kreiman Lab
Boston Children's Hospital
Harvard University

+1 (617) 390 45 16
3 Blackfan Circle
Boston, USA




________________________________

This e-mail may contain confidential, personal and/or health information(information which may be subject to legal restrictions on use, retention and/or disclosure) for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies.
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201119/e54a7050/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 70309 bytes
Desc: image001.jpg
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201119/e54a7050/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 96343 bytes
Desc: image002.jpg
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201119/e54a7050/attachment-0003.jpg>


More information about the fieldtrip mailing list