pyffs.func

Methods for computing samples and Fourier Series coefficients of specific functions.

dirichlet(x, T, T_c, N_FS)[source]

Return samples of a shifted Dirichlet kernel of period \(T\) and bandwidth \(N_{FS} = 2 N + 1\):

\[\phi(t) = \sum_{k = -N}^{N} \exp\left( j \frac{2 \pi}{T} k (t - T_{c}) \right) = \frac{\sin\left( N_{FS} \pi [t - T_{c}] / T \right)}{\sin\left( \pi [t - T_{c}] / T \right)}.\]
Parameters:
  • x (ndarray) – Sampling points.

  • T (float) – Function period.

  • T_c (float) – Period mid-point.

  • N_FS (int) – Function bandwidth.

Returns:

vals – Function values.

Return type:

ndarray

See also

dirichlet_fs()

dirichlet_fs(N_FS, T, T_c, mod=None)[source]

Return Fourier Series coefficients of a shifted Dirichlet kernel of period \(T\) and bandwidth \(N_{FS} = 2 N + 1\).

Parameters:
  • N_FS (int) – Function bandwidth.

  • T (float) – Function period.

  • T_c (float) – Period mid-point.

  • mod (func) – Module to be used to process array (numpy or cupy).

Returns:

vals – Fourier Series coefficients in ascending order.

Return type:

ndarray

See also

dirichlet()

(N_FS,) Fourier Series coefficients.

dirichlet_2D(sample_points, T, T_c, N_FS)[source]

Return samples of a shifted 2D Dirichlet kernel of period \((T_x, T_y)\) and bandwidth \(N_{FS, x} = 2 N_x + 1, N_{FS, y} = 2 N_y + 1\):

\[\begin{split}\phi(x, y) &= \sum_{k_x = -N_x}^{N_x} \sum_{k_y = -N_y}^{N_y} \exp\left( j \frac{2 \pi}{T_x} k_x (x - T_{c,x}) \right) \exp\left( j \frac{2 \pi}{T_y} k_y (y - T_{c,y}) \right) \\ &= \frac{\sin\left( N_{FS, x} \pi [x - T_{c,x}] / T_x \right)}{\sin\left( \pi [x - T_{c, x}] / T_x \right)} \frac{\sin\left( N_{FS, y} \pi [y - T_{c,y}] / T_y \right)}{\sin\left( \pi [y - T_{c, y}] / T_y \right)}.\end{split}\]
Parameters:
  • sample_points (list(ndarray)) – (2,) coordinates at which to sample the function in the x- and y-dimensions respectively. Array dimensions must be compatible after broadcasting.

  • T (list(float)) – Function period.

  • T_c (list(float)) – Period mid-point.

  • N_FS (list(int)) – Function bandwidth.

Returns:

vals – Function values at sample_points.

Return type:

ndarray