.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_cluster_viz.py: ======================================== Visualize results of cluster-based tests ======================================== This example demonstrates the basic functionality of :class:`borsar.cluster.Clusters` to visualize cluster-level effects. .. code-block:: python # Author: MikoĊ‚aj Magnuski # License: BSD (3-clause) We'll first download borsar example data. .. code-block:: python from borsar.utils import download_test_data download_test_data() We are going to read the clusters object from a ``.hdf5`` file. The file we are trying to read represents results in channel by frequency space so we will need to additionally attach an mne info during reading. Let's first create the info object: .. code-block:: python import mne mntg = mne.channels.read_montage('easycap-M1') info = mne.create_info(mntg.ch_names, sfreq=250., ch_types='eeg', montage=mntg) Now we read the file. .. code-block:: python import os.path as op from borsar.utils import _get_test_data_dir from borsar.cluster import read_cluster data_dir = _get_test_data_dir() fname = op.join(data_dir, 'chan_alpha_range.hdf5') clst = read_cluster(fname, info=info) First let's plot the topography of the second cluster's effect in frequency range from 8 to 8.5 Hz: .. code-block:: python topo = clst.plot(cluster_idx=1, freq=[8, 8.5]) .. image:: /auto_examples/images/sphx_glr_plot_cluster_viz_001.png :class: sphx-glr-single-img We can also see how specific frequencies contribute to each cluster by the number of channels participating in each cluster at given frequency: .. code-block:: python clst.plot_contribution('freq') .. image:: /auto_examples/images/sphx_glr_plot_cluster_viz_002.png :class: sphx-glr-single-img **Total running time of the script:** ( 0 minutes 5.288 seconds) .. _sphx_glr_download_auto_examples_plot_cluster_viz.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: plot_cluster_viz.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_cluster_viz.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_