spectral_connectivity
is a python software package that computes 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 has several differences:
See the notebooks (#1, #2) for more information on how to use the package.
See the documentation here.
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.
Install miniconda (or anaconda) if it isn't already installed. Type into bash (or install from the anaconda website):
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
Clone the repository to your local machine (.../spectral_connectivity
) and install the anaconda environment for the repository. Type into bash:
conda update -q conda
conda info -a
conda env create -f environment.yml
source activate spectral_connectivity
python setup.py develop
from spectral_connectivity import Multitaper, Connectivity
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])
c = Connectivity.from_multitaper(m)
coherence = c.coherence_magnitude()
weighted_phase_lag_index = c.weighted_phase_lag_index()
canonical_coherence = c.canonical_coherence(brain_area_labels)
We hope to take advantage of the labeled data of the xarray
package.