conpy.connectivity.LabelConnectivity

class conpy.connectivity.LabelConnectivity(data, pairs, labels, label_degree=None, subject=None)

Estimation of all-to-all connectivity, parcellated into labels.

Parameters
datandarray, shape (n_pairs,)

For each connectivity source pair, a value describing the connection. For example, this can be the strength of the connection between the sources.

pairsndarray, shape (n_pairs, 2)

The index of the labels involved in the from-to connectivity pair.

labelslist of instance of Label

The labels between which connectivity has been computed.

label_degreetuple of lists (out_degree, in_degree) | None

For each label, the total number of possible connections from and to the label. 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 label is computed.

subjectstr | None

The subject-id.

Attributes
n_connectionsint

The number of connections.

Methods

copy()

Return copy of the Connectivity object.

get_adjacency()

Get a source-to-source adjacency matrix.

is_compatible(other)

Check compatibility with another connectivity object.

plot([n_lines, node_angles, node_width, …])

Visualize parcellated connectivity as a circular graph.

save(fname)

Save the connectivity object to an HDF5 file.

threshold(thresh[, crit, direction, copy])

Threshold the connectivity.

is_compatible(other)

Check compatibility with another connectivity object.

Two connectivity objects are compatible if they define the same connectivity pairs.

Returns
is_compatiblebool

Whether the given connectivity object is compatible with this one.

plot(n_lines=None, node_angles=None, node_width=None, node_colors=None, facecolor='black', textcolor='white', node_edgecolor='black', linewidth=1.5, colormap='hot', vmin=None, vmax=None, colorbar=True, title=None, colorbar_size=0.2, colorbar_pos=- 0.3, 0.1, fontsize_title=12, fontsize_names=8, fontsize_colorbar=8, padding=6.0, fig=None, subplot=111, interactive=True, node_linewidth=2.0, show=True)

Visualize parcellated connectivity as a circular graph.

Parameters
n_linesint | None

If not None, only the n_lines strongest connections (strength=abs(con)) are drawn.

node_anglesarray, shape=(len(node_names,)) | None

Array with node positions in degrees. If None, the nodes are equally spaced on the circle. See mne.viz.circular_layout().

node_widthfloat | None

Width of each node in degrees. If None, the minimum angle between any two nodes is used as the width.

node_colorslist of tuples | list of str

List with the color to use for each node. If fewer colors than nodes are provided, the colors will be repeated. Any color supported by matplotlib can be used, e.g., RGBA tuples, named colors.

facecolorstr

Color to use for background. See matplotlib.colors.

textcolorstr

Color to use for text. See matplotlib.colors.

node_edgecolorstr

Color to use for lines around nodes. See matplotlib.colors.

linewidthfloat

Line width to use for connections.

colormapstr

Colormap to use for coloring the connections.

vminfloat | None

Minimum value for colormap. If None, it is determined automatically.

vmaxfloat | None

Maximum value for colormap. If None, it is determined automatically.

colorbarbool

Display a colorbar or not.

titlestr

The figure title.

colorbar_sizefloat

Size of the colorbar.

colorbar_pos2-tuple

Position of the colorbar.

fontsize_titleint

Font size to use for title.

fontsize_namesint

Font size to use for node names.

fontsize_colorbarint

Font size to use for colorbar.

paddingfloat

Space to add around figure to accommodate long labels.

figNone | instance of matplotlib.pyplot.Figure

The figure to use. If None, a new figure with the specified background color will be created.

subplotint | 3-tuple

Location of the subplot when creating figures with multiple plots. E.g. 121 or (1, 2, 1) for 1 row, 2 columns, plot 1. See matplotlib.pyplot.subplot.

interactivebool

When enabled, left-click on a node to show only connections to that node. Right-click shows all connections.

node_linewidthfloat

Line with for nodes.

showbool

Show figure if True.

Returns
figinstance of matplotlib.pyplot.Figure

The figure handle.

axesinstance of matplotlib.axes.PolarAxesSubplot

The subplot handle.