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.Epochs object, or Fourier coefficients for each epoch as an mne.time_frequency.EpochsSpectrum or mne.time_frequency.EpochsTFR object. If time series data, the spectral information will be computed according to the spectral estimation mode (see the mode parameter). If an mne.time_frequency.EpochsSpectrum or mne.time_frequency.EpochsTFR object, existing spectral information will be used and the mode parameter 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 as stc_*. Data can also be a list/generator of arrays, shape (n_signals, n_times), or a list/generator of mne.SourceEstimate or mne.VolSourceEstimate objects.

Changed in version 0.8: Fourier coefficients stored in an mne.time_frequency.EpochsSpectrum or mne.time_frequency.EpochsTFR object can also be passed in as data. Storing multitaper weights in mne.time_frequency.EpochsTFR objects requires mne >= 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 to n_nodes. If a list of names, then it must be equal in length to n_nodes.

indicestuple of 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'.

sfreqfloat | None

The sampling frequency. Required if data is not an mne.Epochs, mne.time_frequency.EpochsSpectrum, or mne.time_frequency.EpochsTFR object.

mode'multitaper' | 'fourier' | 'cwt_morlet'

Spectrum estimation mode. Ignored if data is an mne.time_frequency.EpochsSpectrum or mne.time_frequency.EpochsTFR object.

fminfloat | tuple of float

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 None the frequency corresponding to an epoch length of 5 cycles is used.

fmaxfloat | tuple of float

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.

fdecimint

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.

tminfloat | None

Time to start connectivity estimation. Ignored if data is an mne.time_frequency.EpochsSpectrum object.

tmaxfloat | None

Time to end connectivity estimation. Ignored if data is an mne.time_frequency.EpochsSpectrum object.

mt_bandwidthfloat | None

The bandwidth of the multitaper windowing function in Hz. Only used in 'multitaper' mode. Ignored if data is an mne.time_frequency.EpochsSpectrum or mne.time_frequency.EpochsTFR object.

mt_adaptivebool

Use adaptive weights to combine the tapered spectra into PSD. Only used in 'multitaper' mode. Ignored if data is an mne.time_frequency.EpochsSpectrum or mne.time_frequency.EpochsTFR object.

mt_low_biasbool

Only use tapers with more than 90 percent spectral concentration within bandwidth. Only used in 'multitaper' mode. Ignored if data is an mne.time_frequency.EpochsSpectrum or mne.time_frequency.EpochsTFR object.

cwt_freqsarray_like

Array-like of frequencies of interest. Only used in 'cwt_morlet' mode. Ignored if data is an mne.time_frequency.EpochsSpectrum or mne.time_frequency.EpochsTFR object.

cwt_n_cyclesfloat | array_like

Number of cycles. Fixed number or one per frequency. Only used in 'cwt_morlet' mode. Ignored if data is an mne.time_frequency.EpochsSpectrum or mne.time_frequency.EpochsTFR object.

block_sizeint

How many connections to compute at once (higher numbers are faster but require more memory).

n_jobsint

How many epochs to process in parallel.

verbosebool | str | int | None

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:
psiinstance of SpectralConnectivity or SpectroTemporalConnectivity

Computed connectivity measure. Either a SpectralConnectivity, or SpectroTemporalConnectivity container. 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' mode

  • n_cons = n_signals ** 2 when indices='all'

  • n_cons = n_signals * (n_signals - 1) / 2 when indices is 'lower' or 'upper'

  • n_cons = len(indices[0]) when indices is supplied as a tuple of arrays

  • n_bands is the number of frequency bands defined by fmin and fmax

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 indices parameter 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#

Comparison of coherency-based methods

Comparison of coherency-based methods

Compute Phase Slope Index (PSI) in source space for a visual stimulus

Compute Phase Slope Index (PSI) in source space for a visual stimulus