Frequency domain estimation and functional and directed connectivity analysis tools for electrophysiological data
Tutorials | Documentation | Usage Example | Installation | Citation | Developer Installation
spectral_connectivity
is a Python software package that computes multitaper spectral estimates and frequency-domain brain connectivity measures such as coherence, spectral granger causality, and the phase lag index using the multitaper Fourier transform. Although there are other Python packages that do this (see nitime and MNE-Python), spectral_connectivity
has several differences:
cupy
is installed and the environmental variable SPECTRAL_CONNECTIVITY_ENABLE_GPU
is set to 'true'.See the following notebooks for more information on how to use the package:
from spectral_connectivity import Multitaper, Connectivity
# Compute multitaper spectral estimate
m = Multitaper(time_series=signals,
sampling_frequency=sampling_frequency,
time_halfbandwidth_product=time_halfbandwidth_product,
time_window_duration=0.060,
time_window_step=0.060,
start_time=time[0])
# Sets up computing connectivity measures/power from multitaper spectral estimate
c = Connectivity.from_multitaper(m)
# Here are a couple of examples
power = c.power() # spectral power
coherence = c.coherence_magnitude()
weighted_phase_lag_index = c.weighted_phase_lag_index()
canonical_coherence = c.canonical_coherence(brain_area_labels)
See the documentation here.
For citation, please use the following:
Denovellis, E.L., Myroshnychenko, M., Sarmashghi, M., and Stephen, E.P. (2022). Spectral Connectivity: a python package for computing multitaper spectral estimates and frequency-domain brain connectivity measures on the CPU and GPU. JOSS 7, 4840. 10.21105/joss.04840.
Functional
Directed
spectral_connectivity
requires:
See environment.yml for the most current list of dependencies.
pip install spectral_connectivity
or
conda install -c edeno spectral_connectivity
If you want to make contributions to this library, please use this installation.
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
hash -r
.../spectral_connectivity
) and install the anaconda environment for the repository. Type into bash:conda env create -f environment.yml
conda activate spectral_connectivity
pip install -e .