Repository navigation
Closed
Milestone
Description
Describe the bug
- Failure to import a particular Neuroscan .cnt file via
read_raw_cnt()due to out of bounds indexing incnt.pyline 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
Activity
agramfort commentedon Sep 7, 2018
@corscheid can you share one file with us? ideally a super tiny one?
corscheid commentedon Sep 7, 2018
Hi @agramfort, Thanks for the reply.
My colleague @deepagupta has more authority than I concerning our experiment data; she will be by shortly to respond.
deepagupta commentedon Sep 7, 2018
Dear @agramfort, Thank you for your response.
Unfortunately, we deeply regret that we can't share our CNT data file because we are trying to process it for research and may eventually publish from that. So, sharing won't be ethically right or in agreement with our collaborators.
However, we want to try our best to provide any other information if we can. For example, my teammate Corey posted the following error message:
Basically, we don't understand why mne python library is generating a stimulating channel and what are the numbers 900 and 75 in the equation below (file cnt.py at line#251):
We believe this must be the source of the issue. However, we can't be entirely sure.
agramfort commentedon Sep 8, 2018
@deepagupta we cannot debug without access to a test file. You can share one file privately with one of us. @larsoner @massich or myself.
if you find the fix it's even better. Then please send us a pull request
massich commentedon Sep 11, 2018
If you can came up with a simulated MWE that has
np.empty(mydata.shape)as data inside, that would be even better!fanyangxyz commentedon Feb 26, 2019
I also have an IndexError when importing raw CNT file. I can share the code and data, though not the same ones as the OP used, but hopefully it can help figuring out this issue.
Data is available at http://predict.cs.unm.edu/downloads.php. I'm using the OCD Flankers one in the second row. The code below assumes that file 914flankers.cnt in OCI Flankers/EEG Data is downloaded and saved in the local folder data/.
My code for loading the file is:
The error message I got is:
massich commentedon Mar 4, 2019
I've downloaded the file and I can reproduce the error
EDIT: Reading the paper, the montage should be
standard_1020notstandard_alphabetic. But the error remains.EDIT: The
'914flankers.cnt'contains positions, so it should be read withmontage=None