mne.connectivity.
spectral_connectivity
(data, method=’coh’, indices=None, sfreq=6.283185307179586, mode=’multitaper’, fmin=None, fmax=inf, fskip=0, faverage=False, tmin=None, tmax=None, mt_bandwidth=None, mt_adaptive=False, mt_low_bias=True, cwt_frequencies=None, cwt_n_cycles=7, block_size=1000, n_jobs=1, verbose=None)[source]¶Compute frequency and timefrequencydomain connectivity measures.
The connectivity method(s) are specified using the “method” parameter. All methods are based on estimates of the cross and power spectral densities (CSD/PSD) Sxy and Sxx, Syy.
The spectral densities can be estimated using a multitaper method with digital prolate spheroidal sequence (DPSS) windows, a discrete Fourier transform with Hanning windows, or a continuous wavelet transform using Morlet wavelets. The spectral estimation mode is specified using the “mode” parameter.
By default, the connectivity between all signals is computed (only connections corresponding to the lowertriangular part of the connectivity matrix). If one is only interested in the connectivity between some signals, the “indices” parameter can be used. For example, to compute the connectivity between the signal with index 0 and signals “2, 3, 4” (a total of 3 connections) one can use the following:
indices = (np.array([0, 0, 0]), # row indices
np.array([2, 3, 4])) # col indices
con_flat = spectral_connectivity(data, method='coh',
indices=indices, ...)
In this case con_flat.shape = (3, n_freqs). The connectivity scores are in the same order as defined indices.
Supported Connectivity Measures
The connectivity method(s) is specified using the “method” parameter. The
following methods are supported (note: E[]
denotes average over
epochs). Multiple measures can be computed at once by using a list/tuple,
e.g., ['coh', 'pli']
to compute coherence and PLI.
‘coh’ : Coherence given by:
 E[Sxy]  C =  sqrt(E[Sxx] * E[Syy])‘cohy’ : Coherency given by:
E[Sxy] C =  sqrt(E[Sxx] * E[Syy])‘imcoh’ : Imaginary coherence [R25] given by:
Im(E[Sxy]) C =  sqrt(E[Sxx] * E[Syy])‘plv’ : PhaseLocking Value (PLV) [R26] given by:
PLV = E[Sxy/Sxy]‘ppc’ : Pairwise Phase Consistency (PPC), an unbiased estimator of squared PLV [R27].
‘pli’ : Phase Lag Index (PLI) [R28] given by:
PLI = E[sign(Im(Sxy))]‘pli2_unbiased’ : Unbiased estimator of squared PLI [R29].
‘wpli’ : Weighted Phase Lag Index (WPLI) [R29] given by:
E[Im(Sxy)] WPLI =  E[Im(Sxy)]‘wpli2_debiased’ : Debiased estimator of squared WPLI [R29].
Parameters:  data : arraylike, shape=(n_epochs, n_signals, n_times)  Epochs
method : string  list of string
indices : tuple of arrays  None
sfreq : float
mode : str
fmin : float  tuple of floats
fmax : float  tuple of floats
fskip : int
faverage : boolean
tmin : float  None
tmax : float  None
mt_bandwidth : float  None
mt_adaptive : bool
mt_low_bias : bool
cwt_frequencies : array
cwt_n_cycles: float  array of float
block_size : int
n_jobs : int
verbose : bool, str, int, or None


Returns:  con : array  list of arrays
freqs : array
times : array
n_epochs : int
n_tapers : int

References
[R25]  (1, 2) Nolte et al. “Identifying true brain interaction from EEG data using the imaginary part of coherency” Clinical neurophysiology, vol. 115, no. 10, pp. 22922307, Oct. 2004. 
[R26]  (1, 2) Lachaux et al. “Measuring phase synchrony in brain signals” Human brain mapping, vol. 8, no. 4, pp. 194208, Jan. 1999. 
[R27]  (1, 2) Vinck et al. “The pairwise phase consistency: a biasfree measure of rhythmic neuronal synchronization” NeuroImage, vol. 51, no. 1, pp. 112122, May 2010. 
[R28]  (1, 2) Stam et al. “Phase lag index: assessment of functional connectivity from multi channel EEG and MEG with diminished bias from common sources” Human brain mapping, vol. 28, no. 11, pp. 11781193, Nov. 2007. 
[R29]  (1, 2, 3, 4) Vinck et al. “An improved index of phasesynchronization for electrophysiological data in the presence of volumeconduction, noise and samplesize bias” NeuroImage, vol. 55, no. 4, pp. 15481565, Apr. 2011. 