-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fiff_open fails on a MAG4Health fif file #32
Comments
TL;DR: PR welcome to fix MNE-MATLAB!
There are PDFs but not very discoverable, so I opened mne-tools/fiff-constants#44 to at least get the ball rolling. Ideally we would autogenerate this using CIs but in the meantime it should at least help.
I think the relevant parts are starting on page #8 (12 in the PDF):
And
So maybe your suggestion:
I think yes if MNE-Python reads something, MNE-MATLAB should ideally read it the same way to the extent possible. MNE-Python emits a warning that it tried to read a tag (probably at the end of the file) but it was invalid, which I think is what I'd expect:
And yes I think it's also worth telling the MAG4Health folks that ideally the last tag in the file should have a
This part I'll let you decide but either way I'm glad you came out into the light for a bit 😆 |
Thanks for the feedback @larsoner! Also for the specs doc. If I read it well, there's a 'nil' pointer mentioned on page 7, which I take to be the FIFFV_NEXT_NONE constant? Either way, I created a PR that throws a warning, rather than an error. |
Yes I think thaht's FIFFV_NEXT_NONE |
Hi Eric @larsoner can I pick your brain a bit for the following (or otherwise please point me to whomever is more fit to be brainpicked about this). Vladimir @vlitvak reported an issue with reading a MAG4Health OPM fif-file in FieldTrip (which uses the mne-tools/mne-matlab code). Specifically, MNE-python and brainstorm seem to do just fine. The issue is referenced here:
fieldtrip/fieldtrip#2459
I looked into this a bit, and it turns out that the very last tag in the culprit file has a value of '0' in the 'next' field. This causes fiff_open to try and read beyond the end of the fif-file in the corresponding while loop (lines 95-103). The long story short seems to be that (also according to the FIFFV_NEXT_NONE constant, which is defined as -1) the code kind of expects to be able to escape the while loop when
tag.next==-1
at the end of a fif-file.I could confirm that all other fif-files I have lying around close by indeed have a
tag.next==-1
at the end of the file.I could not find online any chatter about the official way in which the end of a fif-file should be formatted, so I was wondering whether the referenced file is fif-invalid in its definition, and whether that should be brought to the attention of the Mag4health folks. Alternatively, I could of course put a small bandaid on the relevant piece of code and then crawl back into my cave to try and forget about the current state of the world.
The text was updated successfully, but these errors were encountered: