From: Johnathan Corgan Date: Sun, 23 Aug 2009 18:45:22 +0000 (-0700) Subject: Added blks2.pfb_arb_resampler_ccf to GRC block list X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=9f2ca841018fd24644be39b4400784806015aef2;p=debian%2Fgnuradio Added blks2.pfb_arb_resampler_ccf to GRC block list * New block XML file * Added set_taps callback to blks2 hier block * GRC example showing pre- and post-resampling swept spectrum --- 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 b1b3dfca..e40d9636 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py @@ -24,7 +24,7 @@ from gnuradio import gr class pfb_arb_resampler_ccf(gr.hier_block2): ''' - Convinience wrapper for the polyphase filterbank arbitrary resampler. + Convenience wrapper for the polyphase filterbank arbitrary resampler. The block takes a single complex stream in and outputs a single complex stream out. As such, it requires no extra glue to handle the input/output @@ -45,6 +45,5 @@ class pfb_arb_resampler_ccf(gr.hier_block2): self.connect(self, self.pfb) self.connect(self.pfb, self) - - - + def set_taps(self, taps): + self.pfb.set_taps(taps) diff --git a/gnuradio-examples/python/pfb/Makefile.am b/gnuradio-examples/python/pfb/Makefile.am index 4aa9248e..0b91d0a2 100644 --- a/gnuradio-examples/python/pfb/Makefile.am +++ b/gnuradio-examples/python/pfb/Makefile.am @@ -29,3 +29,6 @@ dist_ourdata_SCRIPTS = \ decimate.py \ interpolate.py \ fmtest.py + +dist_ourdata_DATA = \ + resampler_demo.grc diff --git a/gnuradio-examples/python/pfb/resampler_demo.grc b/gnuradio-examples/python/pfb/resampler_demo.grc new file mode 100644 index 00000000..468636a5 --- /dev/null +++ b/gnuradio-examples/python/pfb/resampler_demo.grc @@ -0,0 +1,598 @@ + + + Sun Aug 23 11:39:47 2009 + + options + + id + resampler_demo + + + _enabled + True + + + title + + + + author + + + + description + + + + window_size + 1280, 1024 + + + generate_options + wx_gui + + + category + Custom + + + run + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + import + + id + import_0 + + + _enabled + True + + + import + import math + + + _coordinate + (11, 59) + + + _rotation + 0 + + + + variable + + id + rs_taps + + + _enabled + True + + + value + firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw) + + + _coordinate + (273, 154) + + + _rotation + 0 + + + + gr_add_const_vxx + + id + adder + + + _enabled + True + + + type + float + + + const + -1.0 + + + vlen + 1 + + + _coordinate + (227, 303) + + + _rotation + 0 + + + + gr_throttle + + id + throttle + + + _enabled + True + + + type + float + + + samples_per_second + samp_rate + + + vlen + 1 + + + _coordinate + (227, 493) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + orig_fft + + + _enabled + True + + + type + complex + + + title + Original Spectrum + + + samp_rate + samp_rate + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 10 + + + ref_level + 30 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + grid_pos + 1, 0, 1, 3 + + + notebook + + + + _coordinate + (409, 289) + + + _rotation + 180 + + + + wxgui_fftsink2 + + id + resamp_fft + + + _enabled + True + + + type + complex + + + title + Resampled Spectrum + + + samp_rate + new_rate + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 10 + + + ref_level + 30 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + True + + + average + False + + + avg_alpha + 0 + + + grid_pos + 2, 0, 1, 3 + + + notebook + + + + _coordinate + (640, 256) + + + _rotation + 180 + + + + gr_sig_source_x + + id + tri_source + + + _enabled + True + + + type + float + + + samp_rate + samp_rate + + + waveform + gr.GR_TRI_WAVE + + + freq + 0.05 + + + amp + 2.0 + + + offset + 0 + + + _coordinate + (21, 271) + + + _rotation + 0 + + + + gr_frequency_modulator_fc + + id + fm_mod + + + _enabled + True + + + sensitivity + math.pi + + + _coordinate + (411, 493) + + + _rotation + 0 + + + + blks2_pfb_arb_resampler_ccf + + id + resampler + + + _enabled + True + + + rate + float(new_rate)/samp_rate + + + taps + rs_taps + + + size + nphases + + + _coordinate + (641, 477) + + + _rotation + 0 + + + + variable + + id + nphases + + + _enabled + True + + + value + 32 + + + _coordinate + (185, 153) + + + _rotation + 0 + + + + variable_static_text + + id + samp_rate + + + _enabled + True + + + label + Sample Rate + + + value + 44100 + + + converver + float_converter + + + formatter + None + + + grid_pos + 0, 0, 1, 1 + + + notebook + + + + _coordinate + (179, 14) + + + _rotation + 0 + + + + variable_static_text + + id + new_rate + + + _enabled + True + + + label + Resampled Rate + + + value + 48000 + + + converver + float_converter + + + formatter + None + + + grid_pos + 0, 1, 1, 1 + + + notebook + + + + _coordinate + (328, 15) + + + _rotation + 0 + + + + variable_static_text + + id + frac_bw + + + _enabled + True + + + label + Fractional Bandwidth + + + value + 0.45 + + + converver + float_converter + + + formatter + lambda x: "%0.2f"%x + + + grid_pos + 0,2,1,1 + + + notebook + + + + _coordinate + (473, 14) + + + _rotation + 0 + + + + tri_source + adder + 0 + 0 + + + adder + throttle + 0 + 0 + + + resampler + resamp_fft + 0 + 0 + + + fm_mod + resampler + 0 + 0 + + + fm_mod + orig_fft + 0 + 0 + + + throttle + fm_mod + 0 + 0 + + diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am index fbd8f4bb..caae6ce7 100644 --- a/grc/blocks/Makefile.am +++ b/grc/blocks/Makefile.am @@ -45,6 +45,7 @@ dist_ourdata_DATA = \ blks2_ofdm_mod.xml \ blks2_packet_decoder.xml \ blks2_packet_encoder.xml \ + blks2_pfb_arb_resampler.xml \ blks2_qamx_demod.xml \ blks2_qamx_mod.xml \ blks2_rational_resampler_xxx.xml \ diff --git a/grc/blocks/blks2_pfb_arb_resampler.xml b/grc/blocks/blks2_pfb_arb_resampler.xml new file mode 100644 index 00000000..062b0dd9 --- /dev/null +++ b/grc/blocks/blks2_pfb_arb_resampler.xml @@ -0,0 +1,42 @@ + + + + Polyphase Resampler + blks2_pfb_arb_resampler_ccf + from gnuradio import blks2 + from gnuradio.gr import firdes + blks2.pfb_arb_resampler_ccf( + $rate, + $taps, + $size, +) + set_taps($taps) + + Resample Rate + rate + real + + + Taps + taps + real_vector + + + Size (# phases) + size + 32 + int + + + in + complex + + + out + complex + + diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 2cedb45a..5b45466f 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -176,6 +176,8 @@ blks2_synthesis_filterbank blks2_analysis_filterbank + + blks2_pfb_arb_resampler_ccf gr_single_pole_iir_filter_xx gr_hilbert_fc