pybispectra.utils.compute_fft#

pybispectra.utils.compute_fft(data: ndarray, sampling_freq: int | float, n_points: int | None = None, window: str = 'hanning', n_jobs: int = 1, verbose: bool = True) tuple[ndarray, ndarray][source]#

Compute the fast Fourier transform (FFT) on real-valued data.

As the data is assumed to be real-valued, only those values corresponding to the positive frequencies are returned.

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

Real-valued data to compute the FFT on.

sampling_freqint | float

Sampling frequency (in Hz) of data.

n_pointsint | None (default None)

Number of points to use in the FFT. If None, is equal to the number of timepoints in data. For time delay estimation, it is recommended that n_points=2 * n_times + 1, where n_times is the number of timepoints in each epoch of data.

windowstr (default "hanning")

Type of window to apply to data before computing the FFT. Accepts "hanning" and "hamming". See numpy.hanning() and numpy.hamming().

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:
coeffsndarray, shape of [epochs, channels, frequencies]

Fourier coefficients of :attr:`data.

freqsndarray, shape of [frequencies]

Frequencies (in Hz) in coeffs.