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
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5cef045
Update config.py
anandsaini024 May 13, 2022
6c40258
Update mne_bids/config.py
anandsaini024 May 13, 2022
52cbb37
egi manufacturer addition test
May 25, 2022
328b080
Merge branch 'mne-tools:main' into egi_manufacturer
anandsaini024 May 25, 2022
f70f1f2
egi manufacturer addition test - style edit
anandsaini024 May 25, 2022
cfb16b2
reader and allowed_extensions for egi
May 25, 2022
124b7e9
Merge branch 'egi_manufacturer' of https://github.com/anandsaini024/m…
May 25, 2022
f037ed8
Merge branch 'main' into egi_manufacturer
Jun 3, 2022
d42b19d
remove .mff as both EGI reader set the filename with the .bin path
mscheltienne Jun 3, 2022
c93323f
remove useless f-string formating
mscheltienne Jun 3, 2022
0071fc4
add raw.orig_format case to tests
mscheltienne Jun 3, 2022
9bc7d52
remove .bin from allowed_extensions
mscheltienne Jun 3, 2022
70bf82d
add '.bin' to file extension that have to be converted
mscheltienne Jun 3, 2022
cab56be
fix indent
mscheltienne Jun 3, 2022
753c798
Merge branch 'main' into egi_manufacturer
mscheltienne Jun 25, 2022
4f96f58
take into account the 2 possible orig_format depending on mne version
mscheltienne Jun 30, 2022
d708197
set in so that a annotation is not written into bids compliant bra…
scott-huberty Jul 20, 2022
1d7c9d2
Merge branch 'egi_manufacturer' of https://github.com/anandsaini024/m…
scott-huberty Jul 20, 2022
9cc68d1
Merge branch 'main' into egi_manufacturer
mscheltienne Jul 20, 2022
fc32c9e
account for warning emitted because of data format
mscheltienne Jul 20, 2022
f0324f0
Merge branch 'main' into egi_manufacturer
mscheltienne Jul 30, 2022
b0c6bbd
Merge branch 'main' into egi_manufacturer
adam2392 Aug 1, 2022
20e2f4e
Merge branch 'main' into egi_manufacturer
mscheltienne Aug 1, 2022
1846264
ignore warning for missing emg channel location
mscheltienne Aug 1, 2022
93182aa
fix style
mscheltienne Aug 1, 2022
b156620
try regex
mscheltienne Aug 1, 2022
bc34f0b
remove loaded montage
mscheltienne Aug 1, 2022
47b56e8
handle mne >= 1.1 in tests where the format for EGI files is the supp…
mscheltienne Aug 1, 2022
b139f88
last one?
mscheltienne Aug 1, 2022
8a33ca0
add entry to changelog
mscheltienne Aug 1, 2022
57833f7
Apply suggestions from code review
mscheltienne Aug 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mne_bids/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
'.set': 'n/a', '.fdt': 'n/a',
'.lay': 'Persyst', '.dat': 'Persyst',
'.EEG': 'Nihon Kohden',
'.cnt': 'Neuroscan', '.CNT': 'Neuroscan'}
'.cnt': 'Neuroscan', '.CNT': 'Neuroscan',
'.bin': 'EGI'}

ieeg_manufacturers = {'.vhdr': 'Brain Products', '.eeg': 'Brain Products',
'.edf': 'n/a', '.EDF': 'n/a', '.set': 'n/a',
Expand All @@ -73,6 +74,7 @@
'.set': io.read_raw_eeglab, '.lay': io.read_raw_persyst,
'.EEG': io.read_raw_nihon,
'.cnt': io.read_raw_cnt, '.CNT': io.read_raw_cnt,
'.bin': io.read_raw_egi,
'.snirf': io.read_raw_snirf}


Expand Down Expand Up @@ -124,7 +126,7 @@
ALLOWED_INPUT_EXTENSIONS = \
allowed_extensions_meg + allowed_extensions_eeg + \
allowed_extensions_ieeg + allowed_extensions_nirs + \
['.lay', '.EEG', '.cnt', '.CNT']
['.lay', '.EEG', '.cnt', '.CNT', '.bin']

# allowed suffixes (i.e. last "_" delimiter in the BIDS filenames before
# the extension)
Expand Down
7 changes: 7 additions & 0 deletions mne_bids/tests/test_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,15 @@ def fn(fname, *args, **kwargs):
_read_raw_nihon = _wrap_read_raw(mne.io.read_raw_nihon)
_read_raw_cnt = _wrap_read_raw(mne.io.read_raw_cnt)
_read_raw_snirf = _wrap_read_raw(mne.io.read_raw_snirf)
_read_raw_egi = _wrap_read_raw(mne.io.read_raw_egi)

# parametrized directory, filename and reader for EEG/iEEG data formats
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),
('CNT', 'scan41_short.cnt', _read_raw_cnt),
('EGI', 'test_egi.mff', _read_raw_egi),
]
test_convert_data = test_eegieeg_data.copy()
test_convert_data.append(('CTF', 'testdata_ctf.ds', _read_raw_ctf))
Expand Down Expand Up @@ -1228,6 +1230,11 @@ def test_eegieeg(dir_name, fname, reader, _bids_validate, tmp_path):
match='Encountered data in "int" format. '
'Converting to float32.'):
bids_output_path = write_raw_bids(**kwargs)
elif dir_name == 'EGI':
with pytest.warns(RuntimeWarning,
match=r'Encountered data in "(float|single)" '
'format. Converting to float32.'):
Copy link
Member

Choose a reason for hiding this comment

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

I'm not entirely sure if this is the correct way to use the match with a regex pattern, but it's required after mne-tools/mne-python#10851 which fixes the orig_format for EGI datasets.

Copy link
Member

Choose a reason for hiding this comment

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

I think that will work? You can also include a .* after the disjunct if you want the pattern to fit on one line.

Copy link
Member

Choose a reason for hiding this comment

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

I didn't like the idea to match everything of whatever length ;)

bids_output_path = write_raw_bids(**kwargs)
else:
with pytest.warns(RuntimeWarning,
match='Encountered data in "double" format'):
Expand Down
2 changes: 1 addition & 1 deletion mne_bids/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ def _write_raw_brainvision(raw, bids_fname, events, overwrite):
# ensuring that int16 can represent the data in original units.
if raw.orig_format != 'single':
warn(f'Encountered data in "{raw.orig_format}" format. '
f'Converting to float32.', RuntimeWarning)
'Converting to float32.', RuntimeWarning)

# Writing to float32 µV with 0.1 resolution are the pybv defaults,
# which guarantees accurate roundtrip for values >= 1e-7 µV
Expand Down