Skip to content

Conversation

@bruAristimunha
Copy link
Contributor

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

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.
Copy link
Member

@larsoner larsoner left a 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
Copy link
Member

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!)

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok ok.. doing

Copy link
Contributor Author

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

About iEEG Reader

2 participants