- qspec.simulate. ct_markov_dgl ( t , n , rates , r=1.0 , p0=None , time_resolved=False , show=False )[source]
-
The numerical solution of the evolution of a linear continuous-time Markov chain, see
ct_markov_analytic, obtained by solving the underlying system of ordinary differential equations$$ \frac{\mathrm{d}P_0}{\mathrm{d}t} = -\lambda_0P_0,\quad \frac{\mathrm{d}P_i}{\mathrm{d}t} = r\lambda_{i - 1}P_{i - 1} - \lambda_iP_i. $$- Parameters:
-
- tarray_like
The time $t$ after which the probabilities are returned (μs). If all times from 0 to
tare required, usetime_resolved=True.- nint_like
The maximum state number $n$ to compute. The first state corresponds to
n = 0.- ratesarray_like
The rate(s) $\lambda_i$ at which the Markov chain transfers population from the state $i$ to the state $i + 1$ (MHz). If
ratesis a scalar, this rate is assumed for all $0 \leq i \leq n$. Ifratesis an iterable, it must have sizen + 1and individual ratesrates[i]are assumed for the states $i$.- rarray_like
The ratio $r$ of the population which is transferred from the state $i$ to the state $i + 1$. Then $1 - r$ is the ratio of the population that is lost during the transition.
- p0array_like | None
The initial probabilities $P_i(0)$. Must be an iterable of size
n + 1. IfNone,p0is set to[1, 0, 0, ..., 0].- time_resolvedbool
Whether to return the complete history of the result. If
True, a 2-tuple(t, p)is returned, wherephas shape(t.size, n + 1)andtis an array of equally spaced times, such that numerical integrations can be performed easily.- showbool
Whether to plot the result.
- Returns:
- Raises:
-
- ValueError
If
tis not a scalar, ifratesorp0have the wrong size, or ifris not a scalar between 0 and 1.