Load.fourier#

pyPLUTO.Load.fourier(self, f: ndarray, check: bool = True, **kwargs: Any) tuple[list[ndarray], ndarray][source]#

Compute the Fourier transform of a given array. The function uses the numpy.fft.fftn function. The function returns a tuple containing the transformed array and the frequency array (which is a list of arrays if the input is in 2D or 3D).

Parameters:
- dx: float | int | list | np.ndarray | None, default None

The grid spacing. If None, the grid spacing is set to 1.

- dy: float | int | list | np.ndarray | None, default None

The grid spacing. If None, the grid spacing is set to 1.

- dz: float | int | list | np.ndarray | None, default None

The grid spacing. If None, the grid spacing is set to 1.

- f (not optional): np.ndarray

The array to be transformed.

- xdir: bool, default True

If True, the x-direction is transformed.

- ydir: bool, default True

If True, the y-direction is transformed.

- zdir: bool, default True

If True, the z-direction is transformed.

—-
Returns:
  • f: np.ndarray

    The transformed array.

  • freqs: np.ndarray | list[np.ndarray]

    The frequency array. It is a list of arrays if the input is in 2D or 3D.

Examples

  • Example #1: Compute the Fourier transform of a given array

    >>> freqs, f = fourier(func)
    
  • Example #2: Compute the Fourier transform of a given array in 2D with custom grid spacing

    >>> freqs, f = fourier(func, dx=1, dy=1)
    
  • Example #3: Compute the Fourier transform of a 3D without considering the x-direction

    >>> freqs, f = fourier(func, xdir=False)