mne_connectivity.phase_slope_index#
- mne_connectivity.phase_slope_index(data, names=None, indices=None, sfreq='', mode='multitaper', fmin=None, fmax=inf, 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, and 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 Fourier coefficients inmne.time_frequency.EpochsSpectrumobjects requiresmne >= 1.8. 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 |None Two array-likes with indices of connections for which to compute connectivity. If
None, all connections are computed. See Notes ofspectral_connectivity_epochs()for details.- sfreq
float|None The sampling frequency. Default is an empty string for
2*np.piin 0.8, but will change toNonein 0.9. Set it explicitly whendatais an array-like to avoid a warning.- 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.
- 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=Nonen_cons = len(indices[0])whenindicesis suppliedn_bandsis the number of frequency bands defined byfminandfmax
- psiinstance of
See also
References
Examples using mne_connectivity.phase_slope_index#
Compute Phase Slope Index (PSI) in source space for a visual stimulus