Setting up code to handle setting of samples per symbol properly. Still buggy in...
authorTom Rondeau <trondeau@vt.edu>
Tue, 9 Feb 2010 05:30:09 +0000 (21:30 -0800)
committerTom Rondeau <trondeau@vt.edu>
Tue, 9 Feb 2010 05:30:09 +0000 (21:30 -0800)
gnuradio-core/src/python/gnuradio/blks2impl/dbpsk2.py
gnuradio-examples/python/digital/receive_path.py
gnuradio-examples/python/digital/transmit_path.py
gnuradio-examples/python/digital/usrp_receive_path.py
gnuradio-examples/python/digital/usrp_transmit_path.py

index e9fb3df89874266518b2a7025fbc020a20362a39..a5c5fa164299d74a6712aa6cc5995caccf8568ad 100644 (file)
@@ -83,7 +83,7 @@ class dbpsk2_mod(gr.hier_block2):
         self._excess_bw = excess_bw
         self._gray_code = gray_code
 
-        if not isinstance(self._samples_per_symbol, int) or self._samples_per_symbol < 2:
+        if self._samples_per_symbol < 2:
             raise TypeError, ("sbp must be an integer >= 2, is %d" % self._samples_per_symbol)
         
         arity = pow(2,self.bits_per_symbol())
@@ -103,7 +103,7 @@ class dbpsk2_mod(gr.hier_block2):
 
         # pulse shaping filter
         nfilts = 32
-        ntaps = nfilts * 11 * self._samples_per_symbol      # make nfilts filters of ntaps each
+        ntaps = nfilts * 11 * int(self._samples_per_symbol)    # make nfilts filters of ntaps each
         self.rrc_taps = gr.firdes.root_raised_cosine(
             nfilts,          # gain
             nfilts,          # sampling rate based on 32 filters in resampler
index c229aa9e4784c9f6d848d893b0d42c520d52d87c..7aeeedab0999b6853aea6c2537c337530dade822 100644 (file)
@@ -135,4 +135,4 @@ class receive_path(gr.hier_block2):
         print "\nReceive Path:"
         print "modulation:      %s"    % (self._demod_class.__name__)
         print "bitrate:         %sb/s" % (eng_notation.num_to_str(self._bitrate))
-        print "samples/symbol:  %3d"   % (self._samples_per_symbol)
+        print "samples/symbol:  %.4f"   % (self._samples_per_symbol)
index 9badcdc0840499d081bc0355c99e401cb2c45da2..a23f8d191788beeae606a38cd4cc83a8193318f4 100644 (file)
@@ -114,5 +114,5 @@ class transmit_path(gr.hier_block2):
         print "Tx amplitude     %s"    % (self._tx_amplitude)
         print "modulation:      %s"    % (self._modulator_class.__name__)
         print "bitrate:         %sb/s" % (eng_notation.num_to_str(self._bitrate))
-        print "samples/symbol:  %3d"   % (self._samples_per_symbol)
+        print "samples/symbol:  %.4f"    % (self._samples_per_symbol)
         
index 2d3d648a00b1779438fc8067e2a44f7d1dc4a821..1375a2349b6c0fb73f0c7633dfb823667adabfcd 100644 (file)
@@ -59,15 +59,16 @@ class usrp_receive_path(gr.hier_block2):
         if options.rx_freq is None:
             sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n")
             raise SystemExit
-        rx_path = receive_path.receive_path(demod_class, rx_callback, options)
-        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)
 
+        rx_path = receive_path.receive_path(demod_class, rx_callback, options)
+        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))
+
         # 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)
@@ -91,9 +92,9 @@ class usrp_receive_path(gr.hier_block2):
                         pick_rx_bitrate(options.bitrate, self._demod_class.bits_per_symbol(), \
                                         adc_rate, self.u.get_decim_rates())
 
-        print "USRP Decimation: ", self._decim
-        print "Samples Per Symbol: ", self._samples_per_symbol
-
+        options.samples_per_symbol = self._samples_per_symbol
+        options.decim = self._decim
+        
         self.u.set_decim(self._decim)
 
         if not self.u.set_center_freq(options.rx_freq):
index 4244c33f278478d8648ccdf4300074747cee0f51..f4bddf5a83c1e592ff47295780c603e34c4fae44 100644 (file)
@@ -58,15 +58,16 @@ class usrp_transmit_path(gr.hier_block2):
         if options.tx_freq is None:
             sys.stderr.write("-f FREQ or --freq FREQ or --tx-freq FREQ must be specified\n")
             raise SystemExit
-        tx_path = transmit_path.transmit_path(modulator_class, options)
-        for attr in dir(tx_path): #forward the methods
-            if not attr.startswith('_') and not hasattr(self, attr):
-                setattr(self, attr, getattr(tx_path, attr))
 
         #setup usrp
         self._modulator_class = modulator_class
         self._setup_usrp_sink(options)
 
+        tx_path = transmit_path.transmit_path(modulator_class, options)
+        for attr in dir(tx_path): #forward the methods
+            if not attr.startswith('_') and not hasattr(self, attr):
+                setattr(self, attr, getattr(tx_path, attr))
+
         # Set up resampler based on rate determined by _setup_usrp_sink
         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)
@@ -92,8 +93,8 @@ class usrp_transmit_path(gr.hier_block2):
                         pick_tx_bitrate(options.bitrate, self._modulator_class.bits_per_symbol(), \
                                         dac_rate, self.u.get_interp_rates())
 
-        print "USRP Interpolation: ", self._interp
-        print "Samples Per Symbol: ", self._samples_per_symbol
+        options.interp = self._interp
+        options.samples_per_symbol = self._samples_per_symbol
         
         self.u.set_interp(self._interp)
         self.u.set_auto_tr(True)