Skip to content
Snippets Groups Projects
Commit 771f9195 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Support verbosity.

parent 040e1503
No related branches found
No related tags found
1 merge request!411Resolve RTSD-271
...@@ -34,7 +34,7 @@ from .utilities import c_rtol, c_atol, ceil_pow2, is_even ...@@ -34,7 +34,7 @@ from .utilities import c_rtol, c_atol, ceil_pow2, is_even
# Time domain interpolation using DFT # Time domain interpolation using DFT
############################################################################### ###############################################################################
def fourier_interpolate(HFfilter, Ncoefs): def fourier_interpolate(HFfilter, Ncoefs, verbosity=1):
"""Use Fourier interpolation to create final FIR filter coefs. """Use Fourier interpolation to create final FIR filter coefs.
HF contains filter transfer function for N points, in order 0 to fs. The HF contains filter transfer function for N points, in order 0 to fs. The
...@@ -82,6 +82,7 @@ def fourier_interpolate(HFfilter, Ncoefs): ...@@ -82,6 +82,7 @@ def fourier_interpolate(HFfilter, Ncoefs):
# K + 1 + K = N values, because N is odd and K = N // 2 # K + 1 + K = N values, because N is odd and K = N // 2
hInterpolated = np.fft.ifft(HFextended) hInterpolated = np.fft.ifft(HFextended)
if np.allclose(hInterpolated.imag, np.zeros(Ncoefs), rtol=c_rtol, atol=c_atol): if np.allclose(hInterpolated.imag, np.zeros(Ncoefs), rtol=c_rtol, atol=c_atol):
if verbosity:
print('hInterpolated.imag ~= 0') print('hInterpolated.imag ~= 0')
else: else:
print('WARNING: hInterpolated.imag != 0 (max(abs) = %e)' % np.max(np.abs(hInterpolated.imag))) print('WARNING: hInterpolated.imag != 0 (max(abs) = %e)' % np.max(np.abs(hInterpolated.imag)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment