-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
FIX: Montage Index error when importing CNT files #6025
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
Conversation
839b993 to
49098a1
Compare
Codecov Report
@@ Coverage Diff @@
## master #6025 +/- ##
==========================================
+ Coverage 81.3% 87.34% +6.03%
==========================================
Files 402 402
Lines 73181 73162 -19
Branches 12163 12159 -4
==========================================
+ Hits 59503 63904 +4401
+ Misses 11021 6411 -4610
- Partials 2657 2847 +190 |
e35487f to
f58a20f
Compare
|
Just for the record, testing with some confidential files + some files on the web running the following import mne
import pytest
import os.path as op
from datetime import datetime
from mne import __file__ as _mne_file
from mne.tests.test_annotations import _assert_annotations_equal
regular_path = op.join(op.dirname(_mne_file), '..', 'sandbox', 'data')
confidential_path = op.join(regular_path, 'confidential', 'cnt')
flankers_path = op.join(regular_path, '914flankers.cnt')
cnt_files_with_eeglab_pair = [
op.join(confidential_path, 'BoyoAEpic1_16bit.cnt'),
op.join(confidential_path, 'cont_67chan_resp_32bit.cnt'),
op.join(confidential_path, 'SampleCNTFile_16bit.cnt')
]
def test_ensure_meas_date(recwarn):
raw = mne.io.read_raw_cnt(flankers_path, montage=None,
date_format='dd/mm/yy')
meas_date = (datetime
.fromtimestamp(raw.info['meas_date'][0])
.strftime('%d/%m/%y %H:%M:%S'))
assert meas_date == '23/09/07 12:22:15'
@pytest.mark.parametrize('fname', cnt_files_with_eeglab_pair, ids=op.basename)
def test_check_cnt_eeglab_pairs(fname, recwarn):
raw_eeglab = mne.io.read_raw_eeglab(fname.replace('.cnt', '.set'),
montage=None)
raw_cnt = mne.io.read_raw_cnt(fname, montage=None)
assert raw_cnt.info.keys() == raw_eeglab.info.keys()
xx = object_diff(raw_cnt.info, raw_eeglab.info)
print(xx)I get:
['chs'][63]['cal'] type mismatch (<class 'numpy.ndarray'>, <class 'float'>)
['chs'][63]['coord_frame'] value mismatch (4, 0)
['chs'][63]['loc'] array mismatch
['chs'][63]['unit_mul'] type mismatch (<class 'float'>, <class 'int'>)
['subject_info'] type mismatch (<class 'dict'>, <class 'NoneType'>) |
massich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most probably I'm breaking something here.
56dc942 to
f08f77b
Compare
|
reading > stim_channel[event_time - 1] = event_id
E IndexError: index 583988 is out of bounds for axis 0 with size 582560in this PR: sandbox/mwe/5493_montage_index_error.py ✓ 100% ██████████
-------------------- generated xml file: /home/sik/code/mne-python/junit-results.xml --------------------
======================================= slowest 20 test durations =======================================
1.34s setup sandbox/mwe/5493_montage_index_error.py::test_foo
0.02s call sandbox/mwe/5493_montage_index_error.py::test_foo
(0.00 durations hidden. Use -vv to show these durations.)
Results (1.55s):
1 passed |
|
This PR goes after #6047 and misses whatsnew |
f08f77b to
50533ce
Compare
50533ce to
4f73d67
Compare
rootdir: /home/sik/code/mne-python, inifile: setup.cfg
plugins: timeout-1.3.3, sugar-0.9.2, mock-1.10.1, faulthandler-1.5.0, cov-2.6.1
timeout: 30.0s
timeout method: signal
timeout func_only: False
collecting ... 1526
sandbox/mwe/5493_montage_index_error.py ✓ 100% ██████████
--------------- generated xml file: /home/sik/code/mne-python/junit-results.xml ----------------
================================== slowest 20 test durations ===================================
1.29s setup sandbox/mwe/5493_montage_index_error.py::test_foo
0.01s call sandbox/mwe/5493_montage_index_error.py::test_foo
(0.00 durations hidden. Use -vv to show these durations.)
Results (1.62s):
1 passed
Compilation finished at Mon Mar 18 15:10:42It reads without error and recovers 1526 events |
|
thx @massich |
* Fix: use annotations to create the backward compatible events * Fix: use the dataformat to parse int32 annotations * update whats_new
Fixes #5493