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:
- data
ndarray
, shape of [epochs, channels, times] Real-valued data to compute the amplitude TFR of.
- sampling_freq
int
|float
Sampling frequency (in Hz) of
data
.- freqs
ndarray
, shape of [frequencies] Frequencies (in Hz) to return the TFR for.
- tfr_mode
str
(default"morlet"
) Mode for computing the TFR. Accepts
"morlet"
and"multitaper"
. Seemne.time_frequency.tfr_array_morlet()
andmne.time_frequency.tfr_array_multitaper()
.- n_cycles
ndarray
, shape of [frequencies] |int
|float
(default7.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_wavelets
bool
|None
(defaultNone
) Whether or not to use wavelets with a mean of 0. If
None
, the default argument oftfr_array_morlet()
andtfr_array_multitaper()
is used according totfr_mode
.- use_fft
bool
default (True
) Whether or not to use the fast Fourier transform for convolutions.
- multitaper_time_bandwidth
int
|float
(default4.0
) Product between the temporal window length (in seconds) and the frequency bandwidth (in Hz). Only used if
tfr_mode = "multitaper"
. Seetfr_array_multitaper()
for more information.- n_jobs
int
(default1
) Number of jobs to run in parallel. If
-1
, all available CPUs are used.- verbose
bool
(defaultTrue
) Whether or not to report the status of the processing.
- data
- Returns:
Notes
This function acts as a wrapper around the MNE TFR computation functions
mne.time_frequency.tfr_array_morlet()
andmne.time_frequency.tfr_array_multitaper()
withoutput = "power"
.