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

Add verbosity.

parent 22053a35
No related branches found
No related tags found
1 merge request!413Resolve RTSD-271 "C"
......@@ -134,7 +134,7 @@ class PolyPhaseFirFilterStructure:
return outData
def upsample(x, Nup, coefs, verify=False): # interpolate
def upsample(x, Nup, coefs, verify=False, verbosity=1): # interpolate
"""Upsample x by factor I = Nup
Input:
......@@ -143,6 +143,7 @@ def upsample(x, Nup, coefs, verify=False): # interpolate
. coefs: FIR filter coefficients for antialiasing LPF
. verify: when True then verify that output y is the same when calculated directly or when calculated using the
polyphase implementation.
- verbosity: when > 0 print() status, else no print()
Return:
. y: Upsampled output signal y[m]
......@@ -242,6 +243,7 @@ def upsample(x, Nup, coefs, verify=False): # interpolate
else:
print('ERROR: wrong upsample result')
if verbosity:
print('> upsample():')
print('. Nup = ' + str(Nup))
print('. Nx = ' + str(Nx))
......@@ -250,7 +252,7 @@ def upsample(x, Nup, coefs, verify=False): # interpolate
return y
def downsample(x, Ndown, coefs, verify=False): # decimate
def downsample(x, Ndown, coefs, verify=False, verbosity=1): # decimate
"""Downsample x by factor D = Ndown up
Input:
......@@ -259,6 +261,7 @@ def downsample(x, Ndown, coefs, verify=False): # decimate
. coefs: FIR filter coefficients for antialiasing LPF
. verify: when True then verify that output y is the same when calculated directly or when calculated using the
polyphase implementation.
- verbosity: when > 0 print() status, else no print()
Return:
. y: Downsampled output signal y[m]
......@@ -368,6 +371,7 @@ def downsample(x, Ndown, coefs, verify=False): # decimate
else:
print('ERROR: wrong downsample result')
if verbosity:
print('> downsample():')
print('. len(x) = ' + str(len(x)))
print('. Ndown = ' + str(Ndown))
......@@ -378,7 +382,7 @@ def downsample(x, Ndown, coefs, verify=False): # decimate
return y
def resample(x, Nup, Ndown, coefs, verify=False): # interpolate and decimate by Nup / Ndown
def resample(x, Nup, Ndown, coefs, verify=False, verbosity=1): # interpolate and decimate by Nup / Ndown
"""Resample x by factor I / D = Nup / Ndown
x[n] --> Nup --> v[m] --> LPF --> w[m] --> Ndown --> y[k]
......@@ -408,6 +412,7 @@ def resample(x, Nup, Ndown, coefs, verify=False): # interpolate and decimate by
. coefs: FIR filter coefficients for antialiasing LPF
. verify: when True then verify that output y is the same when calculated directly or when calculated using the
polyphase implementation.
- verbosity: when > 0 print() status, else no print()
Return:
. y: Resampled output signal y[m]
......@@ -458,6 +463,7 @@ def resample(x, Nup, Ndown, coefs, verify=False): # interpolate and decimate by
else:
print('ERROR: wrong resample result')
if verbosity:
print('> resample():')
print('. len(x) = ' + str(len(x)))
print('. Nx = ' + str(Nx))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment