summaryrefslogtreecommitdiff
path: root/gr-digital/examples
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital/examples')
-rw-r--r--gr-digital/examples/Makefile.am3
-rwxr-xr-xgr-digital/examples/benchmark_rx.py5
-rwxr-xr-xgr-digital/examples/benchmark_tx.py2
-rwxr-xr-xgr-digital/examples/example_costas.py116
-rwxr-xr-xgr-digital/examples/example_fll.py126
-rwxr-xr-xgr-digital/examples/example_timing.py211
-rw-r--r--gr-digital/examples/receive_path.py18
-rw-r--r--gr-digital/examples/transmit_path.py17
8 files changed, 483 insertions, 15 deletions
diff --git a/gr-digital/examples/Makefile.am b/gr-digital/examples/Makefile.am
index 8ed53fe41c..ca36716fae 100644
--- a/gr-digital/examples/Makefile.am
+++ b/gr-digital/examples/Makefile.am
@@ -23,6 +23,9 @@ include $(top_srcdir)/Makefile.common
ourdatadir = $(exampledir)/digital
+noinst_PYTHON = \
+ example_fll.py
+
dist_ourdata_SCRIPTS = \
transmit_path.py \
receive_path.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/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/example_costas.py b/gr-digital/examples/example_costas.py
new file mode 100755
index 0000000000..aef0196cc0
--- /dev/null
+++ b/gr-digital/examples/example_costas.py
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, digital
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+try:
+ import scipy
+except ImportError:
+ print "Error: could not import scipy (http://www.scipy.org/)"
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ sys.exit(1)
+
+class example_costas(gr.top_block):
+ def __init__(self, N, sps, rolloff, ntaps, bw, noise, foffset, toffset, poffset):
+ gr.top_block.__init__(self)
+
+ rrc_taps = gr.firdes.root_raised_cosine(
+ sps, sps, 1.0, rolloff, ntaps)
+
+ data = 2.0*scipy.random.randint(0, 2, N) - 1.0
+ data = scipy.exp(1j*poffset) * data
+
+ self.src = gr.vector_source_c(data.tolist(), False)
+ self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps)
+ self.chn = gr.channel_model(noise, foffset, toffset)
+ self.cst = digital.costas_loop_cc(bw, 2)
+
+ self.vsnk_src = gr.vector_sink_c()
+ self.vsnk_cst = gr.vector_sink_c()
+ self.vsnk_frq = gr.vector_sink_f()
+
+ self.connect(self.src, self.rrc, self.chn, self.cst, self.vsnk_cst)
+ self.connect(self.rrc, self.vsnk_src)
+ self.connect((self.cst,1), self.vsnk_frq)
+
+def main():
+ parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
+ parser.add_option("-N", "--nsamples", type="int", default=2000,
+ help="Set the number of samples to process [default=%default]")
+ parser.add_option("-S", "--sps", type="int", default=4,
+ help="Set the samples per symbol [default=%default]")
+ parser.add_option("-r", "--rolloff", type="eng_float", default=0.35,
+ help="Set the rolloff factor [default=%default]")
+ parser.add_option("-W", "--bandwidth", type="eng_float", default=2*scipy.pi/100.0,
+ help="Set the loop bandwidth [default=%default]")
+ parser.add_option("-n", "--ntaps", type="int", default=45,
+ help="Set the number of taps in the filters [default=%default]")
+ parser.add_option("", "--noise", type="eng_float", default=0.0,
+ help="Set the simulation noise voltage [default=%default]")
+ parser.add_option("-f", "--foffset", type="eng_float", default=0.0,
+ help="Set the simulation's normalized frequency offset (in Hz) [default=%default]")
+ parser.add_option("-t", "--toffset", type="eng_float", default=1.0,
+ help="Set the simulation's timing offset [default=%default]")
+ parser.add_option("-p", "--poffset", type="eng_float", default=0.707,
+ help="Set the simulation's phase offset [default=%default]")
+ (options, args) = parser.parse_args ()
+
+ # Adjust N for the interpolation by sps
+ options.nsamples = options.nsamples // options.sps
+
+ # Set up the program-under-test
+ put = example_costas(options.nsamples, options.sps, options.rolloff,
+ options.ntaps, options.bandwidth, options.noise,
+ options.foffset, options.toffset, options.poffset)
+ put.run()
+
+ data_src = scipy.array(put.vsnk_src.data())
+
+ # Convert the FLL's LO frequency from rads/sec to Hz
+ data_frq = scipy.array(put.vsnk_frq.data()) / (2.0*scipy.pi)
+
+ # adjust this to align with the data.
+ data_cst = scipy.array(3*[0,]+list(put.vsnk_cst.data()))
+
+ # Plot the Costas loop's LO frequency
+ f1 = pylab.figure(1, figsize=(12,10), facecolor='w')
+ s1 = f1.add_subplot(2,2,1)
+ s1.plot(data_frq)
+ s1.set_title("Costas LO")
+ s1.set_xlabel("Samples")
+ s1.set_ylabel("Frequency (normalized Hz)")
+
+ # Plot the IQ symbols
+ s3 = f1.add_subplot(2,2,2)
+ s3.plot(data_src.real, data_src.imag, "o")
+ s3.plot(data_cst.real, data_cst.imag, "rx")
+ s3.set_title("IQ")
+ s3.set_xlabel("Real part")
+ s3.set_ylabel("Imag part")
+ s3.set_xlim([-2, 2])
+ s3.set_ylim([-2, 2])
+
+ # Plot the symbols in time
+ s4 = f1.add_subplot(2,2,3)
+ s4.set_position([0.125, 0.05, 0.775, 0.4])
+ s4.plot(data_src.real, "o-")
+ s4.plot(data_cst.real, "rx-")
+ s4.set_title("Symbols")
+ s4.set_xlabel("Samples")
+ s4.set_ylabel("Real Part of Signals")
+
+ pylab.show()
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-digital/examples/example_fll.py b/gr-digital/examples/example_fll.py
new file mode 100755
index 0000000000..3b75b5a758
--- /dev/null
+++ b/gr-digital/examples/example_fll.py
@@ -0,0 +1,126 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, digital
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+try:
+ import scipy
+except ImportError:
+ print "Error: could not import scipy (http://www.scipy.org/)"
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ sys.exit(1)
+
+class example_fll(gr.top_block):
+ def __init__(self, N, sps, rolloff, ntaps, bw, noise, foffset, toffset, poffset):
+ gr.top_block.__init__(self)
+
+ rrc_taps = gr.firdes.root_raised_cosine(
+ sps, sps, 1.0, rolloff, ntaps)
+
+ data = 2.0*scipy.random.randint(0, 2, N) - 1.0
+ data = scipy.exp(1j*poffset) * data
+
+ self.src = gr.vector_source_c(data.tolist(), False)
+ self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps)
+ self.chn = gr.channel_model(noise, foffset, toffset)
+ self.fll = digital.fll_band_edge_cc(sps, rolloff, ntaps, bw)
+
+ self.vsnk_src = gr.vector_sink_c()
+ self.vsnk_fll = gr.vector_sink_c()
+ self.vsnk_frq = gr.vector_sink_f()
+ self.vsnk_phs = gr.vector_sink_f()
+ self.vsnk_err = gr.vector_sink_f()
+
+ self.connect(self.src, self.rrc, self.chn, self.fll, self.vsnk_fll)
+ self.connect(self.rrc, self.vsnk_src)
+ self.connect((self.fll,1), self.vsnk_frq)
+ self.connect((self.fll,2), self.vsnk_phs)
+ self.connect((self.fll,3), self.vsnk_err)
+
+def main():
+ parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
+ parser.add_option("-N", "--nsamples", type="int", default=2000,
+ help="Set the number of samples to process [default=%default]")
+ parser.add_option("-S", "--sps", type="int", default=4,
+ help="Set the samples per symbol [default=%default]")
+ parser.add_option("-r", "--rolloff", type="eng_float", default=0.35,
+ help="Set the rolloff factor [default=%default]")
+ parser.add_option("-W", "--bandwidth", type="eng_float", default=2*scipy.pi/100.0,
+ help="Set the loop bandwidth [default=%default]")
+ parser.add_option("-n", "--ntaps", type="int", default=45,
+ help="Set the number of taps in the filters [default=%default]")
+ parser.add_option("", "--noise", type="eng_float", default=0.0,
+ help="Set the simulation noise voltage [default=%default]")
+ parser.add_option("-f", "--foffset", type="eng_float", default=0.2,
+ help="Set the simulation's normalized frequency offset (in Hz) [default=%default]")
+ parser.add_option("-t", "--toffset", type="eng_float", default=1.0,
+ help="Set the simulation's timing offset [default=%default]")
+ parser.add_option("-p", "--poffset", type="eng_float", default=0.0,
+ help="Set the simulation's phase offset [default=%default]")
+ (options, args) = parser.parse_args ()
+
+ # Adjust N for the interpolation by sps
+ options.nsamples = options.nsamples // options.sps
+
+ # Set up the program-under-test
+ put = example_fll(options.nsamples, options.sps, options.rolloff,
+ options.ntaps, options.bandwidth, options.noise,
+ options.foffset, options.toffset, options.poffset)
+ put.run()
+
+ data_src = scipy.array(put.vsnk_src.data())
+ data_err = scipy.array(put.vsnk_err.data())
+
+ # Convert the FLL's LO frequency from rads/sec to Hz
+ data_frq = scipy.array(put.vsnk_frq.data()) / (2.0*scipy.pi)
+
+ # adjust this to align with the data. There are 2 filters of
+ # ntaps long and the channel introduces another 4 sample delay.
+ data_fll = scipy.array(put.vsnk_fll.data()[2*options.ntaps-4:])
+
+ # Plot the FLL's LO frequency
+ f1 = pylab.figure(1, figsize=(12,10))
+ s1 = f1.add_subplot(2,2,1)
+ s1.plot(data_frq)
+ s1.set_title("FLL LO")
+ s1.set_xlabel("Samples")
+ s1.set_ylabel("Frequency (normalized Hz)")
+
+ # Plot the FLL's error
+ s2 = f1.add_subplot(2,2,2)
+ s2.plot(data_err)
+ s2.set_title("FLL Error")
+ s2.set_xlabel("Samples")
+ s2.set_ylabel("FLL Loop error")
+
+ # Plot the IQ symbols
+ s3 = f1.add_subplot(2,2,3)
+ s3.plot(data_src.real, data_src.imag, "o")
+ s3.plot(data_fll.real, data_fll.imag, "rx")
+ s3.set_title("IQ")
+ s3.set_xlabel("Real part")
+ s3.set_ylabel("Imag part")
+
+ # Plot the symbols in time
+ s4 = f1.add_subplot(2,2,4)
+ s4.plot(data_src.real, "o-")
+ s4.plot(data_fll.real, "rx-")
+ s4.set_title("Symbols")
+ s4.set_xlabel("Samples")
+ s4.set_ylabel("Real Part of Signals")
+
+ pylab.show()
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-digital/examples/example_timing.py b/gr-digital/examples/example_timing.py
new file mode 100755
index 0000000000..fd86acfb16
--- /dev/null
+++ b/gr-digital/examples/example_timing.py
@@ -0,0 +1,211 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, digital
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+try:
+ import scipy
+except ImportError:
+ print "Error: could not import scipy (http://www.scipy.org/)"
+ sys.exit(1)
+
+try:
+ import pylab
+except ImportError:
+ print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ sys.exit(1)
+
+from scipy import fftpack
+
+class example_timing(gr.top_block):
+ def __init__(self, N, sps, rolloff, ntaps, bw, noise,
+ foffset, toffset, poffset, mode=0):
+ gr.top_block.__init__(self)
+
+ rrc_taps = gr.firdes.root_raised_cosine(
+ sps, sps, 1.0, rolloff, ntaps)
+
+ gain = 2*scipy.pi/100.0
+ nfilts = 32
+ rrc_taps_rx = gr.firdes.root_raised_cosine(
+ nfilts, sps*nfilts, 1.0, rolloff, ntaps*nfilts)
+
+ data = 2.0*scipy.random.randint(0, 2, N) - 1.0
+ data = scipy.exp(1j*poffset) * data
+
+ self.src = gr.vector_source_c(data.tolist(), False)
+ self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps)
+ self.chn = gr.channel_model(noise, foffset, toffset)
+ self.off = gr.fractional_interpolator_cc(0.20, 1.0)
+
+ if mode == 0:
+ self.clk = gr.pfb_clock_sync_ccf(sps, gain, rrc_taps_rx,
+ nfilts, nfilts//2, 3.5)
+ self.taps = self.clk.get_taps()
+ self.dtaps = self.clk.get_diff_taps()
+
+ self.vsnk_err = gr.vector_sink_f()
+ self.vsnk_rat = gr.vector_sink_f()
+ self.vsnk_phs = gr.vector_sink_f()
+
+ self.connect((self.clk,1), self.vsnk_err)
+ self.connect((self.clk,2), self.vsnk_rat)
+ self.connect((self.clk,3), self.vsnk_phs)
+
+ else: # mode == 1
+ mu = 0.5
+ gain_mu = 0.1
+ gain_omega = 0.25*gain_mu*gain_mu
+ omega_rel_lim = 0.02
+ self.clk = digital.clock_recovery_mm_cc(sps, gain_omega,
+ mu, gain_mu,
+ omega_rel_lim)
+
+ self.vsnk_err = gr.vector_sink_f()
+
+ self.connect((self.clk,1), self.vsnk_err)
+
+ self.vsnk_src = gr.vector_sink_c()
+ self.vsnk_clk = gr.vector_sink_c()
+
+ self.connect(self.src, self.rrc, self.chn, self.off, self.clk, self.vsnk_clk)
+ self.connect(self.off, self.vsnk_src)
+
+
+def main():
+ parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
+ parser.add_option("-N", "--nsamples", type="int", default=2000,
+ help="Set the number of samples to process [default=%default]")
+ parser.add_option("-S", "--sps", type="int", default=4,
+ help="Set the samples per symbol [default=%default]")
+ parser.add_option("-r", "--rolloff", type="eng_float", default=0.35,
+ help="Set the rolloff factor [default=%default]")
+ parser.add_option("-W", "--bandwidth", type="eng_float", default=2*scipy.pi/100.0,
+ help="Set the loop bandwidth [default=%default]")
+ parser.add_option("-n", "--ntaps", type="int", default=45,
+ help="Set the number of taps in the filters [default=%default]")
+ parser.add_option("", "--noise", type="eng_float", default=0.0,
+ help="Set the simulation noise voltage [default=%default]")
+ parser.add_option("-f", "--foffset", type="eng_float", default=0.0,
+ help="Set the simulation's normalized frequency offset (in Hz) [default=%default]")
+ parser.add_option("-t", "--toffset", type="eng_float", default=1.0,
+ help="Set the simulation's timing offset [default=%default]")
+ parser.add_option("-p", "--poffset", type="eng_float", default=0.0,
+ help="Set the simulation's phase offset [default=%default]")
+ parser.add_option("-M", "--mode", type="int", default=0,
+ help="Set the recovery mode (0: polyphase, 1: M&M) [default=%default]")
+ (options, args) = parser.parse_args ()
+
+ # Adjust N for the interpolation by sps
+ options.nsamples = options.nsamples // options.sps
+
+ # Set up the program-under-test
+ put = example_timing(options.nsamples, options.sps, options.rolloff,
+ options.ntaps, options.bandwidth, options.noise,
+ options.foffset, options.toffset, options.poffset,
+ options.mode)
+ put.run()
+
+ if options.mode == 0:
+ data_src = scipy.array(put.vsnk_src.data()[20:])
+ data_clk = scipy.array(put.vsnk_clk.data()[20:])
+
+ data_err = scipy.array(put.vsnk_err.data()[20:])
+ data_rat = scipy.array(put.vsnk_rat.data()[20:])
+ data_phs = scipy.array(put.vsnk_phs.data()[20:])
+
+ f1 = pylab.figure(1, figsize=(12,10), facecolor='w')
+
+ # Plot the IQ symbols
+ s1 = f1.add_subplot(2,2,1)
+ s1.plot(data_src.real, data_src.imag, "bo")
+ s1.plot(data_clk.real, data_clk.imag, "ro")
+ s1.set_title("IQ")
+ s1.set_xlabel("Real part")
+ s1.set_ylabel("Imag part")
+ s1.set_xlim([-2, 2])
+ s1.set_ylim([-2, 2])
+
+ # Plot the symbols in time
+ s2 = f1.add_subplot(2,2,2)
+ s2.plot(data_src.real, "bo-")
+ s2.plot(data_clk.real, "ro")
+ s2.set_title("Symbols")
+ s2.set_xlabel("Samples")
+ s2.set_ylabel("Real Part of Signals")
+
+ # Plot the clock recovery loop's error
+ s3 = f1.add_subplot(2,2,3)
+ s3.plot(data_err)
+ s3.set_title("Clock Recovery Loop Error")
+ s3.set_xlabel("Samples")
+ s3.set_ylabel("Error")
+
+ # Plot the clock recovery loop's error
+ s4 = f1.add_subplot(2,2,4)
+ s4.plot(data_phs)
+ s4.set_title("Clock Recovery Loop Filter Phase")
+ s4.set_xlabel("Samples")
+ s4.set_ylabel("Filter Phase")
+
+
+ diff_taps = put.dtaps
+ ntaps = len(diff_taps[0])
+ nfilts = len(diff_taps)
+ t = scipy.arange(0, ntaps*nfilts)
+
+ f3 = pylab.figure(3, figsize=(12,10), facecolor='w')
+ s31 = f3.add_subplot(2,1,1)
+ s32 = f3.add_subplot(2,1,2)
+ s31.set_title("Differential Filters")
+ s32.set_title("FFT of Differential Filters")
+
+ for i,d in enumerate(diff_taps):
+ D = 20.0*scipy.log10(abs(fftpack.fftshift(fftpack.fft(d, 10000))))
+ s31.plot(t[i::nfilts].real, d, "-o")
+ s32.plot(D)
+
+ # If testing the M&M clock recovery loop
+ else:
+ data_src = scipy.array(put.vsnk_src.data()[20:])
+ data_clk = scipy.array(put.vsnk_clk.data()[20:])
+
+ data_err = scipy.array(put.vsnk_err.data()[20:])
+
+ f1 = pylab.figure(1, figsize=(12,10), facecolor='w')
+
+ # Plot the IQ symbols
+ s1 = f1.add_subplot(2,2,1)
+ s1.plot(data_src.real, data_src.imag, "o")
+ s1.plot(data_clk.real, data_clk.imag, "ro")
+ s1.set_title("IQ")
+ s1.set_xlabel("Real part")
+ s1.set_ylabel("Imag part")
+ s1.set_xlim([-2, 2])
+ s1.set_ylim([-2, 2])
+
+ # Plot the symbols in time
+ s2 = f1.add_subplot(2,2,2)
+ s2.plot(data_src.real, "o-")
+ s2.plot(data_clk.real, "ro")
+ s2.set_title("Symbols")
+ s2.set_xlabel("Samples")
+ s2.set_ylabel("Real Part of Signals")
+
+ # Plot the clock recovery loop's error
+ s3 = f1.add_subplot(2,2,3)
+ s3.plot(data_err)
+ s3.set_title("Clock Recovery Loop Error")
+ s3.set_xlabel("Samples")
+ s3.set_ylabel("Error")
+
+ pylab.show()
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gr-digital/examples/receive_path.py b/gr-digital/examples/receive_path.py
index 9bc5f7b8f2..dd8eb1a0dd 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
+ 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 * self._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
@@ -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(self.demodulator,
access_code=None,
callback=self._rx_callback,
threshold=-1)
@@ -88,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):
"""
@@ -137,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 91869ad9ad..f22ffb3278 100644
--- a/gr-digital/examples/transmit_path.py
+++ b/gr-digital/examples/transmit_path.py
@@ -44,17 +44,17 @@ 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
# Get mod_kwargs
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())