Skip to content

Commit

Permalink
FIX: Weak dep on mpl (mne-tools#5250)
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner authored and agramfort committed May 31, 2018
1 parent d7ec5c8 commit 14ab6b6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ The minimum required dependencies to run MNE-Python are:
- Python >= 2.7
- NumPy >= 1.8
- SciPy >= 0.12
- Matplotlib >= 1.3

For full functionality, some functions require:

- Matplotlib >= 1.3
- Mayavi >= 4.6
- Scikit-learn >= 0.15 (>= 0.18 recommended)
- NiBabel >= 2.1.0
- Pandas >= 0.13
Expand Down
24 changes: 13 additions & 11 deletions mne/tests/test_import_nesting.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from subprocess import Popen, PIPE

from mne.utils import run_tests_if_main, requires_version
from mne.utils import run_tests_if_main


run_script = """
Expand All @@ -22,35 +22,37 @@
and sys.modules[x] is not None)
bad = scipy_submodules - ok_scipy_submodules
if len(bad) > 0:
out.append('Found un-nested scipy submodules: %s' % list(bad))
out.append('scipy submodules: %s' % list(bad))
# check sklearn and others
_sklearn = _pandas = _nose = _mayavi = False
_sklearn = _pandas = _nose = _mayavi = _matplotlib = False
for x in sys.modules.keys():
if x.startswith('sklearn') and not _sklearn:
out.append('Found un-nested sklearn import')
out.append('sklearn')
_sklearn = True
if x.startswith('pandas') and not _pandas:
out.append('Found un-nested pandas import')
out.append('pandas')
_pandas = True
if x.startswith('nose') and not _nose:
out.append('Found un-nested nose import')
out.append('nose')
_nose = True
if x.startswith('mayavi') and not _mayavi:
out.append('Found un-nested mayavi import')
out.append('mayavi')
_mayavi = True
if x.startswith('matplotlib') and not _matplotlib:
out.append('matplotlib')
_matplotlib = True
if len(out) > 0:
print('\\n' + '\\n'.join(out), end='')
print('\\nFound un-nested imports for:\\n' + '\\n'.join(out), end='')
exit(1)
"""


@requires_version('scipy', '0.11') # old ones not organized properly
def test_module_nesting():
"""Test that module imports are necessary
"""
"""Test that module imports are properly nested."""
proc = Popen([sys.executable, '-c', run_script], stdout=PIPE, stderr=PIPE)
stdout, stderr = proc.communicate()
stdout = stdout.decode('utf-8')
if proc.returncode:
raise AssertionError(stdout)

Expand Down
5 changes: 3 additions & 2 deletions mne/viz/topo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#
# License: Simplified BSD

from copy import deepcopy
from functools import partial
from itertools import cycle
from copy import deepcopy
from matplotlib.colors import colorConverter

import numpy as np

from ..io.constants import Bunch
Expand Down Expand Up @@ -341,6 +341,7 @@ def _plot_timeseries(ax, ch_idx, tmin, tmax, vmin, vmax, ylim, data, color,
labels=None):
"""Show time series on topo split across multiple axes."""
import matplotlib.pyplot as plt
from matplotlib.colors import colorConverter
picker_flag = False
for data_, color_ in zip(data, color):
if not picker_flag:
Expand Down

0 comments on commit 14ab6b6

Please sign in to comment.