pyemma.msm.io.read_dtraj

pyemma.msm.io.read_dtraj(filename)

Read discrete trajectory from ascii file.

Parameters:filename (str) – The filename of the discretized trajectory file. The filename can either contain the full or the relative path to the file.
Returns:dtraj – Discrete state trajectory.
Return type:(M, ) ndarray of int

Notes

The discrete trajectory file contains a single column with integer entries.

Examples

>>> from tempfile import NamedTemporaryFile
>>> from pyemma.msm.io import write_discrete_trajectory, load_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)

>>> write_discrete_trajectory(tmpfile.name, dtraj)

Read from disk

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