msmtools.dtraj.load_dtraj¶
-
msmtools.dtraj.
load_dtraj
(filename)¶ Read discrete trajectory form 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. Returns: dtraj – Discrete state trajectory Return type: (M,) ndarray of int See also
Notes
The binary file is a one dimensional numpy array of integers stored in numpy .npy format.
Examples
>>> import numpy as np >>> import os >>> from tempfile import mktemp >>> from msmtools.dtraj import load_discrete_trajectory, save_discrete_trajectory
Use temporary file
>>> tmpfile = mktemp(suffix='.npy')
Discrete trajectory
>>> dtraj = np.array([0, 1, 0, 0, 1, 1, 0])
Write to disk (as npy file)
>>> save_discrete_trajectory(tmpfile, dtraj)
Read from disk
>>> X = load_discrete_trajectory(tmpfile) >>> X array([0, 1, 0, 0, 1, 1, 0])