mne_connectivity.phase_slope_index#
- mne_connectivity.phase_slope_index(data, names=None, indices='lower', sfreq=None, *, mode='multitaper', fmin=None, fmax=inf, fdecim=1, 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 the Phase Slope Index (PSI) connectivity measure.
The PSI is an effective connectivity measure, i.e., a measure which can give an indication of the direction of the information flow (causality). For two time series, one computes the PSI between the first and the second time series as follows:
indices = (np.array([0]), np.array([1])) psi = phase_slope_index(data, indices=indices, ...)
A positive value means that time series 0 is ahead of time series 1 and a negative value means the opposite.
The PSI is computed from the coherency (see
spectral_connectivity_epochs()), details can be found in [1].- Parameters:
- dataarray_like, shape (n_epochs, n_signals, n_times) |
Epochs| generator |EpochsSpectrum|EpochsTFR The data from which to compute connectivity. Can be epoched time series data as an array-like or
mne.Epochsobject, or Fourier coefficients for each epoch as anmne.time_frequency.EpochsSpectrumormne.time_frequency.EpochsTFRobject. If time series data, the spectral information will be computed according to the spectral estimation mode (see themodeparameter). If anmne.time_frequency.EpochsSpectrumormne.time_frequency.EpochsTFRobject, existing spectral information will be used and themodeparameter will be ignored.Note that it is also possible to combine multiple time series signals by providing a list of tuples, e.g.:
data = [(arr_0, stc_0), (arr_1, stc_1), (arr_2, stc_2)]
which corresponds to 3 epochs where
arr_*is an array with the same number of time points asstc_*. Data can also be a list/generator of arrays, shape(n_signals, n_times), or a list/generator ofmne.SourceEstimateormne.VolSourceEstimateobjects.Changed in version 0.8: Fourier coefficients stored in an
mne.time_frequency.EpochsSpectrumormne.time_frequency.EpochsTFRobject can also be passed in as data. Storing multitaper weights inmne.time_frequency.EpochsTFRobjects requiresmne >= 1.10.- namesarray_like |
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 ton_nodes. If a list of names, then it must be equal in length ton_nodes.- indices
tupleof array_like |'lower'|'upper'|'all' The indices of channels to compute connectivity between. If a tuple, then must contain two array-likes, where the first array represents the channel indices of the seeds, and the second array represents the channel indices of the targets. See the notes section for more information. If
'lower', compute the lower-triangular part of the connectivity matrix. If'upper', compute the upper-triangular part of the connectivity matrix. If'all', compute all connections. Default is'lower'.- sfreq
float|None The sampling frequency. Required if
datais not anmne.Epochs,mne.time_frequency.EpochsSpectrum, ormne.time_frequency.EpochsTFRobject.- mode
'multitaper'|'fourier'|'cwt_morlet' Spectrum estimation mode. Ignored if
datais anmne.time_frequency.EpochsSpectrumormne.time_frequency.EpochsTFRobject.- fmin
float|tupleoffloat The lower frequency of interest. Multiple bands are defined using a tuple, e.g., (8., 20.) for two bands with 8 Hz and 20 Hz lower freq. If
Nonethe frequency corresponding to an epoch length of 5 cycles is used.- fmax
float|tupleoffloat The upper frequency of interest. Multiple bands are defined using a tuple, e.g., (13., 30.) for two bands with 13 Hz and 30 Hz upper freq.
- fdecim
int Decimation factor in the frequency domain. Selects every Nth frequency bin from the (time-)frequency decomposition (where N is the value of
fdecim). If 1 (default), no decimation occurs.Added in version 0.8.
- tmin
float|None Time to start connectivity estimation. Ignored if
datais anmne.time_frequency.EpochsSpectrumobject.- tmax
float|None Time to end connectivity estimation. Ignored if
datais anmne.time_frequency.EpochsSpectrumobject.- mt_bandwidth
float|None The bandwidth of the multitaper windowing function in Hz. Only used in
'multitaper'mode. Ignored ifdatais anmne.time_frequency.EpochsSpectrumormne.time_frequency.EpochsTFRobject.- mt_adaptivebool
Use adaptive weights to combine the tapered spectra into PSD. Only used in
'multitaper'mode. Ignored ifdatais anmne.time_frequency.EpochsSpectrumormne.time_frequency.EpochsTFRobject.- mt_low_biasbool
Only use tapers with more than 90 percent spectral concentration within bandwidth. Only used in
'multitaper'mode. Ignored ifdatais anmne.time_frequency.EpochsSpectrumormne.time_frequency.EpochsTFRobject.- cwt_freqsarray_like
Array-like of frequencies of interest. Only used in
'cwt_morlet'mode. Ignored ifdatais anmne.time_frequency.EpochsSpectrumormne.time_frequency.EpochsTFRobject.- cwt_n_cycles
float| array_like Number of cycles. Fixed number or one per frequency. Only used in
'cwt_morlet'mode. Ignored ifdatais anmne.time_frequency.EpochsSpectrumormne.time_frequency.EpochsTFRobject.- 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.
- verbosebool |
str|int|None If not
None, override default verbose level (seemne.verbose()for more info). If used, it should be passed as a keyword-argument only.
- dataarray_like, shape (n_epochs, n_signals, n_times) |
- Returns:
- psiinstance of
SpectralConnectivityorSpectroTemporalConnectivity Computed connectivity measure. Either a
SpectralConnectivity, orSpectroTemporalConnectivitycontainer. The shape of the connectivity dataset is:(n_cons, n_bands)for'multitaper'or'fourier'modes(n_cons, n_bands, n_times)for'cwt_morlet'moden_cons = n_signals ** 2whenindices='all'n_cons = n_signals * (n_signals - 1) / 2whenindicesis'lower'or'upper'n_cons = len(indices[0])whenindicesis supplied as a tuple of arraysn_bandsis the number of frequency bands defined byfminandfmax
- psiinstance of
See also
Notes
If connectivity for all possible connections is desired, we can save time and memory by only computing and storing the lower- (or upper-) triangular part of the connectivity matrix. When the full set of connectivity values is needed, the missing values can be inferred based on what has been computed. See the notes section of the
get_data()method in the connectivity containers for more information.If one is only interested in the connectivity between some signals, the
indicesparameter can be specified as a tuple of array-likes. For example, to compute the connectivity between the signal with index 0 and the signals with indices 2, 3, and 4 (a total of 3 connections) one can use the following:indices = (np.array([0, 0, 0]), # seed indices np.array([2, 3, 4])) # target indices
References
Examples using mne_connectivity.phase_slope_index#
Compute Phase Slope Index (PSI) in source space for a visual stimulus