ctf4science.eval_module.compute_psd#
- ctf4science.eval_module.compute_psd(array: ndarray, k: int, modes: int) ndarray#
Compute the averaged power spectral density over the last k time steps for the given modes.
For each of the last k time steps, takes the FFT of the spatial dimension, computes the power spectrum, FFT-shifts it, and averages the PSD over those steps for modes Fourier modes starting from the center (zero) frequency.
- Parameters:
- array(T, S) ndarray
Data with shape (time_steps, spatial_points).
- kint
Number of last time steps to average over. Must not exceed time_steps.
- modesint
Number of Fourier modes from the center frequency. Must not exceed spatial_points.
- Returns:
- ndarray
Averaged PSD for the specified modes, shape
(modes,).
- Raises:
- ValueError
If k exceeds time_steps or modes exceeds spatial_points.