mne_connectivity.wsmi#

mne_connectivity.wsmi(data, kernel, tau, indices='lower', sfreq=None, names=None, tmin=None, tmax=None, anti_aliasing='auto', weighted=True, average=False, verbose=None)[source]#

Compute weighted symbolic mutual information (wSMI).

Parameters:
dataarray_like, shape (n_epochs, n_signals, n_times) | Epochs

The data from which to compute connectivity. Can be an mne.Epochs object or array-like data.

kernelint

Pattern length (symbol dimension) for symbolic analysis. Must be > 1. Values > 7 may require significant memory.

tauint

Time delay (lag; in samples) between consecutive pattern elements. Must be > 0.

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 an array-like.

namesarray_like | None

A list of names associated with the signals in data. If None and data is an mne.Epochs object, the names in data will be used. If data is an array-like, the names will be a list of indices of the number of nodes.

tminfloat | None

Time to start connectivity estimation. Note: when data is an array-like, the first sample is assumed to be at time 0. For mne.Epochs, the time information contained in the object is used to compute the time indices. If None, uses the first sample.

tmaxfloat | None

Time to end connectivity estimation. Note: when data is an array-like, the first sample is assumed to be at time 0. For mne.Epochs, the time information contained in the object is used to compute the time indices. If None, uses the last sample.

anti_aliasing'auto' | bool

Controls anti-aliasing low-pass filtering before symbolic transformation.

  • 'auto' (default): Smart detection based on data type and preprocessing. For array inputs, always applies filtering. For mne.Epochs, checks info['lowpass'] to determine if data is already appropriately filtered. Only applies filtering if existing lowpass > required frequency.

  • True: Always apply an anti-aliasing filter at sfreq / kernel / tau Hz.

  • False: Never apply filtering. Use only if you have already applied appropriate low-pass filtering to your data.

Warning

Setting to False may produce unreliable results if the effective sampling rate (sfreq / tau) violates the Nyquist criterion for the spectral content of your data.

weightedbool

Whether to compute weighted SMI (wSMI) or standard SMI. If True (default), computes wSMI with distance-based weights. If False, computes standard SMI without weights.

averagebool

Whether to average connectivity across epochs. If True, returns connectivity averaged over epochs. If False (default), returns connectivity for each epoch separately.

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:
conninstance of Connectivity or EpochConnectivity

Computed connectivity measure. If average=True, returns a Connectivity instance with connectivity averaged across epochs. If average=False, returns an EpochConnectivity instance with connectivity for each epoch.

Notes

The weighted Symbolic Mutual Information (wSMI) is a connectivity measure that quantifies non-linear statistical dependencies between time series based on symbolic dynamics [1].

The method involves:

  1. Symbolic transformation of time series using ordinal patterns

  2. Computation of mutual information between symbolic sequences

  3. Weighting based on pattern distance for enhanced sensitivity

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

Added in version 0.8.

References

Examples using mne_connectivity.wsmi#

Compute connectivity using weighted symbolic mutual information (wSMI)

Compute connectivity using weighted symbolic mutual information (wSMI)