Analysis of connectivity matrices
Tools for the analysis of structural connectivity and functional connectivity matrices.
Functions:
|
Laplacian matrix of a graph from the connectivity matrix. |
|
Trasition matrix from the connectivity matrix. |
Boolean logic in a 2D float array. |
|
|
Apply the mean_delay scaling to the matrix of disatances D. |
Sum of the rows of the boolean adjacency matrix. |
|
|
Construct a random connected network |
|
Diagonal degree matrix. |
|
Calculate and sort the eigenvalues and eigenvectors of the matrix C. |
|
Sum of the rows of the connectivity matrix. |
|
Load a square connectivity matrix |
|
Load the matrix of delays between nodes |
|
Load labels of the graph nodes |
|
|
|
|
|
|
|
- analysis.connectivityMatrices.Laplacian(C, asAdjacency=False)
Laplacian matrix of a graph from the connectivity matrix.
- Parameters
C (2D float array) – Connectivity matrix.
asAdjacency (boolean) – If True, uses the binary adajcency matrix. Then, it matters the connection existence, and it not matters the weight.
- Returns
L – Laplacian matrix.
- Return type
2D float array
- analysis.connectivityMatrices.Transition(C, asAdjacency=False)
Trasition matrix from the connectivity matrix.
- Parameters
C (2D float array) – Connectivity matrix.
asAdjacency (boolean) – If True, uses the binary adajcency matrix. Then, it matters the connection existence, and it not matters the weight.
- Returns
T – Transition matrix.
- Return type
2D float array
- analysis.connectivityMatrices.adjacencyMatrix(C)
Boolean logic in a 2D float array.
- Parameters
C (2D float array) – Conectome or adjacency matrix.
- Returns
A – Boolean adjacency matrix, 1 if c[i,j]!=0.
- Return type
2D int array
- analysis.connectivityMatrices.applyMeanDelay(D, C, mean_delay=1.0)
Apply the mean_delay scaling to the matrix of disatances D. Take in account for the mean of D only the nonzero elements of C.
- Parameters
D (float, 2D array) – Distances matrix (meters).
C (float, 2D array) – Structural connectivity matrix (a. u.).
mean_delay (float, optional) – The mean_delay . The default is 1.0.
- Returns
D – DESCRIPTION.
- Return type
TYPE
- analysis.connectivityMatrices.booleanDegree(C)
Sum of the rows of the boolean adjacency matrix.
- Parameters
C (2D float array) – Conectivity matrix.
- Returns
k_i – degree of each node.
- Return type
1D int array
- analysis.connectivityMatrices.constructErdosRenyiConnectome(No_nodes, p=1, seed=2)
Construct a random connected network
- Parameters
No_nodes (int) – Number of nodes.
p (float, optional) – Degree of connectivity. The default is 1, corresponds to fully-connected network. A value of 0, is a empty connectome (full of zeros).
- Returns
C – Adjacency matrix with the defined connectivity degree for each node.
- Return type
2D float array (boolean)
- analysis.connectivityMatrices.degreeMatrix(C)
Diagonal degree matrix.
- Parameters
C (2D float array) – Conectome or Adjacency matrix.
- Returns
degree_matrix – Diagonal matrix.
- Return type
2D float array
- analysis.connectivityMatrices.eigen(C, zero_threshold=1e-09)
Calculate and sort the eigenvalues and eigenvectors of the matrix C.
- Parameters
C (float 2D square array) – Connectivity or Laplacian matrix.
zero_threshold (float. Default value 1e-9) – Threshold for smaller eigenvalues. Any eigenvalue with absoulute value lower than zero_threshold is considered a zero eigenvalue.
- Returns
eig_values (1D complex array) – sorted eigenvalues of C.
eig_vectors (2D complex array) – eigenvectors of C sorted by eigenvalues.
algebraic_connectivty (float) – Second eigenvalue of C.
con_comp (int) – Connected components of the network (Quantity of zero eigenvalues)
- analysis.connectivityMatrices.intensities(C)
Sum of the rows of the connectivity matrix.
- Parameters
C (2D float array) – Conectivity matrix.
- Returns
intensities – sum of the rows.
- Return type
1D float array
- analysis.connectivityMatrices.loadConnectome(No_nodes, filename='../input_data/AAL_matrices.mat', field='C')
Load a square connectivity matrix
- Parameters
No_nodes (int) – Number of nodes to load.
filename (String, optional) – The filename, including the directory, where the connection matrix is stored. The default is the AAL90 filename
field (String, optional) – The file of the filename that contains the connection weights matrix. The default is ‘C’.
- Returns
C – Connectome matrix.
- Return type
2D float array
- analysis.connectivityMatrices.loadDelays(No_nodes, filename='../input_data/AAL_matrices.mat', field='D')
Load the matrix of delays between nodes
- Parameters
No_nodes (int) – Number of nodes to load.
filename (String, optional) – The filename, including the directory, where the delay matrix is stored. The default is the AAL90 filename
field (String, optional) – The file of the filename that contains the delays matrix. The default is ‘D’.
- Returns
D – Matrix of delays, unit: seconds. (Or could be meters, if the mean_delay parameter has unit second/meter.)
- Return type
2D float array
- analysis.connectivityMatrices.loadLabels(filename='../input_data/AAL_labels.mat', field='label90')
Load labels of the graph nodes
- Parameters
filename (String, optional) – The filename, including the directory, where the labels are stored. The default is ‘../input_data/AAL_labels.mat’.
field (String, optional) – The name of the file inside ‘filename’ that contains the labels. The default is ‘label90’ for the AAL90 connectivity matrix.
- Returns
labels – Physiologycall related names of the oscillatory nodes.
- Return type
String array or list
- analysis.connectivityMatrices.orthoMatrix(eig_value, eig_vector)
- analysis.connectivityMatrices.vonNewmanDensity(L, beta=1)
- analysis.connectivityMatrices.vonNewmanEntropy(L, beta=1)
- analysis.connectivityMatrices.vonNewmanRelativeEntropy(L, J, beta=1)