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_freqs=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 [1] given by:
Im(E[Sxy]) C =  sqrt(E[Sxx] * E[Syy])‘plv’ : PhaseLocking Value (PLV) [2] given by:
PLV = E[Sxy/Sxy]‘ppc’ : Pairwise Phase Consistency (PPC), an unbiased estimator of squared PLV [3].
‘pli’ : Phase Lag Index (PLI) [4] given by:
PLI = E[sign(Im(Sxy))]‘pli2_unbiased’ : Unbiased estimator of squared PLI [5].
‘wpli’ : Weighted Phase Lag Index (WPLI) [5] given by:
E[Im(Sxy)] WPLI =  E[Im(Sxy)]‘wpli2_debiased’ : Debiased estimator of squared WPLI [5].
Parameters: 


Returns: 

References
[1]  (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. 
[2]  (1, 2) Lachaux et al. “Measuring phase synchrony in brain signals” Human brain mapping, vol. 8, no. 4, pp. 194208, Jan. 1999. 
[3]  (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. 
[4]  (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. 
[5]  (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. 