Skip to content
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

Add EGI as manufacturer #1006

Merged
merged 31 commits into from
Aug 1, 2022
Merged

Conversation

anandsaini024
Copy link
Contributor

Added EGI as a manufacturer in the eeg_manufacturers dict for extension '.bin' and '.mff'. This PR closes issue #1005.

Added EGI as a manufacturer in the eeg_manufacturers dict for extension '.bin' and '.mff'.
@welcome
Copy link

welcome bot commented May 13, 2022

Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴🏽‍♂️

mne_bids/config.py Outdated Show resolved Hide resolved
@adam2392
Copy link
Member

Can you add a change log entry and a unit test for writing?

Co-authored-by: Mathieu Scheltienne <mathieu.scheltienne@gmail.com>
@adam2392
Copy link
Member

Hey just checking in to see if you hit any snags.

I suspect if you add necessary dataset to here it should test the writing of this EGI data format:

test_eegieeg_data = [
('EDF', 'test_reduced.edf', _read_raw_edf),
('Persyst', 'sub-pt1_ses-02_task-monitor_acq-ecog_run-01_clip2.lay', _read_raw_persyst), # noqa
('NihonKohden', 'MB0400FU.EEG', _read_raw_nihon)
]

Not entirely sure tho. The tests definitely need a bit of organizing :p.

@anandsaini024
Copy link
Contributor Author

y just checking in to see if you hit any snags.

I suspect if you add necessary dataset to here it

Hey, was busy with something else in between. I will look at this tomorrow.

@sappelhoff sappelhoff changed the title Update config.py Add EGI as manufacturer May 25, 2022
Anand Saini and others added 2 commits May 25, 2022 13:50
test for the task - updated the manufacturers list by adding for EGI data files (.mff and .bin)
Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com>
@hoechenberger
Copy link
Member

@anandsaini024 It appears you'll have to amend allowed_extensions_meg in config.py

@mscheltienne
Copy link
Member

mscheltienne commented Jun 3, 2022

It's still going to fail because with this test file: '/Users/scheltie/mne_data/MNE-testing-data/EGI/test_egi.mff'
when doing: events, _ = mne.events_from_annotations(raw, event_id=None)
events is returned as an empty array array([], shape=(0, 3), dtype=int64)
while after conversion (write_raw_bids) and re-reading with raw2 = read_raw_bids(bids_path=bids_output_path)
the events returned with events2, _ = mne.events_from_annotations(raw2)
do have a single element.. array([[ 0, 0, 99999]]).

@hoechenberger
Copy link
Member

Oh my… why is this being so complicated? 🤯

@scott-huberty
Copy link
Contributor

Hi all, is this something that still needs work/help with? MNE-BIDS support for EGI files is something that has been on my radar, and @drammock this is a task I was going to propose for the code sprint.

@adam2392
Copy link
Member

Yes I think it will involve some refactoring of the unit tests

@mscheltienne
Copy link
Member

If you have time to finish this PR during the code sprint next week, it would be super appreciated! I can give you a hand if you want. For now, the issue I ran into 3 weeks ago is related to the conversion to the brain vision format. Take the code snippet below:

from mne.datasets import testing
from mne.io import read_raw_brainvision, read_raw_egi
from mne_bids import BIDSPath, write_raw_bids


directory = testing.data_path() / "EGI"
raw = read_raw_egi(directory / "test_egi.mff")

root="C:/Users/Mathieu/Downloads/tests/bids1"
bids_path = BIDSPath(
    subject="01", session="01", run="01", acquisition="01",
    task="testing", root=root)
write_raw_bids(raw, bids_path)
raw2 = read_raw_brainvision(bids_path.fpath)

The raw.annotations is empty while the loaded raw2.annotations contains one segment. Up to the call to pybv.write_brainvision, the raw.annotations is empty. So it's either the writer from pybv or the reader from mne that is responsible for this segment. I am not very familiar with the brainvision format, maybe @sappelhoff or @cbrnr you know where this segment is coming from?

@scott-huberty
Copy link
Contributor

Hey @mscheltienne , thanks! It would be great to briefly meet with you this week if you have some time, just so I can catch myself up and get a hold of the work that's been done already.

@sappelhoff
Copy link
Member

looks like a reasonable suggestion to me! Though maybe it warrants its own issue and accompanying PR.

@scott-huberty
Copy link
Contributor

looks like a reasonable suggestion to me! Though maybe it warrants its own issue and accompanying PR.

Sounds good! I will open an issue and begin working on a PR.

@codecov
Copy link

codecov bot commented Aug 1, 2022

Codecov Report

Merging #1006 (57833f7) into main (b90dde8) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1006   +/-   ##
=======================================
  Coverage   95.19%   95.19%           
=======================================
  Files          25       25           
  Lines        3787     3787           
=======================================
  Hits         3605     3605           
  Misses        182      182           
Impacted Files Coverage Δ
mne_bids/config.py 97.61% <ø> (ø)
mne_bids/write.py 97.14% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us.

@mscheltienne
Copy link
Member

@hoechenberger @sappelhoff @adam2392 Alright, this PR is (finally) green!
I had to add a version check for MNE 1.1 in the tests following mne-tools/mne-python#10851
Have a look and merge if happy :)

Thanks @scott-huberty for working on this one!

@mscheltienne
Copy link
Member

mscheltienne commented Aug 1, 2022

And by the way, test_eegieeg was a pain to work with. IMO, It's way too long and testing too many aspects in the same function.

@sappelhoff
Copy link
Member

And by the way, test_eegieeg was a pain to work with. IMO, It's way too long and testing too many aspects in the same function.

Yes 😞

Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

@anandsaini024 can you please leave a comment on #1028 with:

  • your full name
  • your ORCID (if you have one)
  • your affiliation (if you have one)

Copy link
Member

@hoechenberger hoechenberger left a comment

Choose a reason for hiding this comment

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

formatting change for improved readability

mne_bids/tests/test_write.py Outdated Show resolved Hide resolved
mne_bids/tests/test_write.py Outdated Show resolved Hide resolved
mne_bids/tests/test_write.py Outdated Show resolved Hide resolved
mne_bids/tests/test_write.py Outdated Show resolved Hide resolved
mne_bids/tests/test_write.py Outdated Show resolved Hide resolved
mne_bids/tests/test_write.py Outdated Show resolved Hide resolved
mne_bids/tests/test_write.py Outdated Show resolved Hide resolved
mne_bids/tests/test_write.py Outdated Show resolved Hide resolved
mne_bids/tests/test_write.py Outdated Show resolved Hide resolved
Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com>
@hoechenberger hoechenberger enabled auto-merge (squash) August 1, 2022 15:49
@hoechenberger hoechenberger merged commit 61bf111 into mne-tools:main Aug 1, 2022
@welcome
Copy link

welcome bot commented Aug 1, 2022

🎉 Congrats on merging your first pull request! 🥳 Looking forward to seeing more from you in the future! 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: 🚀 Done
Development

Successfully merging this pull request may close these issues.

7 participants