def sample(self, startprob, transmat, size=1):
    'Sample from a Markov model.\n\n        Attributes\n        ----------\n        size: int\n            Defining number of sampled variates. Defaults to `1`.\n\n        Returns\n        -------\n        vals: ndarray\n            The sampled sequences of size (nseq, seqlen).\n\n        '
    if np.isscalar(size):
        size = (1, size)
    vals = np.zeros(size, dtype=np.int32)
    (nseq, seqlen) = size
    for i in range(nseq):
        vals[i][0] = nonuniform.rvs(startprob)
        for t in range(1, seqlen):
            vals[i][t] = nonuniform.rvs(transmat[vals[i][(t - 1)]])
    return vals
Sample from a Markov model.

Attributes
----------
size: int
    Defining number of sampled variates. Defaults to `1`.

Returns
-------
vals: ndarray
    The sampled sequences of size (nseq, seqlen).
def sample(self, startprob, transmat, size=1):
    'Sample from a Markov model.\n\n        Attributes\n        ----------\n        size: int\n            Defining number of sampled variates. Defaults to `1`.\n\n        Returns\n        -------\n        vals: ndarray\n            The sampled sequences of size (nseq, seqlen).\n\n        '
    if np.isscalar(size):
        size = (1, size)
    vals = np.zeros(size, dtype=np.int32)
    (nseq, seqlen) = size
    for i in range(nseq):
        vals[i][0] = nonuniform.rvs(startprob)
        for t in range(1, seqlen):
            vals[i][t] = nonuniform.rvs(transmat[vals[i][(t - 1)]])
    return vals