Skip to content

Conversation

@massich
Copy link
Contributor

@massich massich commented Mar 4, 2019

Fixes #5493

@massich massich force-pushed the fix_montage_index_error branch from 839b993 to 49098a1 Compare March 4, 2019 17:10
@codecov
Copy link

codecov bot commented Mar 4, 2019

Codecov Report

Merging #6025 into master will increase coverage by 6.03%.
The diff coverage is 100%.

@@            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

@massich massich force-pushed the fix_montage_index_error branch 4 times, most recently from e35487f to f58a20f Compare March 8, 2019 18:46
@massich
Copy link
Contributor Author

massich commented Mar 11, 2019

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:

  • The date work properly,
  • the info difference between cnt and its transformed eeglab version are
    • the subject_info anonymization (eeglab is none cnt has empty fields)
    • digitization mismatch (but this is beeing addressed somwhere else)
    • for one file cnt has a trigger channel marked as bad that does not appear in the eeglab version of the file.
['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'>)

Copy link
Contributor Author

@massich massich left a 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.

@massich massich force-pushed the fix_montage_index_error branch 3 times, most recently from 56dc942 to f08f77b Compare March 13, 2019 12:41
@massich
Copy link
Contributor Author

massich commented Mar 13, 2019

reading 914flankers.cnt in master:

>               stim_channel[event_time - 1] = event_id
E               IndexError: index 583988 is out of bounds for axis 0 with size 582560

in 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

@massich
Copy link
Contributor Author

massich commented Mar 13, 2019

This PR goes after #6047 and misses whatsnew

@massich massich force-pushed the fix_montage_index_error branch from f08f77b to 50533ce Compare March 18, 2019 10:33
@massich massich marked this pull request as ready for review March 18, 2019 14:06
@massich massich force-pushed the fix_montage_index_error branch from 50533ce to 4f73d67 Compare March 18, 2019 14:06
@massich
Copy link
Contributor Author

massich commented Mar 18, 2019

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:42

It reads without error and recovers 1526 events

@agramfort agramfort merged commit f15e4bc into mne-tools:master Mar 18, 2019
@agramfort
Copy link
Member

thx @massich

jeythekey pushed a commit to jeythekey/mne-python that referenced this pull request Apr 27, 2019
* Fix: use annotations to create the backward compatible events

* Fix: use the dataformat to parse int32 annotations

* update whats_new
@massich massich deleted the fix_montage_index_error branch May 27, 2019 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants