pybispectra.utils.compute_tfr#

pybispectra.utils.compute_tfr(data: ndarray, sampling_freq: int | float, freqs: ndarray, tfr_mode: str = 'morlet', n_cycles: ndarray | int | float = 7.0, zero_mean_wavelets: bool | None = None, use_fft: bool = True, multitaper_time_bandwidth: int | float = 4.0, n_jobs: int = 1, verbose: bool = True) tuple[ndarray, ndarray][source]#

Compute the amplitude time-frequency representation (TFR) of data.

Parameters:
datandarray, shape of [epochs, channels, times]

Real-valued data to compute the amplitude TFR of.

sampling_freqint | float

Sampling frequency (in Hz) of data.

freqsndarray, shape of [frequencies]

Frequencies (in Hz) to return the TFR for.

tfr_modestr (default "morlet")

Mode for computing the TFR. Accepts "morlet" and "multitaper". See mne.time_frequency.tfr_array_morlet() and mne.time_frequency.tfr_array_multitaper().

n_cyclesndarray, shape of [frequencies] | int | float (default 7.0)

Number of cycles in the wavelet when computing the TFR. If an array, the number of cycles is given for each frequency, otherwise a fixed value across all frequencies is used.

zero_mean_waveletsbool | None (default None)

Whether or not to use wavelets with a mean of 0. If None, the default argument of tfr_array_morlet() and tfr_array_multitaper() is used according to tfr_mode.

use_fftbool default (True)

Whether or not to use the fast Fourier transform for convolutions.

multitaper_time_bandwidthint | float (default 4.0)

Product between the temporal window length (in seconds) and the frequency bandwidth (in Hz). Only used if tfr_mode = "multitaper". See tfr_array_multitaper() for more information.

n_jobsint (default 1)

Number of jobs to run in parallel. If -1, all available CPUs are used.

verbosebool (default True)

Whether or not to report the status of the processing.

Returns:
tfrndarray, shape of [epochs, channels, frequencies, times]

Amplitude/power of the TFR of data.

freqsndarray of float, shape of [frequencies]

Frequencies (in Hz) in :attr`tfr`.

Notes

This function acts as a wrapper around the MNE TFR computation functions mne.time_frequency.tfr_array_morlet() and mne.time_frequency.tfr_array_multitaper() with output = "power".