def ph2full(ptrans, htrans):
    """
    Convert a p-state transition matrix and h-state matrices to the full transation matrix

    The full transmat hase N=n_pstates*n_hstates states
    """
    n_pstates = len(ptrans)
    n_hstates = len(htrans[0, 0])
    N = n_pstates * n_hstates
    trans = np.zeros((N, N))
    for pidx in range(n_pstates):
        for hidx in range(n_hstates):
            trans[pidx * n_hstates + hidx] = (ptrans[pidx, :, np.newaxis] * htrans[pidx, :, hidx]).flatten()

    return trans
Convert a p-state transition matrix and h-state matrices to the full transation matrix

    The full transmat hase N=n_pstates*n_hstates states