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

Just commit.

parent 09adc0fc
No related branches found
No related tags found
No related merge requests found
Pipeline #84931 passed
This diff is collapsed.
...@@ -77,6 +77,8 @@ def square_root_raised_cosine_response(Ntaps, Nsps, roBeta): ...@@ -77,6 +77,8 @@ def square_root_raised_cosine_response(Ntaps, Nsps, roBeta):
. Ntaps : FIR filter length . Ntaps : FIR filter length
. Nsps: symbol period Tsymbol in number of samples per symbol . Nsps: symbol period Tsymbol in number of samples per symbol
. roBeta : Roll off factor in [0, 1.0] . roBeta : Roll off factor in [0, 1.0]
- roBeta = 0.0: rectangular spectrum with BW = 1 / Tsymbol
- roBeta = 1.0: sqrt cosine spectrum with BW = 2 / Tsymbol
Return: Return:
. hSrRc : impulse response of the square root raised cosine filter. . hSrRc : impulse response of the square root raised cosine filter.
""" """
...@@ -160,7 +162,7 @@ def design_fir_low_pass_filter(method, ...@@ -160,7 +162,7 @@ def design_fir_low_pass_filter(method,
Ncoefs, fpass, fstop, fcutoff=0, cutoffGain=0.5, rippleWeights=[1, 1], Ncoefs, fpass, fstop, fcutoff=0, cutoffGain=0.5, rippleWeights=[1, 1],
kaiserBeta=0, fs=1.0, kaiserBeta=0, fs=1.0,
cutoffBW=0): cutoffBW=0):
"""Derive FIR coefficients for prototype low pass filter """Derive FIR coefficients for low pass filter
Use method 'firls' or 'remez', fs = 1.0 Use method 'firls' or 'remez', fs = 1.0
...@@ -218,7 +220,7 @@ def design_fir_low_pass_filter(method, ...@@ -218,7 +220,7 @@ def design_fir_low_pass_filter(method,
if is_even(N): if is_even(N):
N = N - 1 N = N - 1
if method == 'remez': if method == 'remez':
NRemezMax = 1024 NRemezMax = 512
Q = ceil_div(Ncoefs, NRemezMax) Q = ceil_div(Ncoefs, NRemezMax)
N = Ncoefs // Q N = Ncoefs // Q
...@@ -339,3 +341,16 @@ def prototype_fir_low_pass_filter(method='firls', ...@@ -339,3 +341,16 @@ def prototype_fir_low_pass_filter(method='firls',
# Design subband filter # Design subband filter
h = design_fir_low_pass_filter(method, Ncoefs, fpass, fstop, fcutoff, cutoffGain, rippleWeights, kaiserBeta, fs) h = design_fir_low_pass_filter(method, Ncoefs, fpass, fstop, fcutoff, cutoffGain, rippleWeights, kaiserBeta, fs)
return h return h
###############################################################################
# Filterbank transfer function for prototype LPF
###############################################################################
def derive_filterbank_transfer(HFprototype, Npoints):
Lprototype = len(HFprototype)
Lbin = Lprototype / Npoints
HFbank = np.zeros(Lprototype, dtype='cfloat')
for bi in range(Npoints):
HFbank += np.roll(HFprototype, bi * Lbin)
return HFbank
...@@ -133,6 +133,10 @@ def dtft(coefs, Ndtft=None, zeroCenter=True, fftShift=True): ...@@ -133,6 +133,10 @@ def dtft(coefs, Ndtft=None, zeroCenter=True, fftShift=True):
return h, f, HF return h, f, HF
###############################################################################
# Estimate f for certain gain or estimate gain for certain frequency
###############################################################################
def estimate_gain_at_frequency(f, HF, freq): def estimate_gain_at_frequency(f, HF, freq):
"""Find gain = abs(HF) at frequency in f that is closest to freq. """Find gain = abs(HF) at frequency in f that is closest to freq.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment