mne_connectivity.spectral_connectivity_time#
- mne_connectivity.spectral_connectivity_time(data, names=None, method='coh', indices=None, sfreq=6.283185307179586, foi=None, sm_times=0.5, sm_freqs=1, sm_kernel='hanning', mode='cwt_morlet', mt_bandwidth=None, freqs=None, n_cycles=7, decim=1, block_size=None, n_jobs=1, verbose=None)[source]#
Compute frequency- and time-frequency-domain connectivity measures.
This method computes single-Epoch time-resolved spectral connectivity.
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.
- Parameters
data :
EpochsThe data from which to compute connectivity.
names :
list|np.ndarray|NoneThe names of the nodes of the dataset used to compute connectivity. If ‘None’ (default), then names will be a list of integers from 0 to
n_nodes. If a list of names, then it must be equal in length ton_nodes.Connectivity measure(s) to compute. These can be
['coh', 'plv', 'sxy']. These are:‘coh’ : Coherence
‘plv’ : Phase-Locking Value (PLV)
‘sxy’ : Cross-spectrum
By default, the coherence is used.
indices :
tupleofarray|NoneTwo arrays with indices of connections for which to compute connectivity. I.e. it is a
(n_pairs, 2)array essentially. If None, all connections are computed.sfreq :
floatThe sampling frequency.
foi : array_like |
NoneExtract frequencies of interest. This parameters should be an array of shapes (n_foi, 2) defining where each band of interest start and finish.
sm_times :
floatAmount of time to consider for the temporal smoothing in seconds. By default, 0.5 sec smoothing is used.
sm_freqs :
intNumber of points for frequency smoothing. By default, 1 is used which is equivalent to no smoothing.
sm_kernel : {‘square’, ‘hanning’}
Kernel type to use. Choose either ‘square’ or ‘hanning’ (default).
mode :
str, optionalSpectrum estimation mode can be either: ‘multitaper’, or ‘cwt_morlet’.
The bandwidth of the multitaper windowing function in Hz. Only used in ‘multitaper’ mode.
freqs :
arrayArray of frequencies of interest for use in time-frequency decomposition method (specified by
mode).n_cycles :
float|arrayoffloatNumber of cycles for use in time-frequency decomposition method (specified by
mode). Fixed number or one per frequency.decim :
int| 1To reduce memory usage, decimation factor after time-frequency decomposition. default 1 If int, returns tfr[…, ::decim]. If slice, returns tfr[…, decim].
block_size :
intHow many connections to compute at once (higher numbers are faster but require more memory).
n_jobs :
intHow many epochs to process in parallel.
verbose : bool,
str,int, orNoneIf not None, override default verbose level (see
mne.verbose()for more info). If used, it should be passed as a keyword-argument only.- Returns
con :
array| instance ofConnectivityComputed connectivity measure(s). Either an instance of
SpectralConnectivityorSpectroTemporalConnectivity. The shape of each connectivity dataset is either (n_signals ** 2, n_freqs) mode: ‘multitaper’ or ‘fourier’ (n_signals ** 2, n_freqs, n_times) mode: ‘cwt_morlet’ when “indices” is None, or (n_con, n_freqs) mode: ‘multitaper’ or ‘fourier’ (n_con, n_freqs, n_times) mode: ‘cwt_morlet’ when “indices” is specified and “n_con = len(indices[0])”.
See also
Notes
This function was originally implemented in
fritesand was ported over.New in version 0.3.