From: Tom Rondeau Date: Tue, 28 Dec 2010 17:47:32 +0000 (-0500) Subject: Updating the arb. resampler to use the optfir filter that provides better specificati... X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=ae03fd9ae853055548be3e2c0ff5754828142c2a;p=debian%2Fgnuradio Updating the arb. resampler to use the optfir filter that provides better specificatiion of stopband atten. --- diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py index cd9289fa..c4e496c4 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py @@ -20,7 +20,7 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr +from gnuradio import gr, optfir class pfb_arb_resampler_ccf(gr.hier_block2): ''' @@ -31,7 +31,7 @@ class pfb_arb_resampler_ccf(gr.hier_block2): streams. This block is provided to be consistent with the interface to the other PFB block. ''' - def __init__(self, rate, taps=None, flt_size=32, atten=80): + def __init__(self, rate, taps=None, flt_size=32, atten=100): gr.hier_block2.__init__(self, "pfb_arb_resampler_ccf", gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature @@ -43,9 +43,19 @@ class pfb_arb_resampler_ccf(gr.hier_block2): self._taps = taps else: # Create a filter that covers the full bandwidth of the input signal - bw = 0.5 - tb = 0.1 - self._taps = gr.firdes.low_pass_2(self._size, self._size, bw, tb, atten) + bw = 0.4 + tb = 0.2 + ripple = 0.1 + #self._taps = gr.firdes.low_pass_2(self._size, self._size, bw, tb, atten) + made = False + while not made: + try: + self._taps = optfir.low_pass(self._size, self._size, bw, bw+tb, ripple, atten) + made = True + except RuntimeError: + ripple += 0.01 + made = False + print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple)) self.pfb = gr.pfb_arb_resampler_ccf(self._rate, self._taps, self._size)