def ALA4_msstates(T_AA):

    # Define the metastable states from analysis of T_AA_mle
    membership = pcca(T_AA, 4)
    # the precise definitions were fine-tuned by hand, I should plot the PCCA states to double check!
    E1 = np.where(membership[:, 0] > 0.4)[0]
    E2 = np.where(membership[:, 1] > 0.5)[0]
    H = np.where(membership[:, 2] > 0.5)[0]
    I = np.where(membership[:, 3] > 0.5)[0]
    # make sure there is no overlap
    #print "checking the overlap of metastable states:"
    check = [val for val in H if val in I]
    if (len(check) != 0):
        raise ValueError('Some metastable states are overlapping!')
    check = [val for val in H if val in E1]
    if (len(check) != 0):
        raise ValueError('Some metastable states are overlapping!')
    check = [val for val in H if val in E2]
    if (len(check) != 0):
        raise ValueError('Some metastable states are overlapping!')
    check = [val for val in I if val in E1]
    if (len(check) != 0):
        raise ValueError('Some metastable states are overlapping!')
    check = [val for val in I if val in E2]
    if (len(check) != 0):
        raise ValueError('Some metastable states are overlapping!')
    check = [val for val in E1 if val in E2]
    if (len(check) != 0):
        raise ValueError('Some metastable states are overlapping!')

    return H, I, E2, E1
def ALA4_msstates( T_AA ):

    # Define the metastable states from analysis of T_AA_mle
    membership=pcca(T_AA, 4)
    # the precise definitions were fine-tuned by hand, I should plot the PCCA states to double check!
    H = np.where(membership[:,0]>0.61)[0]
    I = np.where(membership[:,1]>0.80)[0]
    E1 = np.where(membership[:,2]>0.61)[0]
    E2 = np.where(membership[:,3]>0.80)[0]
    # make sure there is no overlap
    #print "checking the overlap of metastable states:"
    check = [val for val in H if val in I]
    if (len(check) != 0 ):  raise ValueError('Some metastable states are overlapping!')
    check = [val for val in H if val in E1]
    if (len(check) != 0 ):  raise ValueError('Some metastable states are overlapping!')
    check = [val for val in H if val in E2]
    if (len(check) != 0 ):  raise ValueError('Some metastable states are overlapping!')
    check = [val for val in I if val in E1]
    if (len(check) != 0 ):  raise ValueError('Some metastable states are overlapping!')
    check = [val for val in I if val in E2]
    if (len(check) != 0 ):  raise ValueError('Some metastable states are overlapping!')
    check = [val for val in E1 if val in E2]
    if (len(check) != 0 ):  raise ValueError('Some metastable states are overlapping!')

    return H, I, E2, E1
Пример #3
0
def main():
    args = handleArgs()

    # read transition matrix
    T = read_matrix(args.inputT)
    if not is_transition_matrix(T):
        raise ValueError(
            'given transition matrix is not a valid transition matrix')

    #if args.inputEigVecs:
    #    eig_vecs = read_matrix(args.inputEigVecs)
    memberships = pcca(T, args.nclusters)
    print memberships

    # write memberships to file crisp
    try:
        write_matrix(args.ocrisp, memberships)
    except Exception:
        log.exception('error during writing of PCCA memberships.')
        return 1

    # TODO: add fuzzy assignment to clusters if supported by pyemma pcca impl

    # TODO: add output sets

    return 0
def ALA3_msstates( T_AA ):

    # Define the metastable states from analysis of T_AA_mle
    membership=pcca(T_AA, 3)
    # the precise definitions were fine-tuned by hand, I should plot the PCCA states to double check!
    lH = np.where(membership[:,0]>0.60)[0]
    aH = np.where(membership[:,1]>0.60)[0]
    B = np.where(membership[:,2]>0.60)[0]
    # make sure there is no overlap
    #print "checking the overlap of metastable states:"
    check = [val for val in lH if val in aH]
    if (len(check) != 0 ):  raise ValueError('Some metastable states are overlapping!')
    check = [val for val in lH if val in B]
    if (len(check) != 0 ):  raise ValueError('Some metastable states are overlapping!')
    check = [val for val in aH if val in B]
    if (len(check) != 0 ):  raise ValueError('Some metastable states are overlapping!')

    return B, aH, lH
def ALA3_msstates(T_AA):

    # Define the metastable states from analysis of T_AA_mle
    membership = pcca(T_AA, 3)
    # the precise definitions were fine-tuned by hand, I should plot the PCCA states to double check!
    lH = np.where(membership[:, 0] > 0.60)[0]
    aH = np.where(membership[:, 1] > 0.60)[0]
    B = np.where(membership[:, 2] > 0.60)[0]
    # make sure there is no overlap
    #print "checking the overlap of metastable states:"
    check = [val for val in lH if val in aH]
    if (len(check) != 0):
        raise ValueError('Some metastable states are overlapping!')
    check = [val for val in lH if val in B]
    if (len(check) != 0):
        raise ValueError('Some metastable states are overlapping!')
    check = [val for val in aH if val in B]
    if (len(check) != 0):
        raise ValueError('Some metastable states are overlapping!')

    return B, aH, lH
Пример #6
0
def pcca_sets(P, n, lcc):
    r"""Compute partition into Perron clusters.

    Parameters
    ----------
    P : (M, M) ndarray
        Transition matrix
    n : int
        Number of Perron clusters

    Returns 
    -------
    sets : list
        List of arrays, sets[i] contains the states in the i-th Perron
        cluster

    """
    sets=[]
    pcca_prob=pcca(P, n)
    pcca_ind=np.argmax(pcca_prob, axis=1)
    for i in range(n):
        sets.append(lcc[pcca_ind==i])
    return sets
Пример #7
0
 def PCCA(self, m):
     """Use pyemma pcca """
     from pyemma.msm.analysis import pcca
     self.pcca = pcca(self.T, m)
     return self.pcca
Пример #8
0
    def PCCA(self, m):
        """Use pyemma pcca """
        from pyemma.msm.analysis import pcca

        self.pcca = pcca(self.T, m)
        return self.pcca