conpy.connectivity.
VertexConnectivity
(data, pairs, vertices, vertex_degree=None, subject=None, directed=False)¶Estimation of connectivity between vertices.
For each connectivity source pair, a value describing the connection. For example, this can be the strength of the connection between the sources.
The vertices involved in the from-to connectivity pair. The vertices are listed as “vertex indices” in the array:
np.hstack((vertices[0], (vertices[1] + len(vertices[0]))))
For each hemisphere, the vertex numbers of sources defined in the corresponding source space.
For each vertex, the total number of possible connections from and to
the vertex. This information is needed to perform weighting on the
number of connections during visualization and statistics. If None
,
it is assumed that all possible connections are defined in the
pairs
parameter and the out- and in-degree of each vertex is
computed.
The subject-id.
Whether the connectivity is directed (from->to != to->from). Defaults to False.
n_connections
intThe number of connections.
The number of sources between possible connections were computed.
Methods
|
Return copy of the Connectivity object. |
|
Get a source-to-source adjacency matrix. |
|
Check compatibility with another connectivity object. |
|
Obtain a summary of the connectivity as a SourceEstimate object. |
|
Get the connectivity parcellated according to the given labels. |
|
Save the connectivity object to an HDF5 file. |
|
Threshold the connectivity. |
|
Get the connectivity from a morphed source to the original subject. |
is_compatible
(other)¶Check compatibility with another connectivity object.
Two connectivity objects are compatible if they define the same connectivity pairs.
Whether the given connectivity object is compatible with this one.
make_stc
(summary='sum', weight_by_degree=True)¶Obtain a summary of the connectivity as a SourceEstimate object.
How to summarize the adjacency data:
- ‘sum’sum the strenghts of both the incoming and outgoing
connections for each source.
- ‘degree’: count the number of incoming and outgoing
connections for each source.
- ‘absmax’show the strongest coherence across both incomoing
and outgoing connections at each source. In this setting, the
weight_by_degree
parameter is ignored.
Defaults to 'sum'
.
Whether to weight the summary by the number of possible
connections. Defaults to True
.
The summary of the connectivity.
parcellate
(labels, summary='sum', weight_by_degree=True, verbose=None)¶Get the connectivity parcellated according to the given labels.
The coherence of all connections within a label are averaged.
The labels to use to parcellate the connectivity.
How to summarize the connectivity within a label. Either the summation of the connection values (‘sum’), the number of connections from and to the label is used (‘degree’), the absolute maximum value of the connections (‘absmax’), or a function can be specified, which is called for each label with the following signature:
>>> def summary(adjacency, vert_from, vert_to):
... '''Summarize the connections within a label.
...
... Parameters
... ----------
... adjacency : sparse matrix, shape (n_sources, n_sources)
... The adjacency matrix that defines the connection
... between the sources.
... src_from : list of int
... Indices of sources that are outside of the label.
... src_to : list of int
... Indices of sources that are inside the label.
...
... Returns
... -------
... coh : float
... Summarized coherence of the parcel.
Whether to weight the summary of each label by the number of
possible connections from and to that label. Defaults to True
.
If not None, override default verbose level (see
mne.verbose()
and Logging documentation
for more).
The parcellated connectivity.
See also
mne.read_labels_from_annot
To read a list of labels from a FreeSurfer annotation.
to_original_src
(src_orig, subject_orig=None, subjects_dir=None, verbose=None)¶Get the connectivity from a morphed source to the original subject.
The original source spaces that were morphed to the current subject.
The original subject. For most source spaces this shouldn’t need to be provided, since it is stored in the source space itself.
Path to SUBJECTS_DIR if it is not set in the environment.
If not None, override default verbose level (see
mne.verbose()
and Logging documentation
for more).
The transformed connectivity.
See also