Skip to content

Commit

Permalink
MRG: Remove 2.6 (mne-tools#3530)
Browse files Browse the repository at this point in the history
* MAINT: Remove 2.6

* FIX: Fix tests

* FIX: Fix more tests [circle full]

* FIX: Do not install old broken mayavi
  • Loading branch information
larsoner authored and agramfort committed Aug 26, 2016
1 parent 1c11647 commit 019756b
Show file tree
Hide file tree
Showing 65 changed files with 236 additions and 1,307 deletions.
17 changes: 6 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@ env:
# Note that we don't run coverage on Py3k anyway because it slows our tests
# by a factor of 2 (!), so we make this our "from install dir" run.
#
# If we change the old-version run to be a different Python version
# from 2.6, then we need to update mne.utils.clean_warning_registry.
#
# Run one test (3.5) with a non-default stim channel to make sure our
# tests are explicit about channels.
#
# Must force libpng version to avoid silly libpng.so.15 error (MPL 1.1 needs it)
#
# Conda currently has packaging bug with mayavi/traits/numpy where 1.10 can't be used
# but breaks sklearn on install; hopefully eventually the NUMPY=1.9 on 2.7 full can be removed
# Mayavi=4.3 on old 2.7 installs, but doesn't work properly due to a traits bug
- PYTHON=2.7 DEPS=full TEST_LOCATION=src NUMPY="=1.9" SCIPY="=0.17"
- PYTHON=2.7 DEPS=nodata TEST_LOCATION=src MNE_DONTWRITE_HOME=true MNE_FORCE_SERIAL=true MNE_SKIP_NETWORK_TEST=1 # also runs flake8
- PYTHON=3.5 DEPS=full TEST_LOCATION=install MNE_STIM_CHANNEL=STI101
- PYTHON=2.6 DEPS=full TEST_LOCATION=src NUMPY="=1.7" SCIPY="=0.11" MPL="=1.1" LIBPNG="=1.5" SKLEARN="=0.11" PANDAS="=0.8"
- PYTHON=2.7 DEPS=full TEST_LOCATION=src NUMPY="=1.8" SCIPY="=0.12" MPL="=1.3" SKLEARN="=0.14" PANDAS="=0.12"
- PYTHON=2.7 DEPS=minimal TEST_LOCATION=src

# Setup anaconda
Expand Down Expand Up @@ -59,10 +57,10 @@ install:
conda install --yes --quiet $ENSURE_PACKAGES ipython;
else
conda install --yes --quiet $ENSURE_PACKAGES ipython==1.1.0 statsmodels pandas$PANDAS;
pip install -q nitime;
if [ "${PYTHON}" == "2.7" ]; then
conda install --yes --quiet $ENSURE_PACKAGES mayavi traits;
pip install -q pysurfer faulthandler;
pip install nitime faulthandler;
if [ "${NUMPY}" != "=1.8" ]; then
conda install --yes --quiet $ENSURE_PACKAGES mayavi$MAYAVI;
pip install pysurfer;
fi;
fi;
fi;
Expand All @@ -71,9 +69,6 @@ install:
pip install flake8 codespell numpydoc;
fi;
- pip install -q codecov nose-timer
- if [ "${PYTHON}" == "2.6" ]; then
pip install -q argparse;
fi;
# check our versions for the major packages
- NP_VERSION=`python -c 'import numpy; print(numpy.__version__)'`
- if [ -n "$NUMPY" ] && [ "${NUMPY:(-3)}" != "${NP_VERSION::3}" ]; then
Expand Down
15 changes: 7 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,16 @@ Dependencies

The minimum required dependencies to run the software are:

- Python >= 2.6
- NumPy >= 1.6
- SciPy >= 0.7.2
- matplotlib >= 0.98.4
- Python >= 2.7
- NumPy >= 1.8
- SciPy >= 0.12
- matplotlib >= 1.3

For full functionality, some functions require:

- scikit-learn >= 0.15
- nose >= 0.10
- nibabel >= 2.0.0
- pandas >= 0.7.3
- scikit-learn >= 0.18
- nibabel >= 2.1.0
- pandas >= 0.12

To use NVIDIA CUDA for resampling and FFT FIR filtering, you will also need
to install the NVIDIA CUDA SDK, pycuda, and scikits.cuda. See the
Expand Down
2 changes: 2 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,5 @@ doctest:

view:
@python -c "import webbrowser; webbrowser.open_new_tab('file://$(PWD)/_build/html/index.html')"

show: view
2 changes: 2 additions & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ API

5. Previously, if the filter was as long or longer than the signal of interest, direct FFT-based computations were used. Now a single code path (overlap-add filtering) is used for all FIR filters. This could cause minor changes in how short signals are filtered.

- Support for Python 2.6 has been dropped, and the minimum supported dependencies are NumPy_ 1.8, SciPy_ 0.12, and Matplotlib_ 1.3 by `Eric Larson`_

- When CTF gradient compensation is applied to raw data, it is no longer reverted on save of :meth:`mne.io.Raw.save` by `Eric Larson`_

- Adds :func:`mne.time_frequency.csd_epochs` to replace :func:`mne.time_frequency.csd_compute_epochs` for naming consistency. :func:`mne.time_frequency.csd_compute_epochs` is now deprecated and will be removed in mne 0.14, by `Nick Foti`_
Expand Down
5 changes: 1 addition & 4 deletions mne/beamformer/tests/test_dics.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from mne.beamformer import dics, dics_epochs, dics_source_power, tf_dics
from mne.time_frequency import csd_epochs
from mne.externals.six import advance_iterator
from mne.utils import run_tests_if_main, clean_warning_registry
from mne.utils import run_tests_if_main

# Note that this is the first test file, this will apply to all subsequent
# tests in a full nosetest:
Expand All @@ -29,9 +29,6 @@
label = 'Aud-lh'
fname_label = op.join(data_path, 'MEG', 'sample', 'labels', '%s.label' % label)

# bit of a hack to deal with old scipy/numpy throwing warnings in tests
clean_warning_registry()


def read_forward_solution_meg(*args, **kwargs):
fwd = mne.read_forward_solution(*args, **kwargs)
Expand Down
6 changes: 3 additions & 3 deletions mne/bem.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
#
# License: BSD (3-clause)

import sys
from functools import partial
import glob
import os
import os.path as op
import shutil
import glob
import sys

import numpy as np
from scipy import linalg

from .fixes import partial
from .utils import verbose, logger, run_subprocess, get_subjects_dir, warn
from .transforms import _ensure_trans, apply_trans
from .io import Info
Expand Down
3 changes: 2 additions & 1 deletion mne/channels/tests/test_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
import os.path as op

from copy import deepcopy
from functools import partial
import warnings

import numpy as np
from scipy.io import savemat
from numpy.testing import assert_array_equal
from nose.tools import assert_raises, assert_true, assert_equal

from mne.channels import rename_channels, read_ch_connectivity
from mne.channels.channels import _ch_neighbor_connectivity
from mne.io import read_info, Raw
from mne.io.constants import FIFF
from mne.fixes import partial, savemat
from mne.utils import _TempDir, run_tests_if_main
from mne import pick_types, pick_channels

Expand Down
6 changes: 3 additions & 3 deletions mne/channels/tests/test_montage.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def test_montage():
'Site Theta Phi\nFp1 -92 -72\nFp2 92 72\n'
'very_very_very_long_name -60 -51\n',
'346\n'
'EEG F3 -62.027 -50.053 85\n'
'EEG Fz 45.608 90 85\n'
'EEG F4 62.01 50.103 85\n',
'EEG\t F3\t -62.027\t -50.053\t 85\n'
'EEG\t Fz\t 45.608\t 90\t 85\n'
'EEG\t F4\t 62.01\t 50.103\t 85\n',
'eeg Fp1 -95.0 -31.0 -3.0\neeg AF7 -81 -59 -3\neeg AF3 -87 -41 28\n'
]
kinds = ['test.sfp', 'test.csd', 'test_mm.elc', 'test_m.elc', 'test.txt',
Expand Down
4 changes: 3 additions & 1 deletion mne/chpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# License: BSD (3-clause)

from functools import partial

import numpy as np
from scipy import linalg, fftpack

Expand All @@ -14,11 +16,11 @@
quat_to_rot, rot_to_quat)
from .utils import (verbose, logger, check_version, use_log_level,
_check_fname, warn)
from .fixes import partial

# Eventually we should add:
# hpicons
# high-passing of data during fits
# parsing cHPI coil information from acq pars, then to PSD if necessary


# ############################################################################
Expand Down
7 changes: 4 additions & 3 deletions mne/connectivity/spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#
# License: BSD (3-clause)

from ..externals.six import string_types
from functools import partial
from inspect import getmembers

import numpy as np
from scipy.fftpack import fftfreq

from .utils import check_indices
from ..fixes import tril_indices, partial, _get_args
from ..fixes import _get_args
from ..parallel import parallel_func
from ..source_estimate import _BaseSourceEstimate
from ..epochs import _BaseEpochs
Expand All @@ -18,6 +18,7 @@
_psd_from_mt_adaptive)
from ..time_frequency.tfr import morlet, cwt
from ..utils import logger, verbose, _time_mask, warn
from ..externals.six import string_types

########################################################################
# Various connectivity estimators
Expand Down Expand Up @@ -789,7 +790,7 @@ def spectral_connectivity(data, method='coh', indices=None, sfreq=2 * np.pi,

if indices is None:
# only compute r for lower-triangular region
indices_use = tril_indices(n_signals, -1)
indices_use = np.tril_indices(n_signals, -1)
else:
indices_use = check_indices(indices)

Expand Down
51 changes: 29 additions & 22 deletions mne/connectivity/tests/test_spectral.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import os
import warnings

import numpy as np
from numpy.testing import assert_array_almost_equal
from nose.tools import assert_true, assert_raises
from nose.plugins.skip import SkipTest
import warnings

from mne.fixes import tril_indices
from mne.connectivity import spectral_connectivity
from mne.connectivity.spectral import _CohEst

from mne import SourceEstimate
from mne.utils import run_tests_if_main, slow_test
from mne.filter import band_pass_filter

trans_bandwidth = 2.5
filt_kwargs = dict(filter_length='auto', fir_window='hamming', phase='zero',
l_trans_bandwidth=trans_bandwidth,
h_trans_bandwidth=trans_bandwidth)
warnings.simplefilter('always')


Expand All @@ -35,10 +37,6 @@ def _stc_gen(data, sfreq, tmin, combo=False):
@slow_test
def test_spectral_connectivity():
"""Test frequency-domain connectivity methods"""
# XXX For some reason on 14 Oct 2015 Travis started timing out on this
# test, so for a quick workaround we will skip it:
if os.getenv('TRAVIS', 'false') == 'true':
raise SkipTest('Travis is broken')
# Use a case known to have no spurious correlations (it would bad if
# nosetests could randomly fail):
np.random.seed(0)
Expand All @@ -55,10 +53,9 @@ def test_spectral_connectivity():
# simulate connectivity from 5Hz..15Hz
fstart, fend = 5.0, 15.0
for i in range(n_epochs):
with warnings.catch_warnings(record=True):
warnings.simplefilter('always')
data[i, 1, :] = band_pass_filter(data[i, 0, :],
sfreq, fstart, fend)
data[i, 1, :] = band_pass_filter(data[i, 0, :],
sfreq, fstart, fend,
**filt_kwargs)
# add some noise, so the spectrum is not exactly zero
data[i, 1, :] += 1e-2 * np.random.randn(n_times)

Expand Down Expand Up @@ -117,31 +114,40 @@ def test_spectral_connectivity():
if mode == 'multitaper':
upper_t = 0.95
lower_t = 0.5
else:
elif mode == 'fourier':
# other estimates have higher variance
upper_t = 0.8
lower_t = 0.75
else: # cwt_morlet
upper_t = 0.64
lower_t = 0.63

# test the simulated signal
if method == 'coh':
idx = np.searchsorted(freqs, (fstart + 1, fend - 1))
idx = np.searchsorted(freqs, (fstart + trans_bandwidth,
fend - trans_bandwidth))
# we see something for zero-lag
assert_true(np.all(con[1, 0, idx[0]:idx[1]] > upper_t))
assert_true(np.all(con[1, 0, idx[0]:idx[1]] > upper_t),
con[1, 0, idx[0]:idx[1]].min())

if mode != 'cwt_morlet':
idx = np.searchsorted(freqs, (fstart - 1, fend + 1))
idx = np.searchsorted(freqs,
(fstart - trans_bandwidth * 2,
fend + trans_bandwidth * 2))
assert_true(np.all(con[1, 0, :idx[0]] < lower_t))
assert_true(np.all(con[1, 0, idx[1]:] < lower_t))
assert_true(np.all(con[1, 0, idx[1]:] < lower_t),
con[1, 0, idx[1:]].max())
elif method == 'cohy':
idx = np.searchsorted(freqs, (fstart + 1, fend - 1))
# imaginary coh will be zero
assert_true(np.all(np.imag(con[1, 0, idx[0]:idx[1]]) <
lower_t))
check = np.imag(con[1, 0, idx[0]:idx[1]])
assert_true(np.all(check < lower_t), check.max())
# we see something for zero-lag
assert_true(np.all(np.abs(con[1, 0, idx[0]:idx[1]]) >
upper_t))

idx = np.searchsorted(freqs, (fstart - 1, fend + 1))
idx = np.searchsorted(freqs, (fstart - trans_bandwidth * 2,
fend + trans_bandwidth * 2))
if mode != 'cwt_morlet':
assert_true(np.all(np.abs(con[1, 0, :idx[0]]) <
lower_t))
Expand All @@ -153,10 +159,11 @@ def test_spectral_connectivity():
assert_true(np.all(con[1, 0, idx[0]:idx[1]] < lower_t))
idx = np.searchsorted(freqs, (fstart - 1, fend + 1))
assert_true(np.all(con[1, 0, :idx[0]] < lower_t))
assert_true(np.all(con[1, 0, idx[1]:] < lower_t))
assert_true(np.all(con[1, 0, idx[1]:] < lower_t),
con[1, 0, idx[1]:].max())

# compute same connections using indices and 2 jobs
indices = tril_indices(n_signals, -1)
indices = np.tril_indices(n_signals, -1)

if not isinstance(method, list):
test_methods = (method, _CohEst)
Expand Down
3 changes: 1 addition & 2 deletions mne/cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from .utils import (check_fname, logger, verbose, estimate_rank,
_compute_row_norms, check_version, _time_mask, warn,
copy_function_doc_to_method_doc)
from .fixes import in1d
from . import viz

from .externals.six.moves import zip
Expand Down Expand Up @@ -432,7 +431,7 @@ def compute_raw_covariance(raw, tmin=0, tmax=None, tstep=0.2, reject=None,
if picks is None:
# Need to include all channels e.g. if eog rejection is to be used
picks = np.arange(raw.info['nchan'])
pick_mask = in1d(
pick_mask = np.in1d(
picks, _pick_data_channels(raw.info, with_ref_meg=False))
else:
pick_mask = slice(None)
Expand Down
3 changes: 2 additions & 1 deletion mne/datasets/brainstorm/bst_auditory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#
# License: BSD (3-clause)

from functools import partial
import os.path as op

from ...utils import verbose
from ...fixes import partial
from ..utils import (has_dataset, _data_path, _get_version, _version_doc,
_data_path_doc)

Expand Down
2 changes: 1 addition & 1 deletion mne/datasets/brainstorm/bst_phantom_ctf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#
# License: BSD (3-clause)

from functools import partial
import os.path as op

from ...utils import verbose
from ...fixes import partial
from ..utils import (has_dataset, _data_path, _get_version, _version_doc,
_data_path_doc)

Expand Down
2 changes: 1 addition & 1 deletion mne/datasets/brainstorm/bst_phantom_elekta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#
# License: BSD (3-clause)

from functools import partial
import os.path as op

from ...utils import verbose
from ...fixes import partial
from ..utils import (has_dataset, _data_path, _get_version, _version_doc,
_data_path_doc)

Expand Down
3 changes: 2 additions & 1 deletion mne/datasets/brainstorm/bst_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#
# License: BSD (3-clause)

from functools import partial
import os.path as op

from ...utils import verbose
from ...fixes import partial
from ..utils import (has_dataset, _data_path, _get_version, _version_doc,
_data_path_doc)

Expand Down
Loading

0 comments on commit 019756b

Please sign in to comment.