コード例 #1
0
ファイル: measures.py プロジェクト: omerch/pyconto
def motif3struct(cmatrix, weighted):
    """ Counts occurrences of three-node structural motifs
    
    Parameters
    ----------
    cmatrix : connection/adjacency matrix
        (For weighted graph W(all weights [0,1]) )
        
    weighted : {False, True}
    
    Returns
    -------
    
    weighted == True:
    
        I : Returns intensity and (optionally) coherence and motif counts.
    
        Weighted structural motif metrics.
        
        Reference: Onnela et al. 2005, Phys Rev E 71:065103;

        Mika Rubinov, UNSW, 2007 (last modified July 2008)
    
    weighted == False:
    
        f : binary motif count

        Reference: Milo et al., 2002, Science

        Mika Rubinov, UNSW, 2007 (last modified July 2008)

    """
    if weighted:
        m = bct.to_gslm(cmatrix.tolist())
        str = bct.motif3struct_wei(m)
        strnp = bct.from_gsl(str)
        bct.gsl_free(m)
        bct.gsl_free(str)
        return np.asarray(strnp)
    else:
        m = bct.to_gslm(cmatrix.tolist())
        str = bct.motif3struct_bin(m)
        strnp = bct.from_gsl(str)
        bct.gsl_free(m)
        bct.gsl_free(str)
        return np.asarray(strnp)
コード例 #2
0
ファイル: measures.py プロジェクト: aestrivex/pyconto
def motif3struct(cmatrix, weighted):
    """ Counts occurrences of three-node structural motifs
    
    Parameters
    ----------
    cmatrix : connection/adjacency matrix
        (For weighted graph W(all weights [0,1]) )
        
    weighted : {False, True}
    
    Returns
    -------
    
    weighted == True:
    
        I : Returns intensity and (optionally) coherence and motif counts.
    
        Weighted structural motif metrics.
        
        Reference: Onnela et al. 2005, Phys Rev E 71:065103;

        Mika Rubinov, UNSW, 2007 (last modified July 2008)
    
    weighted == False:
    
        f : binary motif count

        Reference: Milo et al., 2002, Science

        Mika Rubinov, UNSW, 2007 (last modified July 2008)

    """
    if weighted:
        m = bct.to_gslm(cmatrix.tolist())
        str = bct.motif3struct_wei(m)
        strnp = bct.from_gsl(str)
        bct.gsl_free(m)
        bct.gsl_free(str)
        return np.asarray(strnp)
    else:
        m = bct.to_gslm(cmatrix.tolist())
        str = bct.motif3struct_bin(m)
        strnp = bct.from_gsl(str)
        bct.gsl_free(m)
        bct.gsl_free(str)
        return np.asarray(strnp)
コード例 #3
0
ファイル: bct.py プロジェクト: aestrivex/pyconto
def motif3struct_bin(*args):
  return _bct.motif3struct_bin(*args)
コード例 #4
0
def motif3struct_bin(*args):
    return _bct.motif3struct_bin(*args)
コード例 #5
0
ファイル: bct.py プロジェクト: aestrivex/pyconto
def motif3struct_bin(*args):
  """motif3struct_bin(gsl_matrix A) -> gsl_vector"""
  return _bct.motif3struct_bin(*args)
コード例 #6
0
ファイル: bct.py プロジェクト: omerch/pyconto
def motif3struct_bin(*args):
    """motif3struct_bin(gsl_matrix A) -> gsl_vector"""
    return _bct.motif3struct_bin(*args)