msmtools.generation.generate_traj(P, N, start=None, stop=None, dt=1)

Generates a realization of the Markov chain with transition matrix P.

  • P ((n, n) ndarray) – transition matrix
  • N (int) – trajectory length
  • start (int, optional, default = None) – starting state. If not given, will sample from the stationary distribution of P
  • stop (int or int-array-like, optional, default = None) – stopping set. If given, the trajectory will be stopped before N steps once a state of the stop set is reached
  • dt (int) – trajectory will be saved every dt time steps. Internally, the dt’th power of P is taken to ensure a more efficient simulation.

traj_sliced – A discrete trajectory with length N/dt

Return type:

(N/dt, ) ndarray