pyemma.msm.io.save_discrete_trajectory

pyemma.msm.io.save_discrete_trajectory(filename, dtraj)

Write discrete trajectory to binary file.

Parameters:
  • filename (str) – The filename of the discrete state trajectory file. The filename can either contain the full or the relative path to the file.
  • dtraj (array-like of int) – Discrete state trajectory

Notes

The discrete trajectory is stored as ndarray of integers in numpy .npy format.

Examples

>>> from tempfile import NamedTemporaryFile
>>> from pyemma.msm.io import load_discrete_trajectory, save_discrete_trajectory

Use temporary file

>>> tmpfile = NamedTemporaryFile()

Discrete trajectory

>>> dtraj = np.array([0, 1, 0, 0, 1, 1, 0])

Write to disk (as ascii file)

>>> save_discrete_trajectory(tmpfile.name, dtraj)

Read from disk

>>> X = load_discrete_trajectory(tmpfile.name)
>>> X
array([0, 1, 0, 0, 1, 1, 0])