pyoculus.solvers.qfm

Functions

irfft1D(cos_in, sin_in[, nfft_multiplier])

Perform 1D inverse Fourier transform from cosine and sine to real space.

irfft2D(cn, sn[, nfft_theta, nfft_phi])

Perform 2D Fourier transform from real space to cosine and sine.

rfft1D(f)

Perform 1D Fourier transform from real space to cosine and sine.

rfft2D(f[, mpol, ntor])

Perform 2D Fourier transform from real space to cosine and sine.

pyoculus.solvers.qfm.rfft1D(f)

Perform 1D Fourier transform from real space to cosine and sine.

Parameters:

f (np.array) – The data in real space. If f is 2D, then the last axis will be the axis along which FFT is computed.

Returns:

A tuple containing:
  • np.array: The cosine components.

  • np.array: The sine components.

Return type:

tuple

pyoculus.solvers.qfm.irfft1D(cos_in, sin_in, nfft_multiplier=1)

Perform 1D inverse Fourier transform from cosine and sine to real space.

Parameters:
  • cos_in (np.array) – The cosine components. If cos_in is 2D, then the last axis will be the axis along which FFT was computed.

  • sin_in (np.array) – The sine components.

  • nfft_multiplier (int, optional) – The number of output points will be this*(cos_in.shape[-1] - 1). Defaults to 1.

Returns:

The function value in real space.

Return type:

np.array

pyoculus.solvers.qfm.rfft2D(f, mpol=None, ntor=None)

Perform 2D Fourier transform from real space to cosine and sine.

Parameters:
  • f (np.array) – The data in real space. If f is 2D, then the last axis will be the axis along which FFT is computed.

  • mpol (int, optional) – The number of theta points on output. Defaults to f.shape[-2] // 4.

  • ntor (int, optional) – The number of phi points on output. Defaults to f.shape[-1] // 4.

Returns:

Cosine components \(n \in \{0, ..., m_{pol}\}\) np.array: Sine components \(n \in \{-n_{tor}, ..., n_{tor}\}\)

Return type:

np.array

pyoculus.solvers.qfm.irfft2D(cn, sn, nfft_theta=None, nfft_phi=None)

Perform 2D Fourier transform from real space to cosine and sine.

Parameters:
  • cn (np.array) – The cosine components.

  • sn (np.array) – The sine components.

  • nfft_theta (int) – The number of theta points on output. Defaults to (cn.shape[0] - 1)*4.

  • nfft_phi (int) – The number of zeta points on output. Defaults to ((cn.shape[1] - 1) // 2)*4.