mne_connectivity.phase_slope_index_time#

mne_connectivity.phase_slope_index_time(data, freqs=None, indices=None, sfreq=None, mode='cwt_morlet', average=False, fmin=None, fmax=None, fskip=0, sm_times=0.0, sm_freqs=1, sm_kernel='hanning', padding=0.0, mt_bandwidth=4.0, n_cycles=7.0, decim=1, n_jobs=1, verbose=None)[source]#

Compute the Phase Slope Index (PSI) connectivity measure over time.

This function computes PSI over time from epoched data. The data may consist of a single epoch.

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_time(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_time()), details can be found in [1].

Parameters:
dataarray_like, shape (n_epochs, n_signals, n_times) | Epochs | 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.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.EpochsTFR object, existing spectral information will be used and the mode parameter will be ignored.

Changed in version 0.8: Fourier coefficients stored in an 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.

freqsarray_like | None

Array-like of frequencies of interest for time-frequency decomposition. Only the frequencies within the range specified by fmin and fmax are used. If data is an array-like or mne.Epochs object, the frequencies must be specified. If data is an mne.time_frequency.EpochsTFR object, data.freqs is used and this parameter is ignored.

indicestuple of array_like | None

Two array-likes with indices of connections for which to compute connectivity. If None (default), all connections are computed.

sfreqfloat | None

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

mode'multitaper' | 'cwt_morlet'

Time-frequency decomposition method ('cwt_morlet' default). See mne.time_frequency.tfr_array_multitaper() and mne.time_frequency.tfr_array_morlet() for reference. Ignored if data is an mne.time_frequency.EpochsTFR object.

averagebool

Average connectivity scores over epochs. If True, output will be an instance of SpectralConnectivity, or EpochSpectralConnectivity if False (default).

fminfloat | tuple of float | None

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 bounds. If None (default), the lowest frequency in freqs is used.

fmaxfloat | tuple of float | None

The upper frequency of interest. Multiple bands are defined using a tuple, e.g. (13., 30.) for two band with 13 Hz and 30 Hz upper bounds. If None (default), the highest frequency in freqs is used.

fskipint

Omit every (fskip + 1)-th frequency bin to decimate in frequency domain. Default is 0 (no skipping).

sm_timesfloat

Amount of time to consider for the temporal smoothing, in seconds. If 0.0 (default), no temporal smoothing is applied.

sm_freqsint

Number of points for frequency smoothing. If 1 (default), no spectral smoothing is applied.

sm_kernel'square' | 'hanning'

Smoothing kernel type. For 'hanning', see numpy.hanning().

paddingfloat

Amount of time to consider as padding at the beginning and end of each epoch in seconds (0.0 default for no padding). See Notes of spectral_connectivity_time() for more information.

mt_bandwidthfloat

Product between the temporal window length (in seconds) and the full frequency bandwidth (in Hz; default 4.0). This product can be seen as the surface of the window on the time/frequency plane and controls the frequency bandwidth (thus the frequency resolution) and the number of good tapers. See mne.time_frequency.tfr_array_multitaper() documentation. Ignored if data is an mne.time_frequency.EpochsTFR object.

n_cyclesfloat | array_like

Number of cycles in the wavelet, either a fixed number or one per frequency (7.0 default). The number of cycles n_cycles and the frequencies of interest freqs define the temporal window length. For details, see mne.time_frequency.tfr_array_multitaper() and mne.time_frequency.tfr_array_morlet() documentation. Ignored if data is an mne.time_frequency.EpochsTFR object.

decimint

To reduce memory usage, time-domain decimation factor after time-frequency decomposition. Returns tfr[…, ::decim]. If 1 (default), no decimation occurs.

n_jobsint

Number of connections to compute in parallel. Memory mapping must be activated. Please see the Notes section of spectral_connectivity_time() for details.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

Returns:
psiinstance of EpochSpectralConnectivity or SpectralConnectivity

Computed connectivity measure. Either a EpochSpectralConnectivity or SpectralConnectivity container depending on the average parameter. The shape of the connectivity dataset is ([n_epochs,] n_cons, n_bands):

  • The epoch dimension is present when average=False, and absent when average=True.

  • When indices is None, n_cons = n_signals ** 2

  • When indices is specified, n_con = len(indices[0])

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

Notes

Added in version 0.8.

References

Examples using mne_connectivity.phase_slope_index_time#

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

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