frites.conn.conn_spec#

frites.conn.conn_spec(data, freqs=None, metric='coh', roi=None, times=None, sfreq=None, foi=None, sm_times=0.5, sm_freqs=1, sm_kernel='hanning', mode='morlet', n_cycles=7.0, mt_bandwidth=None, decim=1, kw_cwt={}, kw_mt={}, block_size=None, n_jobs=-1, verbose=None, dtype=<class 'numpy.float32'>, mean_trials=False, **kw_links)[source]#

Wavelet-based single-trial time-resolved spectral connectivity.

Parameters
datanumpy:array_like

Electrophysiological data. Several input types are supported :

  • Standard NumPy arrays of shape (n_epochs, n_roi, n_times)

  • mne.Epochs

  • xarray.DataArray of shape (n_epochs, n_roi, n_times)

metricpython:str | “coh”

Which connectivity metric. Use either :

  • ‘coh’ : Coherence

  • ‘plv’ : Phase-Locking Value (PLV)

  • ‘sxy’ : Cross-spectrum

By default, the coherenc is used.

freqsnumpy:array_like

Array of central frequencies of shape (n_freqs,).

roinumpy:array_like | python:None

ROI names of a single subject. If the input is an xarray, the name of the ROI dimension can be provided

timesnumpy:array_like | python:None

Time vector array of shape (n_times,). If the input is an xarray, the name of the time dimension can be provided

sfreqpython:float | python:None

Sampling frequency

foinumpy:array_like | python:None

Extract frequencies of interest. This parameters should be an array of shapes (n_foi, 2) defining where each band of interest start and finish.

sm_timespython:float | .5

Number of points to consider for the temporal smoothing in seconds. By default, a 500ms smoothing is used.

sm_freqspython:int | 1

Number of points for frequency smoothing. By default, 1 is used which is equivalent to no smoothing

kernel{‘square’, ‘hanning’}

Kernel type to use. Choose either ‘square’ or ‘hanning’

mode{‘morlet’, ‘multitaper’}

Spectrum estimation mode can be either: ‘multitaper’ or ‘morlet’.

n_cyclesnumpy:array_like | 7.

Number of cycles to use for each frequency. If a float or an integer is used, the same number of cycles is going to be used for all frequencies

mt_bandwidthnumpy:array_like | python:None

The bandwidth of the multitaper windowing function in Hz. Only used in ‘multitaper’ mode.

decimpython:int | 1

To reduce memory usage, decimation factor after time-frequency decomposition. default 1 If int, returns tfr[…, ::decim]. If slice, returns tfr[…, decim].

kw_cwtpython:dict | {}

Additional arguments sent to the mne-function :py:`mne.time_frequency.tfr_array_morlet`

kw_mtpython:dict | {}

Additional arguments sent to the mne-function :py:`mne.time_frequency.tfr_array_multitaper`

block_sizepython:int | python:None

Number of blocks of trials to process at once. This parameter can be use in order to decrease memory load. If None, all trials are used. If for example block_size=2, the number of trials are subdivided into two groups and each group is process one after the other.

n_jobspython:int | 1

Number of jobs to use for parallel computing (use -1 to use all jobs). The parallel loop is set at the pair level.

kw_linkspython:dict | {}

Additional arguments for selecting links to compute are passed to the function frites.conn.conn_links()

Returns
connxarray.DataArray

DataArray of shape (n_trials, n_pairs, n_freqs, n_times)

See also

conn_links