neuralop.utils.spectrum_2d
- neuralop.utils.spectrum_2d(signal, n_observations, normalize=True)[source]
This function computes the spectrum of a 2D signal using the Fast Fourier Transform (FFT).
- Parameters:
- signala tensor of shape (T * n_observations * n_observations)
A 2D discretized signal represented as a 1D tensor with shape (T * n_observations * n_observations), where T is the number of time steps and n_observations is the spatial size of the signal.
T can be any number of channels that we reshape into and n_observations * n_observations is the spatial resolution.
- n_observations: an integer
Number of discretized points. Basically the resolution of the signal.
- normalize: bool
whether to apply normalization to the output of the 2D FFT. If True, normalizes the outputs by
1/n_observations(actually1/sqrt(n_observations * n_observations)).- Returns
- ——–
- spectrum: a tensor
A 1D tensor of shape (s,) representing the computed spectrum. The spectrum is computed using a square approximation to radial binning, meaning that the wavenumber ‘bin’ into which a particular coefficient is the coefficient’s location along the diagonal, indexed from the top-left corner of the 2d FFT output.