deeptime.util

The util package contains various utilities used throughout the library.

Model validation utils

We currently offer an implied timescales check and a test of the Chapman-Kolmogorov equation:

validation.implied_timescales(models[, n_its])

Converts a list of models to a ImpliedTimescales object.

validation.ck_test(models, observable[, ...])

Performs a Chapman-Kolmogorov test: Under the assumption of Markovian dynamics some transfer operators such as the transition matrix of a Markov state model or a Koopman model possess the so-called Chapman-Kolmogorov property.

with corresponding result objects

validation.ImpliedTimescales(lagtimes, its)

Instances of this class hold a sequence of lagtimes and corresponding process timescales (potentially with process timescales of sampled models in a Bayesian setting).

validation.ChapmanKolmogorovTest(lagtimes, ...)

Test results of the Chapman-Kolmogorov test.

Data utilities

data.timeshifted_split(inputs, lagtime[, ...])

Utility function which splits input trajectories into pairs of timeshifted data \((X_t, X_{t+\tau})\).

data.sliding_window(seq[, radius, fixed_width])

Creates a generator that yields exactly len(seq) subsequences of length at most 2 * radius + 1 in a sliding window manner along the given sequence.

data.TimeLaggedDataset(data, data_lagged)

High-level container for time-lagged time-series data.

data.TimeLaggedConcatDataset(datasets)

Specialization of the ConcatDataset which uses that all subsets are time lagged datasets, offering fancy and more efficient slicing / getting items.

data.TrajectoryDataset(lagtime, trajectory)

Creates a trajectory dataset from a single trajectory by applying a lagtime.

data.TrajectoriesDataset(data)

Dataset composed of multiple trajectories.

data.ConcatDataset(datasets)

Concatenates existing datasets.

Statistics utilities

energy2d(x, y[, bins, kbt, weights, ...])

Compute a two-dimensional energy landscape based on data arrays x and y.

EnergyLandscape2d(x_meshgrid, y_meshgrid, ...)

Result of the energy2d() method.

QuantityStatistics(samples, quantity[, ...])

Container for statistical quantities computed on samples.

confidence_interval(data[, conf, remove_nans])

Computes element-wise confidence intervals from a sample of ndarrays

Type utilities

types.to_dataset(data[, lagtime])

Converts input data to a TimeLaggedDataset if possible, otherwise assumes that data implements __len__ as well as __getitem__, where __getitem__ yields a tuple of data.

types.is_timelagged_dataset(dataset)

Checks whether an object can be ducktyped into a (time-lagged) dataset.

types.atleast_nd(ary, ndim[, pos])

View input as array with at least ndim dimensions.

Differentiation utilities

diff.tv_derivative(xs, ys[, u0, alpha, tol, ...])

Total-variation regularized derivative.

diff.finite_difference_coefficients(x_bar, xs)

Calculates finite difference coefficients.

diff.finite_difference_operator_midpoints(xs)

Yields a finite difference operator on midpoints.

Other utilities

parallel.handle_n_jobs(value)

Handles the n_jobs parameter consistently so that a non-negative number is returned.

decorators.cached_property([fget, fset, ...])

Property that gets cached, obeys property api and can also be invalidated and overridden.

decorators.plotting_function([requires_networkx])

Decorator marking a function that is a plotting utility.

decorators.deprecated_argument(...)

Marks an argument of a function as deprecated.

callbacks.supports_progress_interface(bar)

Method to check if a progress bar supports the deeptime interface, meaning that it has update, close, and set_description methods as well as a total attribute.

callbacks.ProgressCallback(progress[, ...])

Base callback function for the c++ bindings to indicate progress by incrementing a progress bar.

platform.module_available(modname)

Checks whether a module is installed and available for import by the current interpreter.

platform.handle_progress_bar(progress)

Takes a (potential) progress bar, if None, just returns an iterable that does nothing but return everything.