Connectivity

Add connectivity to the topoplot.

Download topoplot data (topoplot_data.npz) : https://www.dropbox.com/s/m76y3p0fyj6lxht/topoplot_data.npz?dl=1

../../_images/ex_connectivity1.png
import numpy as np

from visbrain import Topo
from visbrain.io import download_file, path_to_visbrain_data

# Load the data :
download_file('topoplot_data.npz')
mat = np.load(path_to_visbrain_data('topoplot_data.npz'))
xyz, data = mat['xyz'], mat['data']
channels = [str(k) for k in range(len(data))]
n_channels = len(channels)

"""The connectivity is defined by an upper triangle array of shape
(n_channels, n_channels).
In addition, to improve the selection of edges to display, use the boolean
array `c_select` input parameter to select edges that need to be drawn.
"""
connect = (data.reshape(-1, 1) + data.reshape(1, -1)) / 2.
select = connect < 1.97

# Create a topoplot instance :
t = Topo()

# Add the topoplot defined using xyz coordinates :
t.add_topoplot('Topo_1', data, xyz=xyz, title='Connectivity example',
               cblabel='Beta power', c_connect=connect, c_select=select,
               cmap='viridis', c_linewidth=4., c_cmap='plasma')

# Show the window :
t.show()

Total running time of the script: ( 0 minutes 0.000 seconds)

Gallery generated by Sphinx-Gallery