-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Implement the MEF3 support #13610
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
base: main
Are you sure you want to change the base?
Implement the MEF3 support #13610
Conversation
Add mne.io.read_raw_neo function that provides a generic interface to read electrophysiology data via the Neo library. Supports formats including Micromed TRC, Intan, Blackrock, Axon, Spike2, and more. Requires explicit neo_io_class parameter to specify the Neo IO class.
- Rename mne/io/neo/ to mne/io/micromed/ - Rename read_raw_neo to read_raw_micromed - Rename RawNeo to RawMicromed - Use Neo's MicromedIO directly for reading Micromed TRC files - Simplify API: remove neo_io_class parameter - Default channel type to sEEG for intracranial data - Assume data is in µV and convert to V (like RawNeuralynx)
- Add mne/io/mef/ module for MEF3 format support - Uses pymef library for reading .mefd directories - Default channel type to sEEG for intracranial data - Assume data is in µV and convert to V - Add API documentation and data formats table entry - Add changelog entry This completes BIDS iEEG format support alongside read_raw_micromed.
for more information, see https://pre-commit.ci
…a/mne-python into add-neo-io-support
larsoner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not look too deeply at the code, just a couple of preliminary comments to give you something to work on @bruAristimunha :)
Fix CI failure in Ultraslow_PG job where test collection fails with
"UNEXPECTED SKIP" due to pymef not being installed. The test_mef.py
file uses pytest.importorskip("pymef") at module level, which requires
the package to be present during collection.
Replace broad 'except Exception' with specific 'except KeyError' when reading channel TOC data. The pymef get_channel_toc method can only raise KeyError when 'segments' or 'TOC' keys are missing from channel metadata. This prevents silently swallowing unrelated bugs.
| deps -= recursive_deps | ||
| deps |= {"pip", "mamba", "nomkl"} | ||
| deps -= {"nest-asyncio2"} # not on CF yet | ||
| deps -= {"nest-asyncio2", "pymef"} # not on conda-forge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof this is not good... we want to add it to our installers if a read_raw_* depends on it. Are you up for adding it via grayskull (it's actually typically quite easy!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bruAristimunha do you want to work on this part? Usually it only takes a few minutes of actual work, then a few hours to get merged and CDNs to populate with the package so probably worth doing before merging this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok ok.. doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created and all green, waiting for CDNs
- Remove redundant @fill_doc decorator (verbose already calls fill_doc) - Remove unnecessary ts_channels skip check in test - Replace scales skip with assertion to verify test data has non-unit scaling
Reference issue (if any)
Fixes #13605
What does this implement/fix?
MEF3 .mefd Each recording consists of a .mefd directory.
Currently, we do not have support for MEF3. MEF3 is a data format supported in IEEG BIDS. With this implementation, we will have support for all possible formats: IEEG, EEG, EMG, FNRIS, and MEG! 😄
Additional information
Initially, I attempted to implement it using the Neo reader, but after much investigation, I realized it wasn't possible. Neo only supports a new format, which isn't compatible with BIDS. Fortunately, I found the pymef library that allows reading without many problems.
Following BIDS, and analogously to how we make at neuralynx, only allowing the reading of IEEG, which has the same frequency rate.
https://github.com/MEDFormat/MEDC/blob/main/MED%201.1%20Format%20Specification.pdf