postgkyl.fft

postgkyl.fft(data, *, psd=False, iso=False, inplace=False, tag=None, label=None)

Fourier transform (or power spectral density) of field-domain data.

Wraps numerics.fft: each component is transformed over the spatial axes (dummy axes of length <= 2 are squeezed out first). Supports 1D, 2D, and 3D data. numerics.fft reads its sample spacing straight off the grid array’s own length, so a nodal (edge) grid – one entry longer than the value count, the usual post-.interpolate() shape – is first collapsed to cell centers (matching values); a grid that already matches (e.g. a dynvector’s) is passed through unchanged.

Parameters:
  • data – the dataset to transform; must contain point values (call .interpolate() first on native modal data).

  • psd – when True, return the power spectral density |FT|^2 over the positive frequencies only.

  • iso – when True (only meaningful for 2D/3D data with psd=True), bin the PSD into a 1D isotropic spectrum over the polar wavenumber magnitude.

  • inplace – mutate and return data instead of a new dataset.

  • tag – optional tag for the returned dataset.

  • label – optional label for the returned dataset.

Returns:

A dataset whose grid is the frequency/wavenumber axis (axes) and whose values are the transform, PSD, or isotropic spectrum.

Raises:

ValueError – if data is unevaluated modal coefficients, or if isotropic binning is requested for data that is not 2D/3D.

CLI: fft