pyffs.util¶
Helper functions.
-
ffs_sample(T, N_FS, T_c, N_s, mod=None)[source]¶ Signal sample positions for
ffs().Return the coordinates at which a signal must be sampled to use
ffs().- Parameters
- Returns
Examples
Let \(\phi: \mathbb{R} \to \mathbb{C}\) be a bandlimited periodic function of period \(T = 1\), bandwidth \(N_{FS} = 5\), and with one period centered at \(T_{c} = \pi\). The sampling points \(t[n] \in \mathbb{R}\) at which \(\phi\) must be evaluated to compute the Fourier Series coefficients \(\left\{ \phi_{k}^{FS}, k = -2, \ldots, 2 \right\}\) with
ffs()are obtained as follows:# Ideally choose N_s to be highly-composite for ffs(). >>> sample_points, idx = ffs_sample(T=1, N_FS=5, T_c=np.pi, N_s=8) >>> np.around(sample_points, 2) # Notice points are not sorted. array([3.2 , 3.33, 3.45, 3.58, 2.7 , 2.83, 2.95, 3.08]) >>> idx array([4, 5, 6, 7, 0, 1, 2, 3])
See also
-
ffsn_sample(T, N_FS, T_c, N_s, mod=None)[source]¶ Signal sample positions for
ffsn().Return the coordinates at which a signal must be sampled to use
ffsn().- Parameters
- Returns
Examples
Let \(\phi: \mathbb{R}^2 \to \mathbb{C}\) be a bandlimited periodic function with periods \(T_x = 1\) and \(T_y = 1\), bandwidths \(N_{FS,x} = 3\) and \(N_{FS,y} = 3\), and with one period centered at \((T_{c,x}, T_{c,y}) = (0, 0)\). The sampling points \([x[m], y[n]] \in \mathbb{R}^2\) at which \(\phi\) must be evaluated to compute the Fourier Series coefficients \(\left\{ \phi_{k_x, k_y}^{FS}, k_x, k_y = -1, \ldots, 1 \right\}\) with
ffsn()are obtained as follows:# Ideally choose number of samples to be highly-composite for ffsn(). >>> sample_points, idx = ffsn_sample(T=[1, 1], N_FS=[3, 3], T_c=[0, 0], N_s=[4, 3]) >>> assert_array_equal(sample_points[0][:, 0], np.array([0.125, 0.375, -0.375, -0.125])) >>> assert_array_equal(sample_points[1][0, :], np.array([0, 1 / 3, -1 / 3])) >>> assert_array_equal(idx[0][:, 0], np.array([2, 3, 0, 1])) >>> assert_array_equal(idx[1][0, :], np.array([1, 2, 0]))
See also