From 5d5abdb77fef4daafcfec88aaac76995a2c0884a Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Sat, 30 Jul 2011 12:41:58 -0400
Subject: digital: added QA code for FLL algorithm. Updated generic_mod_demod
 to use new FLL in digital instead of gr.

---
 gr-digital/python/generic_mod_demod.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'gr-digital/python/generic_mod_demod.py')

diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py
index 1b8603fea6..f252af13b9 100644
--- a/gr-digital/python/generic_mod_demod.py
+++ b/gr-digital/python/generic_mod_demod.py
@@ -262,9 +262,10 @@ class generic_demod(gr.hier_block2):
         self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
 
         # Frequency correction
-        self.freq_recov = gr.fll_band_edge_cc(self._samples_per_symbol, self._excess_bw,
-                                              11*int(self._samples_per_symbol),
-                                              self._freq_alpha, self._freq_beta)
+        self.bandwidth = 6.28 / 100.0
+        self.freq_recov = digital_swig.fll_band_edge_cc(self._samples_per_symbol, self._excess_bw,
+                                                        11*int(self._samples_per_symbol),
+                                                        self.bandwidth)
 
         # symbol timing recovery with RRC data filter
         nfilts = 32
-- 
cgit v1.2.3


From 61db1684fdda602d18134b2e8c510bb7e33245fc Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Tue, 9 Aug 2011 21:50:13 -0400
Subject: digital: setting up receive path to use new timing loop API, FLL API,
 new gain names/settings. Also added concept of gray coding to generic
 mod/demod and reworked bpsk/qpsk modulators so both work.

---
 gr-digital/examples/benchmark_tx.py    |  2 +-
 gr-digital/examples/transmit_path.py   |  2 +-
 gr-digital/python/bpsk.py              |  6 ++-
 gr-digital/python/generic_mod_demod.py | 73 +++++++++++++++-------------------
 gr-digital/python/modulation_utils2.py |  1 +
 gr-digital/python/qpsk.py              | 16 ++++----
 6 files changed, 48 insertions(+), 52 deletions(-)

(limited to 'gr-digital/python/generic_mod_demod.py')

diff --git a/gr-digital/examples/benchmark_tx.py b/gr-digital/examples/benchmark_tx.py
index 01902c0e37..e5d24915af 100755
--- a/gr-digital/examples/benchmark_tx.py
+++ b/gr-digital/examples/benchmark_tx.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright 2010 Free Software Foundation, Inc.
+# Copyright 2010,2011 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
diff --git a/gr-digital/examples/transmit_path.py b/gr-digital/examples/transmit_path.py
index 91869ad9ad..8ffb1e1089 100644
--- a/gr-digital/examples/transmit_path.py
+++ b/gr-digital/examples/transmit_path.py
@@ -50,7 +50,7 @@ class transmit_path(gr.hier_block2):
 
         # Get mod_kwargs
         mod_kwargs = self._modulator_class.extract_kwargs_from_options(options)
-    
+        
         # transmitter
 	modulator = self._modulator_class(**mod_kwargs)
         self.packet_transmitter = \
diff --git a/gr-digital/python/bpsk.py b/gr-digital/python/bpsk.py
index 51de3ce084..806a5d6951 100644
--- a/gr-digital/python/bpsk.py
+++ b/gr-digital/python/bpsk.py
@@ -67,7 +67,8 @@ class bpsk_mod(generic_mod):
         constellation = digital_swig.constellation_bpsk()
         if constellation_points != 2:
             raise ValueError('Number of constellation points must be 2 for BPSK.')
-        super(bpsk_mod, self).__init__(constellation, *args, **kwargs)
+        super(bpsk_mod, self).__init__(constellation=constellation,
+                                       *args, **kwargs)
 
 # /////////////////////////////////////////////////////////////////////////////
 #                           BPSK demodulator
@@ -92,7 +93,8 @@ class bpsk_demod(generic_demod):
         constellation = digital_swig.constellation_bpsk()
         if constellation_points != 2:
             raise ValueError('Number of constellation points must be 2 for BPSK.')
-        super(bpsk_demod, self).__init__(constellation, *args, **kwargs)
+        super(bpsk_demod, self).__init__(constellation=constellation,
+                                         *args, **kwargs)
 
 #
 # Add these to the mod/demod registry
diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py
index f252af13b9..b5c7270584 100644
--- a/gr-digital/python/generic_mod_demod.py
+++ b/gr-digital/python/generic_mod_demod.py
@@ -29,6 +29,7 @@ from gnuradio import gr
 from modulation_utils2 import extract_kwargs_from_options_for_class
 from utils import mod_codes
 import digital_swig
+import math
 
 # default values (used in __init__ and add_options)
 _def_samples_per_symbol = 2
@@ -37,13 +38,12 @@ _def_verbose = False
 _def_log = False
 
 # Frequency correction
-_def_freq_alpha = 0.010
+_def_freq_bw = 2*math.pi/100.0
 # Symbol timing recovery 
-_def_timing_alpha = 0.100
-_def_timing_beta = 0.010
+_def_timing_bw = 2*math.pi/100.0
 _def_timing_max_dev = 1.5
 # Fine frequency / Phase correction
-_def_phase_alpha = 0.1
+_def_phase_bw = 2*math.pi/100.0
 # Number of points in constellation
 _def_constellation_points = 16
 # Whether differential coding is used.
@@ -77,6 +77,7 @@ class generic_mod(gr.hier_block2):
                  differential=_def_differential,
                  samples_per_symbol=_def_samples_per_symbol,
                  excess_bw=_def_excess_bw,
+                 gray_coded=True,
                  verbose=_def_verbose,
                  log=_def_log):
         """
@@ -88,9 +89,11 @@ class generic_mod(gr.hier_block2):
 	@param constellation: determines the modulation type
 	@type constellation: gnuradio.digital.gr_constellation
 	@param samples_per_symbol: samples per baud >= 2
-	@type samples_per_symbol: integer
+	@type samples_per_symbol: float
 	@param excess_bw: Root-raised cosine filter excess bandwidth
 	@type excess_bw: float
+        @param gray_coded: turn gray coding on/off
+        @type gray_coded: bool
         @param verbose: Print information about modulator?
         @type verbose: bool
         @param log: Log modulation data to files?
@@ -206,10 +209,9 @@ class generic_demod(gr.hier_block2):
                  samples_per_symbol=_def_samples_per_symbol,
                  differential=_def_differential,
                  excess_bw=_def_excess_bw,
-                 freq_alpha=_def_freq_alpha,
-                 timing_alpha=_def_timing_alpha,
-                 timing_max_dev=_def_timing_max_dev,
-                 phase_alpha=_def_phase_alpha,
+                 freq_bw=_def_freq_bw,
+                 timing_bw=_def_timing_bw,
+                 phase_bw=_def_phase_bw,
                  verbose=_def_verbose,
                  log=_def_log):
         """
@@ -224,14 +226,12 @@ class generic_demod(gr.hier_block2):
 	@type samples_per_symbol: float
 	@param excess_bw: Root-raised cosine filter excess bandwidth
 	@type excess_bw: float
-        @param freq_alpha: loop filter gain for frequency recovery
-        @type freq_alpha: float
-        @param timing_alpha: loop alpha gain for timing recovery
-        @type timing_alpha: float
-        @param timing_max_dev: timing loop maximum rate deviations
-        @type timing_max_dev: float
-        @param phase_alpha: loop filter gain in phase loop
-        @type phase_alphas: float
+        @param freq_bw: loop filter lock-in bandwidth
+        @type freq_bw: float
+        @param timing_bw: timing recoery loop lock-in bandwidth
+        @type timing_bw: float
+        @param phase_bw: phase recovery loop bandwidth
+        @type phase_bw: float
         @param verbose: Print information about modulator?
         @type verbose: bool
         @param debug: Print modualtion data to files?
@@ -245,12 +245,10 @@ class generic_demod(gr.hier_block2):
         self._constellation = constellation.base()
         self._samples_per_symbol = samples_per_symbol
         self._excess_bw = excess_bw
-        self._phase_alpha = phase_alpha
-        self._freq_alpha = freq_alpha
-        self._freq_beta = 0.10*self._freq_alpha
-        self._timing_alpha = timing_alpha
-        self._timing_beta = _def_timing_beta
-        self._timing_max_dev=timing_max_dev
+        self._phase_bw = phase_bw
+        self._freq_bw = freq_bw
+        self._timing_bw = timing_bw
+        self._timing_max_dev= _def_timing_max_dev,
         self._differential = differential
 
         if self._samples_per_symbol < 2:
@@ -258,26 +256,24 @@ class generic_demod(gr.hier_block2):
 
         arity = pow(2,self.bits_per_symbol())
 
+        nfilts = 32
+        ntaps = 11 * int(self._samples_per_symbol*nfilts)
+
         # Automatic gain control
         self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
 
         # Frequency correction
-        self.bandwidth = 6.28 / 100.0
         self.freq_recov = digital_swig.fll_band_edge_cc(self._samples_per_symbol, self._excess_bw,
-                                                        11*int(self._samples_per_symbol),
-                                                        self.bandwidth)
+                                                        ntaps, self._freq_bw)
 
         # symbol timing recovery with RRC data filter
-        nfilts = 32
-        ntaps = 11 * int(self._samples_per_symbol*nfilts)
-        taps = gr.firdes.root_raised_cosine(nfilts, nfilts,
-                                            1.0/float(self._samples_per_symbol),
-                                            self._excess_bw, ntaps)
+        taps = gr.firdes.root_raised_cosine(nfilts, nfilts*self._samples_per_symbol,
+                                            1.0, self._excess_bw, ntaps)
         self.time_recov = gr.pfb_clock_sync_ccf(self._samples_per_symbol,
-                                                self._timing_alpha,
-                                                taps, nfilts, nfilts/2, self._timing_max_dev)
-        self.time_recov.set_beta(self._timing_beta)
+                                                self._timing_bw, taps, 
+                                                nfilts, nfilts/2, self._timing_max_dev)
 
+        self._phase_alpha = 0.1
         self._phase_beta  = 0.25 * self._phase_alpha * self._phase_alpha
         fmin = -0.25
         fmax = 0.25
@@ -323,12 +319,9 @@ class generic_demod(gr.hier_block2):
         print "\nDemodulator:"
         print "bits per symbol:     %d"   % self.bits_per_symbol()
         print "RRC roll-off factor: %.2f" % self._excess_bw
-        print "FLL gain:            %.2e" % self._freq_alpha
-        print "Timing alpha gain:   %.2e" % self._timing_alpha
-        print "Timing beta gain:    %.2e" % self._timing_beta
-        print "Timing max dev:      %.2f" % self._timing_max_dev
-        print "Phase track alpha:   %.2e" % self._phase_alpha
-        print "Phase track beta:    %.2e" % self._phase_beta
+        print "FLL bandwidth:       %.2e" % self._freq_bw
+        print "Timing bandwidth:    %.2e" % self._timing_bw
+        print "Phase bandwidth:     %.2e" % self._phase_bw
 
     def _setup_logging(self):
         print "Modulation logging turned on."
diff --git a/gr-digital/python/modulation_utils2.py b/gr-digital/python/modulation_utils2.py
index f30055f4ac..cb3a9812d4 100644
--- a/gr-digital/python/modulation_utils2.py
+++ b/gr-digital/python/modulation_utils2.py
@@ -80,6 +80,7 @@ def extract_kwargs_from_options(function, excluded_args, options):
     @param options: result of command argument parsing
     @type options: optparse.Values
     """
+    
     # Try this in C++ ;)
     args, varargs, varkw, defaults = inspect.getargspec(function)
     d = {}
diff --git a/gr-digital/python/qpsk.py b/gr-digital/python/qpsk.py
index 91e8b196f4..031aa03a54 100644
--- a/gr-digital/python/qpsk.py
+++ b/gr-digital/python/qpsk.py
@@ -23,7 +23,6 @@
 QPSK modulation.
 
 Demodulation is not included since the generic_mod_demod
-doesn't work for non-differential encodings.
 """
 
 from gnuradio import gr
@@ -33,8 +32,7 @@ import modulation_utils2
 
 # Default number of points in constellation.
 _def_constellation_points = 4
-# Whether differential coding is used.
-_def_differential = False
+# Whether gray coding is used.
 _def_gray_coded = True
 
 # /////////////////////////////////////////////////////////////////////////////
@@ -70,9 +68,11 @@ class qpsk_mod(generic_mod):
         constellation = digital_swig.constellation_qpsk()
         if constellation_points != 4:
             raise ValueError("QPSK can only have 4 constellation points.")
-        if differential or not gray_coded:
-            raise ValueError("This QPSK mod/demod works only for gray-coded, non-differential.")
-        super(qpsk_mod, self).__init__(constellation, differential, gray_coded, *args, **kwargs)
+        if not gray_coded:
+            raise ValueError("This QPSK mod/demod works only for gray-coded constellations.")
+        super(qpsk_mod, self).__init__(constellation=constellation,
+                                       gray_coded=gray_coded, 
+                                       *args, **kwargs)
 
 
 # /////////////////////////////////////////////////////////////////////////////
@@ -98,8 +98,8 @@ class qpsk_demod(generic_demod):
         constellation = digital_swig.constellation_qpsk()
         if constellation_points != 4:
             raise ValueError('Number of constellation points must be 4 for QPSK.')
-        super(qpsk_demod, self).__init__(constellation, *args, **kwargs)
-
+        super(qpsk_demod, self).__init__(constellation=constellation,
+                                         *args, **kwargs)
 
 #
 # Add these to the mod/demod registry
-- 
cgit v1.2.3


From aed7404ad43d5e0c5dd2c79a7d205ea6748cff28 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Tue, 9 Aug 2011 22:18:19 -0400
Subject: digital: fixing up receiver code. Almost there...

---
 gr-digital/examples/benchmark_rx.py    |  5 ++++-
 gr-digital/examples/receive_path.py    | 10 ++++++----
 gr-digital/python/generic_mod_demod.py | 20 ++++++++------------
 gr-digital/python/qpsk.py              |  1 -
 4 files changed, 18 insertions(+), 18 deletions(-)

(limited to 'gr-digital/python/generic_mod_demod.py')

diff --git a/gr-digital/examples/benchmark_rx.py b/gr-digital/examples/benchmark_rx.py
index 9d8734e3de..9390540dd4 100755
--- a/gr-digital/examples/benchmark_rx.py
+++ b/gr-digital/examples/benchmark_rx.py
@@ -48,11 +48,14 @@ class my_top_block(gr.top_block):
         self.rxpath = receive_path(demodulator, rx_callback, options) 
 
         if(options.from_file is not None):
+            self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6)
             self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
+            self.connect(self.source, self.thr, self.rxpath)
         else:
+            self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6)
             self.source = gr.null_source(gr.sizeof_gr_complex)
+            self.connect(self.source, self.thr, self.rxpath)
 
-        self.connect(self.source, self.rxpath)
 
 # /////////////////////////////////////////////////////////////////////////////
 #                                   main
diff --git a/gr-digital/examples/receive_path.py b/gr-digital/examples/receive_path.py
index 9bc5f7b8f2..c6a26daf23 100644
--- a/gr-digital/examples/receive_path.py
+++ b/gr-digital/examples/receive_path.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright 2005,2006,2007 Free Software Foundation, Inc.
+# Copyright 2005-2007,2011 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -42,7 +42,6 @@ class receive_path(gr.hier_block2):
 
         self._verbose            = options.verbose
         self._bitrate            = options.bitrate         # desired bit rate
-        self._samples_per_symbol = options.samples_per_symbol  # desired samples/symbol
 
         self._rx_callback   = rx_callback      # this callback is fired when there's a packet available
         self._demod_class   = demod_class      # the demodulator_class we're using
@@ -50,10 +49,13 @@ class receive_path(gr.hier_block2):
         # Get demod_kwargs
         demod_kwargs = self._demod_class.extract_kwargs_from_options(options)
 
+        # Build the demodulator
+        demodulator = self._demod_class(**demod_kwargs)
+        
         # Design filter to get actual channel we want
         sw_decim = 1
         chan_coeffs = gr.firdes.low_pass (1.0,                  # gain
-                                          sw_decim * self._samples_per_symbol, # sampling rate
+                                          sw_decim * demodulator._samples_per_symbol, # sampling rate
                                           1.0,                  # midpoint of trans. band
                                           0.5,                  # width of trans. band
                                           gr.firdes.WIN_HANN)   # filter type
@@ -61,7 +63,7 @@ class receive_path(gr.hier_block2):
         
         # receiver
         self.packet_receiver = \
-            digital.demod_pkts(self._demod_class(**demod_kwargs),
+            digital.demod_pkts(demodulator,
                                access_code=None,
                                callback=self._rx_callback,
                                threshold=-1)
diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py
index b5c7270584..fad01fdfc6 100644
--- a/gr-digital/python/generic_mod_demod.py
+++ b/gr-digital/python/generic_mod_demod.py
@@ -248,7 +248,7 @@ class generic_demod(gr.hier_block2):
         self._phase_bw = phase_bw
         self._freq_bw = freq_bw
         self._timing_bw = timing_bw
-        self._timing_max_dev= _def_timing_max_dev,
+        self._timing_max_dev= _def_timing_max_dev
         self._differential = differential
 
         if self._samples_per_symbol < 2:
@@ -271,7 +271,7 @@ class generic_demod(gr.hier_block2):
                                             1.0, self._excess_bw, ntaps)
         self.time_recov = gr.pfb_clock_sync_ccf(self._samples_per_symbol,
                                                 self._timing_bw, taps, 
-                                                nfilts, nfilts/2, self._timing_max_dev)
+                                                nfilts, nfilts//2, self._timing_max_dev)
 
         self._phase_alpha = 0.1
         self._phase_beta  = 0.25 * self._phase_alpha * self._phase_alpha
@@ -367,16 +367,12 @@ class generic_demod(gr.hier_block2):
         # Add options shared with modulator.
         add_common_options(parser)
         # Add options specific to demodulator.
-        parser.add_option("", "--freq-alpha", type="float", default=_def_freq_alpha,
-                          help="set frequency lock loop alpha gain value [default=%default]")
-        parser.add_option("", "--phase-alpha", type="float", default=_def_phase_alpha,
-                          help="set phase tracking loop alpha value [default=%default]")
-        parser.add_option("", "--timing-alpha", type="float", default=_def_timing_alpha,
-                          help="set timing symbol sync loop gain alpha value [default=%default]")
-        parser.add_option("", "--timing-beta", type="float", default=_def_timing_beta,
-                          help="set timing symbol sync loop gain beta value [default=%default]")
-        parser.add_option("", "--timing-max-dev", type="float", default=_def_timing_max_dev,
-                          help="set timing symbol sync loop maximum deviation [default=%default]")
+        parser.add_option("", "--freq-bw", type="float", default=_def_freq_bw,
+                          help="set frequency lock loop lock-in bandwidth [default=%default]")
+        parser.add_option("", "--phase-bw", type="float", default=_def_phase_bw,
+                          help="set phase tracking loop lock-in bandwidth [default=%default]")
+        parser.add_option("", "--timing-bw", type="float", default=_def_timing_bw,
+                          help="set timing symbol sync loop gain lock-in bandwidth [default=%default]")
     add_options=staticmethod(add_options)
     
     def extract_kwargs_from_options(cls, options):
diff --git a/gr-digital/python/qpsk.py b/gr-digital/python/qpsk.py
index 031aa03a54..76e5df2701 100644
--- a/gr-digital/python/qpsk.py
+++ b/gr-digital/python/qpsk.py
@@ -51,7 +51,6 @@ def qpsk_constellation(m=_def_constellation_points):
 class qpsk_mod(generic_mod):
 
     def __init__(self, constellation_points=_def_constellation_points,
-                 differential=_def_differential,
                  gray_coded=_def_gray_coded,
                  *args, **kwargs):
 
-- 
cgit v1.2.3


From 57860e0199c005f26b4942cc7ed5e5acf829a68b Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Wed, 10 Aug 2011 22:37:51 -0400
Subject: Cleaning up; adding a different dbpsk that uses differential coding.
 The normal bpsk is non-differential by default, but can be set to use
 differential with the right flag.

---
 gr-digital/examples/example_timing.py  |  2 +-
 gr-digital/examples/receive_path.py    | 14 +++---
 gr-digital/examples/transmit_path.py   | 15 ++++---
 gr-digital/python/bpsk.py              | 79 +++++++++++++++++++++++++++++++---
 gr-digital/python/generic_mod_demod.py | 44 +++++++++----------
 gr-digital/python/qam.py               |  4 +-
 6 files changed, 115 insertions(+), 43 deletions(-)

(limited to 'gr-digital/python/generic_mod_demod.py')

diff --git a/gr-digital/examples/example_timing.py b/gr-digital/examples/example_timing.py
index ef72d23692..fd86acfb16 100755
--- a/gr-digital/examples/example_timing.py
+++ b/gr-digital/examples/example_timing.py
@@ -42,7 +42,7 @@ class example_timing(gr.top_block):
 
         if mode == 0:
             self.clk = gr.pfb_clock_sync_ccf(sps, gain, rrc_taps_rx,
-                                             nfilts, nfilts/2, 3.5)
+                                             nfilts, nfilts//2, 3.5)
             self.taps = self.clk.get_taps()
             self.dtaps = self.clk.get_diff_taps()
 
diff --git a/gr-digital/examples/receive_path.py b/gr-digital/examples/receive_path.py
index c6a26daf23..dd8eb1a0dd 100644
--- a/gr-digital/examples/receive_path.py
+++ b/gr-digital/examples/receive_path.py
@@ -50,12 +50,12 @@ class receive_path(gr.hier_block2):
         demod_kwargs = self._demod_class.extract_kwargs_from_options(options)
 
         # Build the demodulator
-        demodulator = self._demod_class(**demod_kwargs)
+        self.demodulator = self._demod_class(**demod_kwargs)
         
         # Design filter to get actual channel we want
         sw_decim = 1
         chan_coeffs = gr.firdes.low_pass (1.0,                  # gain
-                                          sw_decim * demodulator._samples_per_symbol, # sampling rate
+                                          sw_decim * self.samples_per_symbol(), # sampling rate
                                           1.0,                  # midpoint of trans. band
                                           0.5,                  # width of trans. band
                                           gr.firdes.WIN_HANN)   # filter type
@@ -63,7 +63,7 @@ class receive_path(gr.hier_block2):
         
         # receiver
         self.packet_receiver = \
-            digital.demod_pkts(demodulator,
+            digital.demod_pkts(self.demodulator,
                                access_code=None,
                                callback=self._rx_callback,
                                threshold=-1)
@@ -90,7 +90,10 @@ class receive_path(gr.hier_block2):
         return self._bitrate
 
     def samples_per_symbol(self):
-        return self._samples_per_symbol
+        return self.demodulator._samples_per_symbol
+
+    def differential(self):
+        return self.demodulator._differential
 
     def carrier_sensed(self):
         """
@@ -139,4 +142,5 @@ 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:  %.4f"   % (self._samples_per_symbol)
+        print "samples/symbol:  %.4f"    % (self.samples_per_symbol())
+        print "Differential:    %s"    % (self.differential())
diff --git a/gr-digital/examples/transmit_path.py b/gr-digital/examples/transmit_path.py
index 8ffb1e1089..f22ffb3278 100644
--- a/gr-digital/examples/transmit_path.py
+++ b/gr-digital/examples/transmit_path.py
@@ -44,7 +44,6 @@ class transmit_path(gr.hier_block2):
         self._verbose            = options.verbose
         self._tx_amplitude       = options.tx_amplitude    # digital amplitude sent to USRP
         self._bitrate            = options.bitrate         # desired bit rate
-        self._samples_per_symbol = options.samples_per_symbol  # desired samples/baud
 
         self._modulator_class = modulator_class         # the modulator_class we are using
 
@@ -52,9 +51,10 @@ class transmit_path(gr.hier_block2):
         mod_kwargs = self._modulator_class.extract_kwargs_from_options(options)
         
         # transmitter
-	modulator = self._modulator_class(**mod_kwargs)
+	self.modulator = self._modulator_class(**mod_kwargs)
+        
         self.packet_transmitter = \
-            digital.mod_pkts(modulator,
+            digital.mod_pkts(self.modulator,
                              access_code=None,
                              msgq_limit=4,
                              pad_for_usrp=True)
@@ -87,7 +87,10 @@ class transmit_path(gr.hier_block2):
         return self._bitrate
 
     def samples_per_symbol(self):
-        return self._samples_per_symbol
+        return self.modulator._samples_per_symbol
+
+    def differential(self):
+        return self.modulator._differential
 
     def add_options(normal, expert):
         """
@@ -115,5 +118,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:  %.4f"    % (self._samples_per_symbol)
-        
+        print "samples/symbol:  %.4f"    % (self.samples_per_symbol())
+        print "Differential:    %s"    % (self.differential())
diff --git a/gr-digital/python/bpsk.py b/gr-digital/python/bpsk.py
index 806a5d6951..58a8289a56 100644
--- a/gr-digital/python/bpsk.py
+++ b/gr-digital/python/bpsk.py
@@ -34,7 +34,7 @@ import modulation_utils2
 # Default number of points in constellation.
 _def_constellation_points = 2
 # Whether differential coding is used.
-_def_differential = True
+_def_differential = False
 
 # /////////////////////////////////////////////////////////////////////////////
 #                           BPSK constellation
@@ -52,7 +52,7 @@ def bpsk_constellation(m=_def_constellation_points):
 class bpsk_mod(generic_mod):
 
     def __init__(self, constellation_points=_def_constellation_points,
-                 *args, **kwargs):
+                 differential=False, *args, **kwargs):
 
         """
 	Hierarchical block for RRC-filtered BPSK modulation.
@@ -68,8 +68,8 @@ class bpsk_mod(generic_mod):
         if constellation_points != 2:
             raise ValueError('Number of constellation points must be 2 for BPSK.')
         super(bpsk_mod, self).__init__(constellation=constellation,
-                                       *args, **kwargs)
-
+                                       differential=differential, *args, **kwargs)
+        
 # /////////////////////////////////////////////////////////////////////////////
 #                           BPSK demodulator
 #
@@ -78,7 +78,7 @@ class bpsk_mod(generic_mod):
 class bpsk_demod(generic_demod):
 
     def __init__(self, constellation_points=_def_constellation_points,
-                 *args, **kwargs):
+                 differential=False, *args, **kwargs):
 
         """
 	Hierarchical block for RRC-filtered BPSK modulation.
@@ -94,7 +94,71 @@ class bpsk_demod(generic_demod):
         if constellation_points != 2:
             raise ValueError('Number of constellation points must be 2 for BPSK.')
         super(bpsk_demod, self).__init__(constellation=constellation,
-                                         *args, **kwargs)
+                                         differential=differential, *args, **kwargs)
+
+
+
+# /////////////////////////////////////////////////////////////////////////////
+#                           DBPSK constellation
+# /////////////////////////////////////////////////////////////////////////////
+
+def dbpsk_constellation(m=_def_constellation_points):
+    if m != _def_constellation_points:
+        raise ValueError("DBPSK can only have 2 constellation points.")
+    return digital_swig.constellation_dbpsk()
+
+# /////////////////////////////////////////////////////////////////////////////
+#                           DBPSK modulator
+# /////////////////////////////////////////////////////////////////////////////
+
+class dbpsk_mod(generic_mod):
+
+    def __init__(self, constellation_points=_def_constellation_points,
+                 differential=True, *args, **kwargs):
+
+        """
+	Hierarchical block for RRC-filtered DBPSK modulation.
+
+	The input is a byte stream (unsigned char) and the
+	output is the complex modulated signal at baseband.
+
+        See generic_mod block for list of parameters.
+	"""
+
+        constellation_points = _def_constellation_points
+        constellation = digital_swig.constellation_bpsk()
+        if constellation_points != 2:
+            raise ValueError('Number of constellation points must be 2 for DBPSK.')
+        super(dbpsk_mod, self).__init__(constellation=constellation,
+                                        differential=True,
+                                        *args, **kwargs)
+
+# /////////////////////////////////////////////////////////////////////////////
+#                           DBPSK demodulator
+#
+# /////////////////////////////////////////////////////////////////////////////
+
+class dbpsk_demod(generic_demod):
+
+    def __init__(self, constellation_points=_def_constellation_points,
+                 differential=True, *args, **kwargs):
+
+        """
+	Hierarchical block for RRC-filtered DBPSK modulation.
+
+	The input is a byte stream (unsigned char) and the
+	output is the complex modulated signal at baseband.
+
+        See generic_demod block for list of parameters.
+        """
+
+        constellation_points = _def_constellation_points
+        constellation = digital_swig.constellation_bpsk()
+        if constellation_points != 2:
+            raise ValueError('Number of constellation points must be 2 for DBPSK.')
+        super(dbpsk_demod, self).__init__(constellation=constellation,
+                                          differential=True,
+                                          *args, **kwargs)
 
 #
 # Add these to the mod/demod registry
@@ -102,3 +166,6 @@ class bpsk_demod(generic_demod):
 modulation_utils2.add_type_1_mod('bpsk', bpsk_mod)
 modulation_utils2.add_type_1_demod('bpsk', bpsk_demod)
 modulation_utils2.add_type_1_constellation('bpsk', bpsk_constellation)
+modulation_utils2.add_type_1_mod('dbpsk', dbpsk_mod)
+modulation_utils2.add_type_1_demod('dbpsk', dbpsk_demod)
+modulation_utils2.add_type_1_constellation('dbpsk', dbpsk_constellation)
diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py
index fad01fdfc6..3410ab9d59 100644
--- a/gr-digital/python/generic_mod_demod.py
+++ b/gr-digital/python/generic_mod_demod.py
@@ -47,7 +47,7 @@ _def_phase_bw = 2*math.pi/100.0
 # Number of points in constellation
 _def_constellation_points = 16
 # Whether differential coding is used.
-_def_differential = True
+_def_differential = False
 
 def add_common_options(parser):
     """
@@ -55,10 +55,12 @@ def add_common_options(parser):
     """
     parser.add_option("-p", "--constellation-points", type="int", default=_def_constellation_points,
                       help="set the number of constellation points (must be a power of 2 (power of 4 for QAM) [default=%default]")
-    parser.add_option("", "--differential", action="store_true", dest="differential", default=True,
-                      help="use differential encoding [default=%default]")
-    parser.add_option("", "--not-differential", action="store_false", dest="differential",
+    parser.add_option("", "--non-differential", action="store_true",
+                      dest="differential", default=False,
                       help="do not use differential encoding [default=%default]")
+    parser.add_option("", "--differential", action="store_false",
+                      dest="differential", 
+                      help="use differential encoding [default=False]")
     parser.add_option("", "--mod-code", type="choice", choices=mod_codes.codes,
                       default=mod_codes.NO_CODE,
                       help="Select modulation code from: %s [default=%%default]"
@@ -270,17 +272,13 @@ class generic_demod(gr.hier_block2):
         taps = gr.firdes.root_raised_cosine(nfilts, nfilts*self._samples_per_symbol,
                                             1.0, self._excess_bw, ntaps)
         self.time_recov = gr.pfb_clock_sync_ccf(self._samples_per_symbol,
-                                                self._timing_bw, taps, 
+                                                self._timing_bw, taps,
                                                 nfilts, nfilts//2, self._timing_max_dev)
 
-        self._phase_alpha = 0.1
-        self._phase_beta  = 0.25 * self._phase_alpha * self._phase_alpha
         fmin = -0.25
         fmax = 0.25
-        
         self.receiver = digital_swig.constellation_receiver_cb(
-            self._constellation,
-            self._phase_alpha, self._phase_beta,
+            self._constellation, self._phase_bw,
             fmin, fmax)
         
         # Do differential decoding based on phase change of symbols
@@ -326,31 +324,31 @@ class generic_demod(gr.hier_block2):
     def _setup_logging(self):
         print "Modulation logging turned on."
         self.connect(self.agc,
-                     gr.file_sink(gr.sizeof_gr_complex, "rx_agc.dat"))
+                     gr.file_sink(gr.sizeof_gr_complex, "rx_agc.32fc"))
         self.connect((self.freq_recov, 0),
-                     gr.file_sink(gr.sizeof_gr_complex, "rx_freq_recov.dat"))
+                     gr.file_sink(gr.sizeof_gr_complex, "rx_freq_recov.32fc"))
         self.connect((self.freq_recov, 1),
-                     gr.file_sink(gr.sizeof_float, "rx_freq_recov_freq.dat"))
+                     gr.file_sink(gr.sizeof_float, "rx_freq_recov_freq.32f"))
         self.connect((self.freq_recov, 2),
-                     gr.file_sink(gr.sizeof_float, "rx_freq_recov_phase.dat"))
+                     gr.file_sink(gr.sizeof_float, "rx_freq_recov_phase.32f"))
         self.connect((self.freq_recov, 3),
-                     gr.file_sink(gr.sizeof_gr_complex, "rx_freq_recov_error.dat"))
+                     gr.file_sink(gr.sizeof_float, "rx_freq_recov_error.32f"))
         self.connect((self.time_recov, 0),
-                     gr.file_sink(gr.sizeof_gr_complex, "rx_time_recov.dat"))
+                     gr.file_sink(gr.sizeof_gr_complex, "rx_time_recov.32fc"))
         self.connect((self.time_recov, 1),
-                     gr.file_sink(gr.sizeof_float, "rx_time_recov_error.dat"))
+                     gr.file_sink(gr.sizeof_float, "rx_time_recov_error.32f"))
         self.connect((self.time_recov, 2),
-                     gr.file_sink(gr.sizeof_float, "rx_time_recov_rate.dat"))
+                     gr.file_sink(gr.sizeof_float, "rx_time_recov_rate.32f"))
         self.connect((self.time_recov, 3),
-                     gr.file_sink(gr.sizeof_float, "rx_time_recov_phase.dat"))
+                     gr.file_sink(gr.sizeof_float, "rx_time_recov_phase.32f"))
         self.connect((self.receiver, 0),
-                     gr.file_sink(gr.sizeof_char, "rx_receiver.dat"))
+                     gr.file_sink(gr.sizeof_char, "rx_receiver.8c"))
         self.connect((self.receiver, 1),
-                     gr.file_sink(gr.sizeof_float, "rx_receiver_error.dat"))
+                     gr.file_sink(gr.sizeof_float, "rx_receiver_error.32f"))
         self.connect((self.receiver, 2),
-                     gr.file_sink(gr.sizeof_float, "rx_receiver_phase.dat"))
+                     gr.file_sink(gr.sizeof_float, "rx_receiver_phase.32f"))
         self.connect((self.receiver, 3),
-                     gr.file_sink(gr.sizeof_float, "rx_receiver_freq.dat"))
+                     gr.file_sink(gr.sizeof_float, "rx_receiver_freq.32f"))
         if self._differential:
             self.connect(self.diffdec,
                          gr.file_sink(gr.sizeof_char, "rx_diffdec.dat"))        
diff --git a/gr-digital/python/qam.py b/gr-digital/python/qam.py
index f29291ce89..a5a2e6c2cf 100644
--- a/gr-digital/python/qam.py
+++ b/gr-digital/python/qam.py
@@ -113,7 +113,7 @@ def make_differential_constellation(m, gray_coded):
 
     return const_map
 
-def make_not_differential_constellation(m, gray_coded):
+def make_non_differential_constellation(m, gray_coded):
     side = int(pow(m, 0.5))
     if (not isinstance(m, int) or m < 4 or not is_power_of_four(m)):
         raise ValueError("m must be a power of 4 integer.")
@@ -158,7 +158,7 @@ def qam_constellation(constellation_points=_def_constellation_points,
     if differential:
         points = make_differential_constellation(constellation_points, gray_coded)
     else:
-        points = make_not_differential_constellation(constellation_points, gray_coded)
+        points = make_non_differential_constellation(constellation_points, gray_coded)
     side = int(sqrt(constellation_points))
     width = 2.0/(side-1)
     # No pre-diff code
-- 
cgit v1.2.3


From 4ea3b61709d2a2c747e8690c4062ac75c09cf9ac Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Wed, 10 Aug 2011 22:42:58 -0400
Subject: digital: fixing naming of logging files.

---
 gr-digital/python/generic_mod_demod.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

(limited to 'gr-digital/python/generic_mod_demod.py')

diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py
index 3410ab9d59..da8e2cfd99 100644
--- a/gr-digital/python/generic_mod_demod.py
+++ b/gr-digital/python/generic_mod_demod.py
@@ -185,17 +185,17 @@ class generic_mod(gr.hier_block2):
     def _setup_logging(self):
         print "Modulation logging turned on."
         self.connect(self.bytes2chunks,
-                     gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.dat"))
+                     gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.8b"))
         if self._constellation.apply_pre_diff_code():
             self.connect(self.symbol_mapper,
-                         gr.file_sink(gr.sizeof_char, "tx_symbol_mapper.dat"))
+                         gr.file_sink(gr.sizeof_char, "tx_symbol_mapper.8b"))
         if self._differential:
             self.connect(self.diffenc,
-                         gr.file_sink(gr.sizeof_char, "tx_diffenc.dat"))
+                         gr.file_sink(gr.sizeof_char, "tx_diffenc.8b"))
         self.connect(self.chunks2symbols,
-                     gr.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.dat"))
+                     gr.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.32fc"))
         self.connect(self.rrc_filter,
-                     gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.dat"))
+                     gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.32fc"))
               
 
 # /////////////////////////////////////////////////////////////////////////////
@@ -342,7 +342,7 @@ class generic_demod(gr.hier_block2):
         self.connect((self.time_recov, 3),
                      gr.file_sink(gr.sizeof_float, "rx_time_recov_phase.32f"))
         self.connect((self.receiver, 0),
-                     gr.file_sink(gr.sizeof_char, "rx_receiver.8c"))
+                     gr.file_sink(gr.sizeof_char, "rx_receiver.8b"))
         self.connect((self.receiver, 1),
                      gr.file_sink(gr.sizeof_float, "rx_receiver_error.32f"))
         self.connect((self.receiver, 2),
@@ -351,12 +351,12 @@ class generic_demod(gr.hier_block2):
                      gr.file_sink(gr.sizeof_float, "rx_receiver_freq.32f"))
         if self._differential:
             self.connect(self.diffdec,
-                         gr.file_sink(gr.sizeof_char, "rx_diffdec.dat"))        
+                         gr.file_sink(gr.sizeof_char, "rx_diffdec.8b"))
         if self._constellation.apply_pre_diff_code():
             self.connect(self.symbol_mapper,
-                         gr.file_sink(gr.sizeof_char, "rx_symbol_mapper.dat"))        
+                         gr.file_sink(gr.sizeof_char, "rx_symbol_mapper.8b"))
         self.connect(self.unpack,
-                     gr.file_sink(gr.sizeof_char, "rx_unpack.dat"))
+                     gr.file_sink(gr.sizeof_char, "rx_unpack.8b"))
         
     def add_options(parser):
         """
-- 
cgit v1.2.3