API

analysis

class cmdtools.analysis.pcca.PCCA(T=None, n=None, pi='uniform', massmatrix=None, eigensolver=<cmdtools.analysis.schur.ScipySchur object>, optimizer=<cmdtools.analysis.optimization.Optimizer object>)[source]
solve()[source]
cmdtools.analysis.pcca.gramschmidt(X, pi)[source]

Gram Schmidt orthogonalization wrt. scalar product induced by pi

cmdtools.analysis.pcca.pcca(T, n, **kwargs)[source]
class cmdtools.analysis.optimization.Optimizer(maxiter=1000)[source]
solve(X, pi=None)[source]
cmdtools.analysis.optimization.assertstructure(X, pi)[source]
cmdtools.analysis.optimization.fillA(A, X)[source]

Converts the given matrix into a feasible transformation matrix. Algorithm 3.10 from Weber (2006)

cmdtools.analysis.optimization.indexsearch(X)[source]

Return the indices to the rows spanning the largest simplex

cmdtools.analysis.optimization.inner_simplex_algorithm(X)[source]

Return the transformation A mapping those rows of X which span the largest simplex onto the unit simplex.

cmdtools.analysis.optimization.objective(alpha, X, A)[source]

Equation (16) from Röblitz, Weber (2013)

cmdtools.analysis.optimization.optimize(X, A, maxiter=1000)[source]

optimization of A - the feasiblization routine fillA() requires the first column of X to be the constant one-vector - the optimzation criterion expects X^T D X = I (where D is the stationary diagonal matrix)

estimation

class cmdtools.estimation.galerkin.Basis[source]
class cmdtools.estimation.galerkin.Gaussian(timeseries, centers=None, sqd=None, sigma=None, percentile=50)[source]
property propagator
class cmdtools.estimation.galerkin.TransferOperatorGalerkin(basis)[source]

Class resposible for computing the Monte-Carlo estimates of the Perron-Frobenius and Koopman operators wrt to a given Basis

koopman()[source]

K = M^-1 S

mass()[source]

M_ij = 1/n sum_k=(0,…,n) X_ki X_kj

perronfrobenius()[source]

P = S^T M^-1 = K^T

stiffness()[source]

S_ij = 1/n sum_k=(0,…,n-1) X_(k+1,i) X_kj

cmdtools.estimation.galerkin.find_bandwidth(sqd, percentile=50)[source]

Given the square-distance matrix d_ij = (x_i - x_j)^2 compute the standard deviation s for the Gaussian kernel k(x_i,x_j) = exp(-1/(2s^2) d_ij). The heuristic is based on the assumption that we want sum_j k(x_i, x_j) ≈ n exp(-1/(2s^2) med^2) = 1 and hence (2s^2) = med^2 / log n where n is the number of points and med the pairwise median distance.

percentile allows to shift from the median to an arbitrary percentage and thus influences how many points have an influence on the bandwith.

Heuristic taken from “Stein Variational Gradient Descent […], Qiang Liu and Dilin Wang (2016)”.

Input:

sqd: matrix, pairwise squared-distances of the samples percentile: float [0,100], percentile to use instead of median

Output:

sigma: float, the standard deviation of the Gaussian

cmdtools.estimation.galerkin.massmatrix(membership)[source]

Compute the row-stochastic empirical mass function S_ij = St_ij / sum_j St_ij St_ij = 1/n sum_x phi_i(x) phi_j(x), x in traj cf. ([TGDW2019] eqn 12, [W2006] eqn 35)

Parameters

membership (matrix) – row-stochastic membership matrix of shape (#samples x #basis)

Returns

row-stochastic mass matrix S

Return type

matrix

cmdtools.estimation.galerkin.membership(sqd, sigma)[source]

Given square distances and standard deviation, return the row-stochastic Gaussian membership matrix

cmdtools.estimation.galerkin.propagator(membership, lag=1)[source]

Compute the row-stochastic empirical propagator K_ij = Kt_ij / sum_j Kt_ij Kt_ij = 1/n sum_x phi_i(x) phi_j(y), (x,y) in traj cf. ([TGDW2019] eqn 12, [W2006] eqn 35)

Parameters

membership (matrix) – row-stochastic membership matrix of shape (#samples x #basis)

Returns

row-stochastic propagator P

Return type

matrix

cmdtools.estimation.galerkin.sqdist(timeseries, centers, metric='sqeuclidean')[source]
class cmdtools.estimation.sqra.SQRA(u, beta=1, phi=1, A=None, torus=False)[source]

approximate the generator/rate-matrix Q of the Overdamped-Langevin dynamics :param u: The potential function evaluated at the grid points. :type u: ndarray :param beta: The inverse temperatur of the system (scales the rates nonlinear). :type beta: float :param phi: Linear scaling factor of the rates (depending on the grid volume). :type phi: float :param A: Adjacency matrix of the grid. If left empty, automatically compute it based on the shape of u. :type A: matrix, optional :param torus: Whether to glue the corresponding dimensions together at their resp. boundaries. Only used in the automatic generation of A. :type torus: list of bool

A

Adjacency matrix

Q

The computed generator

sqra()[source]
cmdtools.estimation.sqra.adjacency_nd(dims, torus=False)[source]
cmdtools.estimation.sqra.beta_to_epsilon(b)[source]
cmdtools.estimation.sqra.sqra(u, A, beta, phi)[source]

Square-root approximation of the generator (of the Overdamped Langevin model)

u: vector of pointwise evaluation of the potential A: adjacency matrix of the discretization beta: inverse temperature phi: the flux constant, determined by the temperature and the discr.

systems

class cmdtools.systems.diffusion.AbstractDiffusion(nx, ny, xlims, ylims, beta=1, phi=1)[source]
class cmdtools.systems.diffusion.DoubleWell(nx=5, ny=1, xlims=(- 2.5, 2.5), ylims=(- 1, 1), **kwargs)[source]
potential()[source]
class cmdtools.systems.diffusion.TripleWell(nx=4, ny=3, xlims=(- 2, 2), ylims=(- 1, 2), **kwargs)[source]
potential()[source]

utils

cmdtools.utils.euclidean_torus(periods)[source]

euclidean metric on a d-dimensional torus with given periods. using np.inf for a specific period corresponds to the usual euclidean distance in that dimension

cmdtools.utils.example_metastab4()[source]

Return the transition matrix for a simple metastable model. The 4 correpsonding states are [A,T,B,B], where A and B are metastable and T is a transition region

cmdtools.utils.get_pi(T, pi='uniform')[source]
cmdtools.utils.is_generator(Q)[source]

check necessary conditions for Q being a generator (not sufficient)

cmdtools.utils.is_rowstochastic(P)[source]
cmdtools.utils.order_membership(m)[source]

order the membership matrix, first comes first

cmdtools.utils.randompropagator(n, reversible=True)[source]
cmdtools.utils.rowstochastic(T)[source]
cmdtools.utils.torus_minus(x, y, periods)[source]

compute the shortest vector from y to x on the topological torus