transfreq.functions.compute_transfreq

transfreq.functions.compute_transfreq(psds, freqs, ch_names=None, theta_range=None, alpha_range=None, method=4, iterative=True)

Automatically compute transition frequency

Parameters:
psds: array, shape (N_sensors, N_freqs)

power spectral matrix

freqs: array, shape (N_freqs,)

frequencies at which the psds is computed

ch_names: None | list of strings (default None)

name of the channels (must be ordered as they are in psds)

theta_range: tuple | list | array | None (default None)

theta range to compute alpha coefficients (eg: (5,7), [5,7], np.array([5,7])). If None it is set automatically

alpha_range: tuple | list | array | None (default None)

alpha range to compute theta coefficients (eg: (9,11), [9,11], np.array([9,11])). If None it is set automatically

method: 1, 2, 3, 4 (default 4)

clustering method

iterative: bool (default True)

Whether to use the iterative method (default) or not

Returns:
tfbox: dictionary

Dictionary containing:

  • the method used to compute the cluster

  • the cluster: pandas dataframe (rows: alpha coefficients,theta coefficients, clustering labels; columns:channel names)

  • the transition frequency (tf)