Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network plots #236

Merged
merged 18 commits into from
May 4, 2022
4 changes: 2 additions & 2 deletions deeptime/covariance/util/_moments.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
using the dot product on sliced arrays (option 2). Exceptions are when the
data is extremely sparse, such that only a few columns are selected.
* Copying and subselecting columns (option 3) is only faster than the full
dot product (option 1), if 50% or less columns are selected. This observation
dot product (option 1), if 50% or fewer columns are selected. This observation
is roughly independent of N.
* The observations above are valid for matrices (T x N) that are sufficiently
large. We assume that "sufficiently large" means that they don't fully fit
Expand All @@ -66,7 +66,7 @@
number of constant column candidates drops below the minimum number, to
avoid wasting time on the decision.
3. Subselect the desired columns and copy the data to a new array X0 (Y0).
4. Run operation on the new array X0 (Y0), including in-place substraction
4. Run operation on the new array X0 (Y0), including in-place subtraction
of the mean if needed.

"""
Expand Down
3 changes: 2 additions & 1 deletion deeptime/decomposition/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
vamp_score_cv

cvsplit_trajs
blocksplit_trajs

deep.TVAEEncoder
deep.koopman_matrix
Expand All @@ -76,7 +77,7 @@
deep.kvad_score
"""

from ._score import vamp_score, vamp_score_data, vamp_score_cv, cvsplit_trajs
from ._score import vamp_score, vamp_score_data, vamp_score_cv, cvsplit_trajs, blocksplit_trajs
from ._tica import TICA
from ._vamp import VAMP
from ._koopman import TransferOperatorModel, CovarianceKoopmanModel
Expand Down
2 changes: 1 addition & 1 deletion deeptime/markov/msm/_markov_state_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ def correlation(self, a, b=None, maxtime=None, k=None, ncv=None):
>>> times, acf = M.correlation(a)
>>>
>>> import matplotlib.pylab as plt # doctest: +SKIP
>>> plt.plot(times, acf) # doctest: +SKIP
>>> plt.plot(times,acf) # doctest: +SKIP
"""
# input checking is done in low-level API
# compute number of tau steps
Expand Down
5 changes: 5 additions & 0 deletions deeptime/plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
plot_ck_test
plot_energy2d
Energy2dPlot

plot_adjacency
plot_markov_model
Network
"""

from .implied_timescales import plot_implied_timescales
from .chapman_kolmogorov import plot_ck_test
from .energy import plot_energy2d, Energy2dPlot
from .network import Network, plot_adjacency, plot_markov_model
1 change: 1 addition & 0 deletions deeptime/plots/chapman_kolmogorov.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def n_tests(self):
return len(self._tests)


@plotting_function()
def plot_ck_test(data: ChapmanKolmogorovTest, height=2.5, aspect=1.,
conf: float = 0.95, color=None, grid: CKTestGrid = None, legend=True,
xlabel='lagtime (steps)', ylabel='probability', y01=True, sharey=True, **plot_kwargs):
Expand Down
14 changes: 13 additions & 1 deletion deeptime/plots/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@


class Energy2dPlot:
r""" The result of a :meth:`plot_energy2d` call.
r""" The result of a :meth:`plot_energy2d` call. Instances of this class can be unpacked like a tuple:

>>> import numpy as np
>>> from deeptime.util import energy2d
>>> ax, contour, cbar = plot_energy2d(energy2d(*np.random.uniform(size=(100 ,2)).T))

Parameters
----------
Expand All @@ -25,6 +29,14 @@ def __init__(self, ax, contour, colorbar=None):
self.contour = contour
self.colorbar = colorbar

# makes object unpackable
def __len__(self):
return 3

# makes object unpackable
def __iter__(self):
return iter((self.ax, self.contour, self.colorbar))


@plotting_function()
def plot_energy2d(energies: EnergyLandscape2d, ax=None, levels=100, contourf_kws=None, cbar=True,
Expand Down
Loading