msmtools.dtraj.read_discrete_trajectory¶
-
msmtools.dtraj.
read_discrete_trajectory
(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 See also
Notes
The discrete trajectory file contains a single column with integer entries.
Examples
>>> import numpy as np >>> import os >>> from tempfile import mktemp >>> from msmtools.dtraj import write_discrete_trajectory, read_discrete_trajectory
Use temporary file
>>> tmpfile = mktemp(suffix=".dtraj")
Discrete trajectory
>>> dtraj = np.array([0, 1, 0, 0, 1, 1, 0])
Write to disk (as ascii file)
>>> write_discrete_trajectory(tmpfile, dtraj)
Read from disk
>>> X = read_discrete_trajectory(tmpfile) >>> X array([0, 1, 0, 0, 1, 1, 0])