deeptime.markov.tools

Package containing various low-level tools that are used for estimating and analyzing Markov state models. This package is a fork of MSMTools.

MSM estimation

This module (deeptime.markov.tools.estimation) contains utility functions dealing with MSM estimation from data.

Countmatrix

count_matrix(dtraj, lag[, sliding, ...])

Generate a count matrix from given microstate trajectory.

Connectivity

connected_sets(C[, directed])

Compute connected sets of microstates.

largest_connected_set(C[, directed])

Largest connected component for a directed graph with edge-weights given by the count matrix.

largest_connected_submatrix(C[, directed, lcc])

Compute the count matrix on the largest connected set.

is_connected(C[, directed])

Check connectivity of the given matrix.

Estimation

transition_matrix(C[, reversible, mu, ...])

Estimate the transition matrix from the given countmatrix.

rate_matrix(C[, dt, method, sparsity, ...])

Estimate a reversible rate matrix from a count matrix.

log_likelihood(C, T)

Log-likelihood of the count matrix given a transition matrix.

tmatrix_cov(C[, k])

Covariance tensor for non-reversible transition matrix posterior.

error_perturbation(C, S)

Error perturbation for given sensitivity matrix.

Sampling

tmatrix_sampler(C[, reversible, mu, T0, ...])

Generate transition matrix sampler object.

Bootstrap

bootstrap_counts(dtrajs, lagtime[, corrlength])

Generates a randomly resampled count matrix given the input coordinates.

bootstrap_trajectories(trajs, correlation_length)

Generates a randomly resampled trajectory segments.

Priors

prior_neighbor(C[, alpha])

Neighbor prior for the given count matrix.

prior_const(C[, alpha])

Constant prior for given count matrix.

prior_rev(C[, alpha])

Prior counts for sampling of reversible transition matrices.

MSM analysis

This module (deeptime.markov.tools.analysis) contains functions to analyze a created Markov model, which is specified with a transition matrix T.

Validation

is_transition_matrix(T[, tol])

Check if the given matrix is a transition matrix.

is_rate_matrix(K[, tol])

Check if the given matrix is a rate matrix.

is_connected(T[, directed])

Check connectivity of the given matrix.

is_reversible(T[, mu, tol])

Check reversibility of the given transition matrix.

Decomposition

Decomposition routines use the scipy LAPACK bindings for dense numpy-arrays and the ARPACK bindings for scipy sparse matrices.

stationary_distribution(T[, ncv, mode, ...])

Compute stationary distribution of stochastic matrix T.

eigenvalues(T[, k, ncv, reversible, mu])

Find eigenvalues of the transition matrix.

eigenvectors(T[, k, right, ncv, reversible, mu])

Compute eigenvectors of given transition matrix.

rdl_decomposition(T[, k, norm, ncv, ...])

Compute the decomposition into eigenvalues, left and right eigenvectors.

timescales(T[, tau, k, ncv, reversible, mu])

Compute implied time scales of given transition matrix.

Expected counts

expected_counts(T, p0, N)

Compute expected transition counts for Markov chain with n steps.

expected_counts_stationary(T, N[, mu])

Expected transition counts for Markov chain in equilibrium.

Passage times

mfpt(T, target[, origin, tau, mu])

Mean first passage times (from a set of starting states - optional) to a set of target states.

Committors and PCCA

committor(T, A, B[, forward, mu])

Compute the committor between sets of microstates.

pcca_memberships(T, m)

Compute meta-stable sets using PCCA++.

hitting_probability(T, target)

Computes the hitting probabilities for all states to the target states.

Fingerprints

fingerprint_correlation(T, obs1[, obs2, ...])

Dynamical fingerprint for equilibrium correlation experiment.

fingerprint_relaxation(T, p0, obs[, tau, k, ncv])

Dynamical fingerprint for relaxation experiment.

expectation(T, a[, mu])

Equilibrium expectation value of a given observable.

correlation(T, obs1[, obs2, times, k, ncv])

Time-correlation for equilibrium experiment.

relaxation(T, p0, obs[, times, k])

Relaxation experiment.

Sensitivity analysis

stationary_distribution_sensitivity(T, j)

Sensitivity matrix of a stationary distribution element.

eigenvalue_sensitivity(T, k)

Sensitivity matrix of a specified eigenvalue.

timescale_sensitivity(T, k)

Sensitivity matrix of a specified time-scale.

eigenvector_sensitivity(T, k, j[, right])

Sensitivity matrix of a selected eigenvector element.

mfpt_sensitivity(T, target, i)

Sensitivity matrix of the mean first-passage time from specified state.

committor_sensitivity(T, A, B, i[, forward])

Sensitivity matrix of a specified committor entry.

expectation_sensitivity(T, a)

Sensitivity of expectation value of observable A=(a_i).

Transition path theory tools

This module (deeptime.markov.tools.flux) contains functions to compute reactive flux networks and find dominant reaction pathways in such networks.

Reactive flux

flux_matrix(T, pi, qminus, qplus[, netflux])

Compute the TPT flux network for the reaction A-->B.

to_netflux(flux)

Compute the netflux from the gross flux.

flux_production(F)

Returns the net flux production for all states

flux_producers(F[, rtol, atol])

Return indexes of states that are net flux producers.

flux_consumers(F[, rtol, atol])

Return indexes of states that are net flux producers.

coarsegrain(F, sets)

Coarse-grains the flux to the given sets.

Reaction rates and fluxes

total_flux(F[, A])

Compute the total flux, or turnover flux, that is produced by

rate(totflux, pi, qminus)

Transition rate for reaction A to B.

mfpt(totflux, pi, qminus)

Mean first passage time for reaction A to B.

Pathway decomposition

pathways(F, A, B[, fraction, maxiter])

Decompose flux network into dominant reaction paths.