Skip to content

Commit

Permalink
[plots|] lazily import matplotlib/scipy.stat (local import) (markovmo…
Browse files Browse the repository at this point in the history
  • Loading branch information
marscher authored Jul 1, 2016
1 parent 582e923 commit 3116931
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pyemma/plots/plots2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
from __future__ import absolute_import

import numpy as _np
from scipy.interpolate import griddata as gd

__author__ = 'noe'


def contour(x, y, z, ncontours = 50, colorbar=True, fig=None, ax=None, method='linear', zlim=None, cmap=None):
import matplotlib.pylab as _plt
from scipy.interpolate import griddata as gd
# check input
if (ax is None):
if ax is None:
if fig is None:
ax = _plt.gca()
else:
Expand Down
10 changes: 9 additions & 1 deletion pyemma/plots/thermoplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import numpy as _np
import matplotlib.pyplot as _plt
from pyemma.thermo import WHAM as _WHAM
from pyemma.thermo import DTRAM as _DTRAM
from pyemma.thermo import TRAM as _TRAM
Expand All @@ -28,6 +27,7 @@
'plot_convergence_info',
'plot_memm_implied_timescales']


def get_estimator_label(thermo_estimator):
if isinstance(thermo_estimator, _WHAM):
return "WHAM"
Expand All @@ -37,8 +37,10 @@ def get_estimator_label(thermo_estimator):
return "TRAM, lag=%d" % thermo_estimator.lag
return None


def plot_increments(thermo_estimator, ax=None):
# TODO: write docstring
import matplotlib.pyplot as _plt
if ax is None:
fig, ax = _plt.subplots()
else:
Expand All @@ -57,8 +59,10 @@ def plot_increments(thermo_estimator, ax=None):
ax.legend(loc=1, fancybox=True, framealpha=0.5)
return ax


def plot_loglikelihoods(thermo_estimator, ax=None):
# TODO: write docstring
import matplotlib.pyplot as _plt
if ax is None:
fig, ax = _plt.subplots()
else:
Expand All @@ -77,8 +81,10 @@ def plot_loglikelihoods(thermo_estimator, ax=None):
ax.legend(loc=1, fancybox=True, framealpha=0.5)
return ax


def plot_convergence_info(thermo_estimator, axes=None):
# TODO: write docstring
import matplotlib.pyplot as _plt
if axes is None:
fs = _plt.rcParams['figure.figsize']
fig, axes = _plt.subplots(2, 1, figsize=(fs[0], fs[1] * 1.5), sharex=True)
Expand All @@ -92,9 +98,11 @@ def plot_convergence_info(thermo_estimator, axes=None):
axes[0].set_xlabel('')
return axes


def plot_memm_implied_timescales(thermo_estimators,
ax=None, nits=None, therm_state=None, xlog=False, ylog=True, units='steps', dt=1.0, refs=None,
annotate=True, **kwargs):
import matplotlib.pyplot as _plt
colors = ['blue', 'red', 'green', 'cyan', 'purple', 'orange', 'violet']
# Check units and dt for user error.
if isinstance(units, list) and len(units) != 2:
Expand Down

0 comments on commit 3116931

Please sign in to comment.