Handle EGI MFF files with multiple epochs
See original GitHub issuemne.io.read_raw_egi
does not properly process MFF files with multiple epochs. In the worst case, the function returns, but the events are misaligned with respect to the data. In the best case, the function raises an exception as events are created beyond the end of the recording as below. The event start times need to be adjusted to account for any time gaps between the epochs.
data = mne.io.read_raw_egi('test.mff')
Reading EGI MFF Header from test.mff...
Reading events ...
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-2-b23e6b31e949> in <module>()
----> 1 data = mne.io.read_raw_egi('test.mff')
/Users/roh17004/anaconda3/lib/python3.6/site-packages/mne/io/egi/egi.py in read_raw_egi(input_fname, montage, eog, misc, include, exclude, preload, channel_naming, verbose)
/Users/roh17004/anaconda3/lib/python3.6/site-packages/mne/utils.py in verbose(function, *args, **kwargs)
727 with use_log_level(verbose_level):
728 return function(*args, **kwargs)
--> 729 return function(*args, **kwargs)
730
731
/Users/roh17004/anaconda3/lib/python3.6/site-packages/mne/io/egi/egi.py in read_raw_egi(input_fname, montage, eog, misc, include, exclude, preload, channel_naming, verbose)
164 if input_fname.endswith('.mff'):
165 return _read_raw_egi_mff(input_fname, montage, eog, misc, include,
--> 166 exclude, preload, channel_naming, verbose)
167 return RawEGI(input_fname, montage, eog, misc, include, exclude, preload,
168 channel_naming, verbose)
/Users/roh17004/anaconda3/lib/python3.6/site-packages/mne/io/egi/egimff.py in _read_raw_egi_mff(input_fname, montage, eog, misc, include, exclude, preload, channel_naming, verbose)
/Users/roh17004/anaconda3/lib/python3.6/site-packages/mne/utils.py in verbose(function, *args, **kwargs)
727 with use_log_level(verbose_level):
728 return function(*args, **kwargs)
--> 729 return function(*args, **kwargs)
730
731
/Users/roh17004/anaconda3/lib/python3.6/site-packages/mne/io/egi/egimff.py in _read_raw_egi_mff(input_fname, montage, eog, misc, include, exclude, preload, channel_naming, verbose)
258 """
259 return RawMff(input_fname, montage, eog, misc, include, exclude,
--> 260 preload, channel_naming, verbose)
261
262
/Users/roh17004/anaconda3/lib/python3.6/site-packages/mne/io/egi/egimff.py in __init__(self, input_fname, montage, eog, misc, include, exclude, preload, channel_naming, verbose)
/Users/roh17004/anaconda3/lib/python3.6/site-packages/mne/utils.py in verbose(function, *args, **kwargs)
727 with use_log_level(verbose_level):
728 return function(*args, **kwargs)
--> 729 return function(*args, **kwargs)
730
731
/Users/roh17004/anaconda3/lib/python3.6/site-packages/mne/io/egi/egimff.py in __init__(self, input_fname, montage, eog, misc, include, exclude, preload, channel_naming, verbose)
278
279 logger.info(' Reading events ...')
--> 280 egi_events, egi_info = _read_events(input_fname, egi_info)
281 gains = _get_gains(op.join(input_fname, egi_info['info_fname']))
282 if egi_info['value_range'] != 0 and egi_info['bits'] != 0:
/Users/roh17004/anaconda3/lib/python3.6/site-packages/mne/io/egi/events.py in _read_events(input_fname, info)
30 for n, event in enumerate(event_codes):
31 for i in mff_events[event]:
---> 32 events[n][i] = n + 1
33 return events, info
34
IndexError: index 413166 is out of bounds for axis 0 with size 413096
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
[Eeglablist] importing events from mff files
Background: we're trying to import events from EGI mff files. I'm aware of several eeglab and fieldtrip-related options for importing mff ...
Read more >Importing data from EEG devices — MNE 1.1.1 documentation
Renaming BrainVision files can be problematic due to their multi-file structure. ... EGI MFF (.mff)#. EGI MFF files can be read with mne.io.read_raw_egi()...
Read more >Getting started with EGI/Philips data - FieldTrip toolbox
Introduction to the EGI file formats ... Data sets containing multiple epochs are exported by NetStation as ... Meta File Format (mff).
Read more >EEGLAB Extensions
EEGLAB can download and install Eplugins directly from the File → Manage EEGLAB ... MFFMATLABIO: Import/export files from/to the EGI company in MFF...
Read more >Conducting ERP study using EGI's system
It will automatically handle many complex timing issues for you, ... Eyeblink very near stim, within the epoch window ... Click MFF File...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@larsoner Yes, I have a first pass at a fix, but it fails some
preload=False
test cases. I will take another look at getting this integrated and passing.Ahh right forgot about that, thanks @rhancockn . That should be good enough for at least developing a solution for people to test in the meantime.