Skip to content

IndexError when importing raw CNT file #5493

@corscheid

Description

@corscheid

Describe the bug

  • Failure to import a particular Neuroscan .cnt file via read_raw_cnt() due to out of bounds indexing in cnt.py line 251
  • About half of our .cnt files work, half do not due to this error.

Steps and/or code to reproduce

from mne.io import read_raw_cnt

raw_fname = 'raw_eeg_data.cnt'
montage_fname = 'standard-10-5-cap385.elp'
raw = read_raw_cnt(raw_fname, montage=montage_fname, eog=('HEOG', 'VEOG'), emg=('EMG',), preload=True, verbose=True)

Expected results

  • raw variable successfully populated with a RawCNT object upon reading the .cnt file
  • no error message

Actual results

Traceback (most recent call last):
  File "/Users/corey/Documents/GitLab/01mne_python_automation/bin/source_localization.py", line 210, in <module>
    raw = read_raw_cnt(raw_fname, montage=montage_fname, eog=('HEOG', 'VEOG'), emg=('EMG',), preload=True, verbose=True)
  File "/anaconda3/envs/mne/lib/python3.6/site-packages/mne/io/cnt/cnt.py", line 95, in read_raw_cnt
    preload=preload, verbose=verbose)
  File "/anaconda3/envs/mne/lib/python3.6/site-packages/mne/io/cnt/cnt.py", line 361, in __init__
    data_format, date_format)
  File "/anaconda3/envs/mne/lib/python3.6/site-packages/mne/io/cnt/cnt.py", line 251, in _get_cnt_info
    stim_channel[event_time - 1] = event_id
IndexError: index 295313 is out of bounds for axis 0 with size 294560

Additional information

sys_info() :

Platform:      Darwin-17.7.0-x86_64-i386-64bit
Python:        3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:07:29)  [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
Executable:    /anaconda3/envs/mne/bin/python
CPU:           i386: 8 cores
Memory:        16.0 GB

mne:           0.16.2
numpy:         1.15.0 {blas=mkl_rt, lapack=mkl_rt}
scipy:         1.1.0
matplotlib:    2.2.2 {backend=MacOSX}

sklearn:       0.19.1
nibabel:       2.3.0
mayavi:        4.6.1 {qt_api=pyqt5}
pycuda:        Not found
skcuda:        Not found
pandas:        0.23.3

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions