summaryrefslogtreecommitdiff
path: root/gnuradio-examples/python
diff options
context:
space:
mode:
authorTom2010-01-17 19:19:40 -0500
committerTom2010-01-17 19:19:40 -0500
commitcf4e5e40a77a0579f97e4306d2d51860b3b3a3f0 (patch)
tree091da897ede583eb8712d9fb54318ed84da3191b /gnuradio-examples/python
parentb484d4b751bc08e9324425eadd269e85932f7149 (diff)
downloadgnuradio-cf4e5e40a77a0579f97e4306d2d51860b3b3a3f0.tar.gz
gnuradio-cf4e5e40a77a0579f97e4306d2d51860b3b3a3f0.tar.bz2
gnuradio-cf4e5e40a77a0579f97e4306d2d51860b3b3a3f0.zip
Doing the same with the resampler on the receiver side.
Diffstat (limited to 'gnuradio-examples/python')
-rw-r--r--gnuradio-examples/python/digital/usrp_receive_path.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/gnuradio-examples/python/digital/usrp_receive_path.py b/gnuradio-examples/python/digital/usrp_receive_path.py
index e28eb0a8c..517825cc1 100644
--- a/gnuradio-examples/python/digital/usrp_receive_path.py
+++ b/gnuradio-examples/python/digital/usrp_receive_path.py
@@ -63,15 +63,22 @@ class usrp_receive_path(gr.hier_block2):
for attr in dir(rx_path): #forward the methods
if not attr.startswith('_') and not hasattr(self, attr):
setattr(self, attr, getattr(rx_path, attr))
+
#setup usrp
self._demod_class = demod_class
self._setup_usrp_source(options)
+
+ # Set up resampler based on rate determined by _setup_usrp_source
+ rs_taps = gr.firdes.low_pass_2(32, 32, 0.45, 0.1, 60)
+ self.resampler = gr.pfb_arb_resampler_ccf(self.rs_rate, rs_taps)
+
#connect
- self.connect(self.u, rx_path)
+ self.connect(self.u, self.resampler, rx_path)
def _setup_usrp_source(self, options):
self.u = usrp_options.create_usrp_source(options)
adc_rate = self.u.adc_rate()
+ self.rs_rate = options.bitrate
if options.verbose:
print 'USRP Source:', self.u
(self._bitrate, self._samples_per_symbol, self._decim) = \
@@ -79,6 +86,11 @@ class usrp_receive_path(gr.hier_block2):
options.samples_per_symbol, options.decim, adc_rate, \
self.u.get_decim_rates())
+ # Calculate resampler rate based on requested and actual rates
+ self.rs_rate = 1.0 /(self._bitrate / self.rs_rate)
+
+ print "Resampling by %f to get bitrate of %ssps" % ( self.rs_rate, eng_notation.num_to_str(self._bitrate/self.rs_rate))
+
self.u.set_decim(self._decim)
if not self.u.set_center_freq(options.rx_freq):