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 :
Epochs
The data from which to compute connectivity.
names :
list
|np.ndarray
|None
The 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 :
tuple
ofarray
|None
Two 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 :
float
The sampling frequency.
foi : array_like |
None
Extract 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 :
float
Amount of time to consider for the temporal smoothing in seconds. By default, 0.5 sec smoothing is used.
sm_freqs :
int
Number 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 :
array
Array of frequencies of interest for use in time-frequency decomposition method (specified by
mode
).n_cycles :
float
|array
offloat
Number 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 :
int
How many connections to compute at once (higher numbers are faster but require more memory).
n_jobs :
int
How many epochs to process in parallel.
verbose : bool,
str
,int
, orNone
If 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 ofConnectivity
Computed connectivity measure(s). Either an instance of
SpectralConnectivity
orSpectroTemporalConnectivity
. 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
frites
and was ported over.New in version 0.3.