statetraj
Classes for handling discrete state trajectories.
-
StateTraj is a fast implementation of a state trajectory and should be used for microstate dynamics.
-
LumpedStateTraj is an implementation of the Hummer-Szabo projection1 and allows to reproduce the microstates dynamics on the macrostates space.
Note
One should also mention that for bad coarse-graining one can get negative
entries in the transition matrix \(T_{ij} < 0\). To prevent this, one can
explicitly force \(T_{ij} \ge 0\) by setting the flag positive=True
.
-
Hummer and Szabo, Optimal Dimensionality Reduction of Multistate Kinetic and Markov-State Models, J. Phys. Chem. B, 119 (29), 9029-9037 (2015), doi: 10.1021/jp508375q ↩
StateTraj(trajs)
¶
Class for handling discrete state trajectories.
Initialize StateTraj and convert to index trajectories.
If called with StateTraj instance, it will be returned instead.
Parameters:
-
trajs
(list or ndarray or list of ndarray
) –State trajectory/trajectories. The states need to be integers.
Source code in src/msmhelper/statetraj.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
states
property
¶
Return active set of states.
Returns:
-
states
(ndarray
) –Numpy array holding active set of states.
nstates
property
¶
Return number of states.
Returns:
-
nstates
(int
) –Number of states.
ntrajs
property
¶
Return number of trajectories.
Returns:
-
ntrajs
(int
) –Number of trajectories.
nframes
property
¶
Return cumulative length of all trajectories.
Returns:
-
nframes
(int
) –Number of frames of all trajectories.
trajs
property
¶
Return state trajectory.
Returns:
-
trajs
(list of ndarrays
) –List of ndarrays holding the input data.
trajs_flatten
property
¶
Return flattened state trajectory.
Returns:
-
trajs
(ndarray
) –1D ndarray representation of state trajectories.
index_trajs
property
¶
Return index trajectory.
Returns:
-
trajs
(list of ndarrays
) –List of ndarrays holding the input data.
index_trajs_flatten
property
¶
Return flattened index trajectory.
Returns:
-
trajs
(ndarray
) –1D ndarray representation of index trajectories.
estimate_markov_model(lagtime)
¶
Estimates Markov State Model.
This method estimates the MSM based on the transition count matrix.
Parameters:
-
lagtime
(int
) –Lag time for estimating the markov model given in [frames].
Returns:
-
T
(ndarray
) –Transition probability matrix \(T_{ij}\), containing the transition probability transition from state \(i o j\).
-
states
(ndarray
) –Array holding states corresponding to the columns of \(T_{ij}\).
Source code in src/msmhelper/statetraj.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
state_to_idx(state)
¶
Get idx corresponding to state.
Parameters:
-
state
(int
) –State to get idx of.
Returns:
-
idx
(int
) –Idx corresponding to state.
Source code in src/msmhelper/statetraj.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
|
LumpedStateTraj(macrotrajs, microtrajs=None, positive=False)
¶
Bases: StateTraj
Class for using the Hummer-Szabo projection with state trajectories.
Initialize LumpedStateTraj.
If called with LumpedStateTraj instance, it will be returned instead. This class is an implementation of the Hummer-Szabo projection1.
-
Hummer and Szabo, Optimal Dimensionality Reduction of Multistate Kinetic and Markov-State Models, J. Phys. Chem. B, 119 (29), 9029-9037 (2015), doi: 10.1021/jp508375q ↩
Parameters:
-
macrotrajs
(list or ndarray or list of ndarray
) –Lumped state trajectory/trajectories. The states need to be integers and all states needs to correspond to union of microstates.
-
microtrajs
(list or ndarray or list of ndarray
, default:None
) –State trajectory/trajectories. EaThe states should start from zero and need to be integers.
-
positive
(bool
, default:False
) –If
True
\(T_ij\ge0\) will be enforced, else small negative values are possible.
Source code in src/msmhelper/statetraj.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
|
states
property
¶
Return active set of macrostates.
Returns:
-
states
(ndarray
) –Numpy array holding active set of states.
nstates
property
¶
Return number of macrostates.
Returns:
-
nstates
(int
) –Number of states.
microstate_trajs
property
¶
Return microstate trajectory.
Returns:
-
trajs
(list of ndarrays
) –List of ndarrays holding the input data.
microstate_trajs_flatten
property
¶
Return flattened state trajectory.
Returns:
-
trajs
(ndarray
) –1D ndarrays representation of state trajectories.
microstate_index_trajs
property
¶
Return microstate index trajectory.
Returns:
-
trajs
(list of ndarrays
) –List of ndarrays holding the microstate index trajectory.
microstate_index_trajs_flatten
property
¶
Return flattened microstate index trajectory.
Returns:
-
trajs
(ndarray
) –1D ndarrays representation of microstate index trajectories.
trajs
property
¶
Return macrostate trajectory.
Returns:
-
trajs
(list of ndarrays
) –List of ndarrays holding the input macrostate data.
index_trajs
property
¶
Return index trajectory.
Returns:
-
trajs
(list of ndarrays
) –List of ndarrays holding the input data.
microstates
property
¶
Return active set of microstates.
Returns:
-
states
(ndarray
) –Numpy array holding active set of states.
nmicrostates
property
¶
Return number of active set of states.
Returns:
-
states
(ndarray
) –Numpy array holding active set of states.
state_assignment
property
¶
Return micro to macrostate assignment vector.
Returns:
-
state_assignment
(ndarray
) –Micro to macrostate assignment vector.
estimate_markov_model(lagtime)
¶
Estimates Markov State Model.
This method estimates the microstate MSM based on the transition count matrix, followed by Szabo-Hummer projection1 formalism to macrostates.
-
Hummer and Szabo, Optimal Dimensionality Reduction of Multistate Kinetic and Markov-State Models, J. Phys. Chem. B, 119 (29), 9029-9037 (2015), doi: 10.1021/jp508375q ↩
Parameters:
-
lagtime
(int
) –Lag time for estimating the markov model given in [frames].
Returns:
-
T
(ndarray
) –Transition probability matrix \(T_{ij}\), containing the transition probability transition from state \(i\to j\).
-
states
(ndarray
) –Array holding states corresponding to the columns of \(T_{ij}\).
Source code in src/msmhelper/statetraj.py
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
|