mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.7k stars 1.31k forks source link

FIX: various failing tests #729

Closed dengemann closed 11 years ago

dengemann commented 11 years ago

@Eric89GXL @agramfort

We've got various failing tests on the current master: Some of them might be due to my recent numpy experiments, however the sparse plot and the SSP were be confirmed by @duskglow who just tried to get the tests running on a Xubuntu 13.04 machine -- (thanks for reporting!).

======================================================================
ERROR: Test resample (with I/O and multiple files)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/dengemann/python/mne-python/mne/fiff/tests/test_raw.py", line 606, in test_resample
    raw_resamp.resample(sfreq * 2, n_jobs=2)
  File "/Users/dengemann/python/mne-python/mne/utils.py", line 347, in dec
    return function(*args, **kwargs)
  File "/Users/dengemann/python/mne-python/mne/fiff/raw.py", line 775, in resample
    new_data[ri][sp] = data_chunk[sp][:, stim_inds]
IndexError: too many indices
-------------------- >> begin captured stdout << ---------------------
Opening raw data file /Users/dengemann/python/mne-python/mne/fiff/tests/data/test_raw.fif...
    Read a total of 3 projection items:
        PCA-v1 (1 x 102)  idle
        PCA-v2 (1 x 102)  idle
        PCA-v3 (1 x 102)  idle
Current compensation grade : 0
    Range : 25800 ... 40199 =     42.956 ...    66.930 secs
Ready.
Reading 0 ... 14399  =      0.000 ...    23.974 secs...
[done]

--------------------- >> end captured stdout << ----------------------
-------------------- >> begin captured logging << --------------------
mne: INFO: Opening raw data file /Users/dengemann/python/mne-python/mne/fiff/tests/data/test_raw.fif...
mne: INFO:     Read a total of 3 projection items:
mne: INFO:         PCA-v1 (1 x 102)  idle
mne: INFO:         PCA-v2 (1 x 102)  idle
mne: INFO:         PCA-v3 (1 x 102)  idle
mne: INFO: Current compensation grade : 0
mne: INFO:     Range : 25800 ... 40199 =     42.956 ...    66.930 secs
mne: INFO: Ready.
mne: INFO: Reading 0 ... 14399  =      0.000 ...    23.974 secs...
mne: INFO: [done]
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: Test SSP computation on raw
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/dengemann/python/mne-python/mne/tests/test_proj.py", line 174, in test_compute_proj_raw
    raw_resamp.resample(raw.info['sfreq'] * 2, n_jobs=2)
  File "/Users/dengemann/python/mne-python/mne/utils.py", line 347, in dec
    return function(*args, **kwargs)
  File "/Users/dengemann/python/mne-python/mne/fiff/raw.py", line 775, in resample
    new_data[ri][sp] = data_chunk[sp][:, stim_inds]
IndexError: too many indices
-------------------- >> begin captured stdout << ---------------------
Opening raw data file /Users/dengemann/python/mne-python/mne/tests/../fiff/tests/data/test_raw.fif...
    Read a total of 3 projection items:
        PCA-v1 (1 x 102)  idle
        PCA-v2 (1 x 102)  idle
        PCA-v3 (1 x 102)  idle
Current compensation grade : 0
    Range : 25800 ... 40199 =     42.956 ...    66.930 secs
Ready.
Reading 0 ... 14399  =      0.000 ...    23.974 secs...
[done]
Adding average EEG reference projection.
Created an SSP operator (subspace dimension = 4)
4 projection items activated
16 matching events found
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Too few samples (required : 1840 got : 1456), covariance estimate may be unreliable
Adding projection: planar-Raw-0.000-2.500-PCA-01
Adding projection: axial-Raw-0.000-2.500-PCA-01
2 projection items activated
Writing ...
[done]
Adding average EEG reference projection.
Created an SSP operator (subspace dimension = 6)
6 projection items activated
6 matching events found
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Too few samples (required : 1840 got : 1446), covariance estimate may be unreliable
Adding projection: planar-Raw-0.000-2.500-PCA-01
Adding projection: axial-Raw-0.000-2.500-PCA-01
2 projection items activated
Overwriting existing file.
Writing ...
[done]
Adding average EEG reference projection.
Created an SSP operator (subspace dimension = 8)
8 projection items activated
2 matching events found
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Too few samples (required : 1840 got : 1084), covariance estimate may be unreliable
Adding projection: planar-Raw-0.000-2.500-PCA-01
Adding projection: axial-Raw-0.000-2.500-PCA-01
2 projection items activated
Writing ...
[done]
Adding average EEG reference projection.
Created an SSP operator (subspace dimension = 10)
10 projection items activated
1 matching events found
Applying baseline correction ... (mode: mean)
Applying baseline correction ... (mode: mean)
Too few samples (required : 1840 got : 1142), covariance estimate may be unreliable
Adding projection: planar-Raw-0.000-2.500-PCA-01
Adding projection: axial-Raw-0.000-2.500-PCA-01
2 projection items activated
Writing ...
[done]
Too few samples (required : 1885 got : 1501), covariance estimate may be unreliable
Adding projection: planar-Raw-0.000-2.499-PCA-01
Adding projection: axial-Raw-0.000-2.499-PCA-01
2 projection items activated
Writing ...
[done]

--------------------- >> end captured stdout << ----------------------
-------------------- >> begin captured logging << --------------------
mne: INFO: Opening raw data file /Users/dengemann/python/mne-python/mne/tests/../fiff/tests/data/test_raw.fif...
mne: INFO:     Read a total of 3 projection items:
mne: INFO:         PCA-v1 (1 x 102)  idle
mne: INFO:         PCA-v2 (1 x 102)  idle
mne: INFO:         PCA-v3 (1 x 102)  idle
mne: INFO: Current compensation grade : 0
mne: INFO:     Range : 25800 ... 40199 =     42.956 ...    66.930 secs
mne: INFO: Ready.
mne: INFO: Reading 0 ... 14399  =      0.000 ...    23.974 secs...
mne: INFO: [done]
mne: INFO: Adding average EEG reference projection.
mne: INFO: Created an SSP operator (subspace dimension = 4)
mne: INFO: 4 projection items activated
mne: INFO: 16 matching events found
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: WARNING: Too few samples (required : 1840 got : 1456), covariance estimate may be unreliable
mne: INFO: Adding projection: planar-Raw-0.000-2.500-PCA-01
mne: INFO: Adding projection: axial-Raw-0.000-2.500-PCA-01
mne: INFO: 2 projection items activated
mne: INFO: Writing ...
mne: INFO: [done]
mne: INFO: Adding average EEG reference projection.
mne: INFO: Created an SSP operator (subspace dimension = 6)
mne: INFO: 6 projection items activated
mne: INFO: 6 matching events found
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: WARNING: Too few samples (required : 1840 got : 1446), covariance estimate may be unreliable
mne: INFO: Adding projection: planar-Raw-0.000-2.500-PCA-01
mne: INFO: Adding projection: axial-Raw-0.000-2.500-PCA-01
mne: INFO: 2 projection items activated
mne: INFO: Overwriting existing file.
mne: INFO: Writing ...
mne: INFO: [done]
mne: INFO: Adding average EEG reference projection.
mne: INFO: Created an SSP operator (subspace dimension = 8)
mne: INFO: 8 projection items activated
mne: INFO: 2 matching events found
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: WARNING: Too few samples (required : 1840 got : 1084), covariance estimate may be unreliable
mne: INFO: Adding projection: planar-Raw-0.000-2.500-PCA-01
mne: INFO: Adding projection: axial-Raw-0.000-2.500-PCA-01
mne: INFO: 2 projection items activated
mne: INFO: Writing ...
mne: INFO: [done]
mne: INFO: Adding average EEG reference projection.
mne: INFO: Created an SSP operator (subspace dimension = 10)
mne: INFO: 10 projection items activated
mne: INFO: 1 matching events found
mne: INFO: Applying baseline correction ... (mode: mean)
mne: INFO: Applying baseline correction ... (mode: mean)
mne: WARNING: Too few samples (required : 1840 got : 1142), covariance estimate may be unreliable
mne: INFO: Adding projection: planar-Raw-0.000-2.500-PCA-01
mne: INFO: Adding projection: axial-Raw-0.000-2.500-PCA-01
mne: INFO: 2 projection items activated
mne: INFO: Writing ...
mne: INFO: [done]
mne: WARNING: Too few samples (required : 1885 got : 1501), covariance estimate may be unreliable
mne: INFO: Adding projection: planar-Raw-0.000-2.499-PCA-01
mne: INFO: Adding projection: axial-Raw-0.000-2.499-PCA-01
mne: INFO: 2 projection items activated
mne: INFO: Writing ...
mne: INFO: [done]
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: Test plotting of (sparse) source estimates
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/dengemann/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/testing/decorators.py", line 146, in skipper_func
    return f(*args, **kwargs)
  File "/Users/dengemann/python/mne-python/mne/tests/test_viz.py", line 176, in test_plot_sparse_source_estimates
    subjects_dir=subjects_dir)
  File "/Users/dengemann/python/mne-python/mne/viz.py", line 1652, in plot_source_estimates
    views=views)
TypeError: __init__() got an unexpected keyword argument 'views'

======================================================================
FAIL: Test computation of EOG SSP projectors
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/dengemann/python/mne-python/mne/preprocessing/tests/test_ssp.py", line 68, in test_compute_proj_eog
    assert_equal(len(w), 0)
AssertionError: 2 != 0
    '2 != 0' = '%s != %s' % (safe_repr(2), safe_repr(0))
    '2 != 0' = self._formatMessage('2 != 0', '2 != 0')
>>  raise self.failureException('2 != 0')

-------------------- >> begin captured logging << --------------------
mne: INFO: Opening raw data file /Users/dengemann/python/mne-python/mne/preprocessing/tests/../../fiff/tests/data/test_raw.fif...
mne: INFO:     Read a total of 3 projection items:
mne: INFO:         PCA-v1 (1 x 102)  idle
mne: INFO:         PCA-v2 (1 x 102)  idle
mne: INFO:         PCA-v3 (1 x 102)  idle
mne: INFO: Current compensation grade : 0
mne: INFO:     Range : 25800 ... 40199 =     42.956 ...    66.930 secs
mne: INFO: Ready.
mne: INFO: Reading 0 ... 14399  =      0.000 ...    23.974 secs...
mne: INFO: [done]
mne: INFO: Including 3 SSP projectors from raw file
mne: INFO: Adding average EEG reference projection.
mne: INFO: Running EOG SSP computation
mne: INFO: EOG channel index for this subject is: [375]
mne: INFO: Filtering the data to remove DC offset to help distinguish blinks from saccades
mne: INFO: Now detecting blinks and generating corresponding events
mne: INFO: Number of EOG events detected : 3
mne: INFO: Computing projector
mne: INFO: Adding average EEG reference projection.
mne: INFO: Created an SSP operator (subspace dimension = 4)
mne: INFO: 4 projection items activated
mne: INFO: 3 matching events found
mne: INFO: No baseline correction applied...
mne: INFO: No baseline correction applied...
mne: INFO: No baseline correction applied...
mne: INFO: 0 bad epochs dropped
mne: INFO: Adding projection: planar-998--0.200-5.000-PCA-01
mne: INFO: Adding projection: planar-998--0.200-5.000-PCA-02
mne: INFO: Adding projection: axial-998--0.200-5.000-PCA-01
mne: INFO: Adding projection: axial-998--0.200-5.000-PCA-02
mne: INFO: Adding projection: eeg-998--0.200-5.000-PCA-01
mne: INFO: Adding projection: eeg-998--0.200-5.000-PCA-02
mne: INFO: Done.
mne: INFO: Including 3 SSP projectors from raw file
mne: INFO: Adding average EEG reference projection.
mne: INFO: Running EOG SSP computation
mne: INFO: EOG channel index for this subject is: [375]
mne: INFO: Filtering the data to remove DC offset to help distinguish blinks from saccades
mne: INFO: Now detecting blinks and generating corresponding events
mne: INFO: Number of EOG events detected : 3
mne: INFO: Computing projector
mne: INFO: Adding average EEG reference projection.
mne: INFO: Created an SSP operator (subspace dimension = 4)
mne: INFO: 4 projection items activated
mne: INFO: 3 matching events found
mne: INFO: No baseline correction applied...
mne: INFO:     Rejecting  epoch based on GRAD : ['MEG 2443']
mne: INFO: No baseline correction applied...
mne: INFO:     Rejecting  epoch based on GRAD : ['MEG 2443']
mne: INFO: No baseline correction applied...
mne: INFO:     Rejecting  epoch based on GRAD : ['MEG 2443']
mne: INFO: 3 bad epochs dropped
--------------------- >> end captured logging << ---------------------

======================================================================
FAIL: Test 2-way anova
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/dengemann/python/mne-python/mne/stats/tests/test_parametric.py", line 61, in test_f_twoway_rm
    assert_true(((0 <= pvals) & (1 >= pvals)).all())
AssertionError: False is not true
    'False is not true' = self._formatMessage('False is not true', "%s is not true" % safe_repr(False))
>>  raise self.failureException('False is not true')
larsoner commented 11 years ago

I don't get those errors, must be due to version differences. I'm running stock Ubuntu 13.04, though, so I wouldn't expect many differences. The plotting error (related to views) has to do with the PySurfer version not being version 0.4. I suppose we could add some version checking for backward compatibility. The other stuff, I don't know what it would be offhand.

dengemann commented 11 years ago

The plotting error (related to views) has to do with the PySurfer version not being version 0.4. I suppose we could add some version checking for backward compatibility.

@Eric89GXL this is funky: I'm running the current git master and the same command works when run manually in a regular IPython session but fails in the test / the debugger.

larsoner commented 11 years ago

Sounds like there is something amiss with your installation paths.

larsoner commented 11 years ago

Just ran on a different machine (newer self-complied Numpy, Scipy, and sklearn) and the only error I get is this one:

======================================================================
FAIL: Test ICA data raw buffer rejection
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/larsoner/custombuilds/mne-python/mne/preprocessing/tests/test_ica.py", line 49, in dec
    ret = function(*args, **kwargs)
  File "/home/larsoner/custombuilds/mne-python/mne/preprocessing/tests/test_ica.py", line 400, in test_ica_reject_buffer
    assert_true(len(log) == 1)
AssertionError: False is not true
    'False is not true' = self._formatMessage('False is not true', "%s is not true" % safe_repr(False))
>>  raise self.failureException('False is not true')
dengemann commented 11 years ago

I think this is good to close for now. Currently all seems fine. @duskglow let me know once you're back on this.