summaryrefslogtreecommitdiff
path: root/gr-digital
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2012-08-18 11:08:06 -0400
committerTom Rondeau <trondeau@vt.edu>2012-08-18 11:08:06 -0400
commita8f91e9cca303d13fa153e8995fe8d093e3217ab (patch)
treea7897adcce21a7c6feab128a90945ccce73def79 /gr-digital
parenta20c676a1a33c6a869844ce92f351e5ae8cfa044 (diff)
digital: cleaning up.
Diffstat (limited to 'gr-digital')
-rw-r--r--gr-digital/include/digital/metric_type.h12
-rw-r--r--gr-digital/include/digital/mpsk_snr_est.h4
-rwxr-xr-xgr-digital/python/qa_binary_slicer_fb.py10
-rwxr-xr-xgr-digital/python/qa_bytes_to_syms.py51
-rwxr-xr-xgr-digital/python/qa_chunks_to_symbols.py6
-rwxr-xr-xgr-digital/python/qa_clock_recovery_mm.py22
-rwxr-xr-xgr-digital/python/qa_constellation_decoder_cb.py12
-rwxr-xr-xgr-digital/python/qa_constellation_receiver.py2
-rwxr-xr-xgr-digital/python/qa_costas_loop_cc.py39
-rwxr-xr-xgr-digital/python/qa_diff_encoder.py8
-rwxr-xr-xgr-digital/python/qa_diff_phasor_cc.py26
-rwxr-xr-xgr-digital/python/qa_digital.py8
-rwxr-xr-xgr-digital/python/qa_fll_band_edge.py10
-rwxr-xr-xgr-digital/python/qa_framer_sink.py8
-rwxr-xr-xgr-digital/python/qa_map.py10
-rwxr-xr-xgr-digital/python/qa_mpsk_receiver.py10
-rwxr-xr-xgr-digital/python/qa_mpsk_snr_est.py2
-rwxr-xr-xgr-digital/python/qa_ofdm_insert_preamble.py16
-rwxr-xr-xgr-digital/python/qa_pfb_clock_sync.py14
-rwxr-xr-xgr-digital/python/qa_pn_correlator_cc.py2
-rwxr-xr-xgr-digital/python/qa_probe_density.py4
-rwxr-xr-xgr-digital/python/qa_scrambler.py2
-rw-r--r--gr-digital/swig/digital_swig.i11
23 files changed, 118 insertions, 171 deletions
diff --git a/gr-digital/include/digital/metric_type.h b/gr-digital/include/digital/metric_type.h
index 7eacc95150..c277f01d27 100644
--- a/gr-digital/include/digital/metric_type.h
+++ b/gr-digital/include/digital/metric_type.h
@@ -23,9 +23,15 @@
#ifndef INCLUDED_DIGITAL_METRIC_TYPE_H
#define INCLUDED_DIGITAL_METRIC_TYPE_H
-typedef enum {
- TRELLIS_EUCLIDEAN = 200, TRELLIS_HARD_SYMBOL, TRELLIS_HARD_BIT
-} trellis_metric_type_t;
+namespace gr {
+ namespace digital {
+
+ typedef enum {
+ TRELLIS_EUCLIDEAN = 200, TRELLIS_HARD_SYMBOL, TRELLIS_HARD_BIT
+ } trellis_metric_type_t;
+
+ } /* namespace digital */
+} /* namespace gr */
#endif /* INCLUDED_DIGITAL_METRIC_TYPE_H */
diff --git a/gr-digital/include/digital/mpsk_snr_est.h b/gr-digital/include/digital/mpsk_snr_est.h
index 80dad77ce3..69c03430d3 100644
--- a/gr-digital/include/digital/mpsk_snr_est.h
+++ b/gr-digital/include/digital/mpsk_snr_est.h
@@ -42,12 +42,12 @@ namespace gr {
* \li SNR_EST_M2M4: 2nd & 4th moment est (>= 1 dB)
* \li SNR_EST_SVR: SVR-based est (>= 0dB)
*/
- enum snr_est_type_t {
+ typedef enum {
SNR_EST_SIMPLE = 0, // Simple estimator (>= 7 dB)
SNR_EST_SKEW, // Skewness-base est (>= 5 dB)
SNR_EST_M2M4, // 2nd & 4th moment est (>= 1 dB)
SNR_EST_SVR // SVR-based est (>= 0dB)
- };
+ } snr_est_type_t;
/*! \brief A parent class for SNR estimators, specifically for
* M-PSK signals in AWGN channels.
diff --git a/gr-digital/python/qa_binary_slicer_fb.py b/gr-digital/python/qa_binary_slicer_fb.py
index f3cc944e54..22f7da73ff 100755
--- a/gr-digital/python/qa_binary_slicer_fb.py
+++ b/gr-digital/python/qa_binary_slicer_fb.py
@@ -24,15 +24,15 @@ from gnuradio import gr, gr_unittest
import digital_swig as digital
import math, random
-class test_binary_slicer_fb (gr_unittest.TestCase):
+class test_binary_slicer_fb(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test_binary_slicer_fb (self):
+ def test_binary_slicer_fb(self):
expected_result = ( 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1)
src_data = (-1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1)
src_data = [s + (1 - random.random()) for s in src_data] # add some noise
diff --git a/gr-digital/python/qa_bytes_to_syms.py b/gr-digital/python/qa_bytes_to_syms.py
deleted file mode 100755
index 75475a95b2..0000000000
--- a/gr-digital/python/qa_bytes_to_syms.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from gnuradio import gr, gr_unittest
-import digital_swig as digital
-import math
-
-class test_bytes_to_syms (gr_unittest.TestCase):
-
- def setUp (self):
- self.tb = gr.top_block ()
-
- def tearDown (self):
- self.tb = None
-
- def test_bytes_to_syms_001 (self):
- src_data = (0x01, 0x80, 0x03)
- expected_result = (-1, -1, -1, -1, -1, -1, -1, +1,
- +1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, +1, +1)
- src = gr.vector_source_b (src_data)
- op = digital.bytes_to_syms ()
- dst = gr.vector_sink_f ()
- self.tb.connect (src, op)
- self.tb.connect (op, dst)
- self.tb.run ()
- result_data = dst.data ()
- self.assertEqual (expected_result, result_data)
-
-if __name__ == '__main__':
- gr_unittest.run(test_bytes_to_syms, "test_bytes_to_syms.xml")
-
diff --git a/gr-digital/python/qa_chunks_to_symbols.py b/gr-digital/python/qa_chunks_to_symbols.py
index 63af10d8ff..5ffe425132 100755
--- a/gr-digital/python/qa_chunks_to_symbols.py
+++ b/gr-digital/python/qa_chunks_to_symbols.py
@@ -25,10 +25,10 @@ import digital_swig as digital
class test_chunks_to_symbols(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def test_bc_001(self):
diff --git a/gr-digital/python/qa_clock_recovery_mm.py b/gr-digital/python/qa_clock_recovery_mm.py
index 2f7bfde39d..e904cf4c21 100755
--- a/gr-digital/python/qa_clock_recovery_mm.py
+++ b/gr-digital/python/qa_clock_recovery_mm.py
@@ -26,13 +26,13 @@ import random, cmath
class test_clock_recovery_mm(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test01 (self):
+ def test01(self):
# Test complex/complex version
omega = 2
gain_omega = 0.001
@@ -64,10 +64,10 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
#print expected_result
#print dst_data
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5)
- def test02 (self):
+ def test02(self):
# Test float/float version
omega = 2
gain_omega = 0.01
@@ -99,10 +99,10 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
#print expected_result
#print dst_data
- self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5)
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5)
- def test03 (self):
+ def test03(self):
# Test complex/complex version with varying input
omega = 2
gain_omega = 0.01
@@ -134,10 +134,10 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
#print expected_result
#print dst_data
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 1)
- def test04 (self):
+ def test04(self):
# Test float/float version
omega = 2
gain_omega = 0.01
@@ -169,7 +169,7 @@ class test_clock_recovery_mm(gr_unittest.TestCase):
#print expected_result
#print dst_data
- self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 1)
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 1)
if __name__ == '__main__':
diff --git a/gr-digital/python/qa_constellation_decoder_cb.py b/gr-digital/python/qa_constellation_decoder_cb.py
index f339263db2..6a93b6e743 100755
--- a/gr-digital/python/qa_constellation_decoder_cb.py
+++ b/gr-digital/python/qa_constellation_decoder_cb.py
@@ -24,15 +24,15 @@ from gnuradio import gr, gr_unittest
import digital_swig as digital
import math
-class test_constellation_decoder (gr_unittest.TestCase):
+class test_constellation_decoder(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test_constellation_decoder_cb_bpsk (self):
+ def test_constellation_decoder_cb_bpsk(self):
cnst = digital.constellation_bpsk()
src_data = (0.5 + 0.5j, 0.1 - 1.2j, -0.8 - 0.1j, -0.45 + 0.8j,
0.8 + 1.0j, -0.5 + 0.1j, 0.1 - 1.2j)
@@ -51,7 +51,7 @@ class test_constellation_decoder (gr_unittest.TestCase):
#print "expected result", expected_result
self.assertFloatTuplesAlmostEqual(expected_result, actual_result)
- def _test_constellation_decoder_cb_qpsk (self):
+ def _test_constellation_decoder_cb_qpsk(self):
cnst = digital.constellation_qpsk()
src_data = (0.5 + 0.5j, 0.1 - 1.2j, -0.8 - 0.1j, -0.45 + 0.8j,
0.8 + 1.0j, -0.5 + 0.1j, 0.1 - 1.2j)
diff --git a/gr-digital/python/qa_constellation_receiver.py b/gr-digital/python/qa_constellation_receiver.py
index 53b1b752fe..871df2da28 100755
--- a/gr-digital/python/qa_constellation_receiver.py
+++ b/gr-digital/python/qa_constellation_receiver.py
@@ -52,7 +52,7 @@ FREQ_BW = 2*math.pi/100.0
PHASE_BW = 2*math.pi/100.0
-class test_constellation_receiver (gr_unittest.TestCase):
+class test_constellation_receiver(gr_unittest.TestCase):
# We ignore the first half of the output data since often it takes
# a while for the receiver to lock on.
diff --git a/gr-digital/python/qa_costas_loop_cc.py b/gr-digital/python/qa_costas_loop_cc.py
index 75fdbc2f84..365eda736a 100755
--- a/gr-digital/python/qa_costas_loop_cc.py
+++ b/gr-digital/python/qa_costas_loop_cc.py
@@ -21,22 +21,23 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig, psk
+import digital_swig as digital
+import psk
import random, cmath
class test_costas_loop_cc(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test01 (self):
+ def test01(self):
# test basic functionality by setting all gains to 0
natfreq = 0.0
order = 2
- self.test = digital_swig.costas_loop_cc(natfreq, order)
+ self.test = digital.costas_loop_cc(natfreq, order)
data = 100*[complex(1,0),]
self.src = gr.vector_source_c(data, False)
@@ -47,13 +48,13 @@ class test_costas_loop_cc(gr_unittest.TestCase):
expected_result = data
dst_data = self.snk.data()
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5)
- def test02 (self):
+ def test02(self):
# Make sure it doesn't diverge given perfect data
natfreq = 0.25
order = 2
- self.test = digital_swig.costas_loop_cc(natfreq, order)
+ self.test = digital.costas_loop_cc(natfreq, order)
data = [complex(2*random.randint(0,1)-1, 0) for i in xrange(100)]
self.src = gr.vector_source_c(data, False)
@@ -65,13 +66,13 @@ class test_costas_loop_cc(gr_unittest.TestCase):
expected_result = data
dst_data = self.snk.data()
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5)
- def test03 (self):
+ def test03(self):
# BPSK Convergence test with static rotation
natfreq = 0.25
order = 2
- self.test = digital_swig.costas_loop_cc(natfreq, order)
+ self.test = digital.costas_loop_cc(natfreq, order)
rot = cmath.exp(0.2j) # some small rotation
data = [complex(2*random.randint(0,1)-1, 0) for i in xrange(100)]
@@ -90,13 +91,13 @@ class test_costas_loop_cc(gr_unittest.TestCase):
# generously compare results; the loop will converge near to, but
# not exactly on, the target data
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 2)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 2)
- def test04 (self):
+ def test04(self):
# QPSK Convergence test with static rotation
natfreq = 0.25
order = 4
- self.test = digital_swig.costas_loop_cc(natfreq, order)
+ self.test = digital.costas_loop_cc(natfreq, order)
rot = cmath.exp(0.2j) # some small rotation
data = [complex(2*random.randint(0,1)-1, 2*random.randint(0,1)-1)
@@ -116,13 +117,13 @@ class test_costas_loop_cc(gr_unittest.TestCase):
# generously compare results; the loop will converge near to, but
# not exactly on, the target data
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 2)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 2)
- def test05 (self):
+ def test05(self):
# 8PSK Convergence test with static rotation
natfreq = 0.25
order = 8
- self.test = digital_swig.costas_loop_cc(natfreq, order)
+ self.test = digital.costas_loop_cc(natfreq, order)
rot = cmath.exp(-cmath.pi/8.0j) # rotate to match Costas rotation
const = psk.psk_constellation(order)
@@ -145,7 +146,7 @@ class test_costas_loop_cc(gr_unittest.TestCase):
# generously compare results; the loop will converge near to, but
# not exactly on, the target data
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 2)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 2)
if __name__ == '__main__':
gr_unittest.run(test_costas_loop_cc, "test_costas_loop_cc.xml")
diff --git a/gr-digital/python/qa_diff_encoder.py b/gr-digital/python/qa_diff_encoder.py
index e4f5470af5..c28f4dbdf8 100755
--- a/gr-digital/python/qa_diff_encoder.py
+++ b/gr-digital/python/qa_diff_encoder.py
@@ -32,12 +32,12 @@ def make_random_int_tuple(L, min, max):
return tuple(result)
-class test_diff_encoder (gr_unittest.TestCase):
+class test_diff_encoder(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def test_diff_encdec_000(self):
diff --git a/gr-digital/python/qa_diff_phasor_cc.py b/gr-digital/python/qa_diff_phasor_cc.py
index 3e7617fe47..833158d0a8 100755
--- a/gr-digital/python/qa_diff_phasor_cc.py
+++ b/gr-digital/python/qa_diff_phasor_cc.py
@@ -24,25 +24,25 @@ from gnuradio import gr, gr_unittest
import digital_swig as digital
import math
-class test_diff_phasor (gr_unittest.TestCase):
+class test_diff_phasor(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test_diff_phasor_cc (self):
+ def test_diff_phasor_cc(self):
src_data = (0+0j, 1+0j, -1+0j, 3+4j, -3-4j, -3+4j)
expected_result = (0+0j, 0+0j, -1+0j, -3-4j, -25+0j, -7-24j)
- src = gr.vector_source_c (src_data)
- op = digital.diff_phasor_cc ()
- dst = gr.vector_sink_c ()
- self.tb.connect (src, op)
- self.tb.connect (op, dst)
- self.tb.run () # run the graph and wait for it to finish
- actual_result = dst.data () # fetch the contents of the sink
- self.assertComplexTuplesAlmostEqual (expected_result, actual_result)
+ src = gr.vector_source_c(src_data)
+ op = digital.diff_phasor_cc()
+ dst = gr.vector_sink_c()
+ self.tb.connect(src, op)
+ self.tb.connect(op, dst)
+ self.tb.run() # run the graph and wait for it to finish
+ actual_result = dst.data() # fetch the contents of the sink
+ self.assertComplexTuplesAlmostEqual(expected_result, actual_result)
if __name__ == '__main__':
gr_unittest.run(test_diff_phasor, "test_diff_phasor.xml")
diff --git a/gr-digital/python/qa_digital.py b/gr-digital/python/qa_digital.py
index 97e35da568..6f54f14208 100755
--- a/gr-digital/python/qa_digital.py
+++ b/gr-digital/python/qa_digital.py
@@ -21,14 +21,14 @@
#
from gnuradio import gr, gr_unittest
-import digital_swig
+import digital_swig as digital
class test_digital(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
if __name__ == '__main__':
diff --git a/gr-digital/python/qa_fll_band_edge.py b/gr-digital/python/qa_fll_band_edge.py
index 80d6079a16..a4269931f5 100755
--- a/gr-digital/python/qa_fll_band_edge.py
+++ b/gr-digital/python/qa_fll_band_edge.py
@@ -27,13 +27,13 @@ import random, math
class test_fll_band_edge_cc(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test01 (self):
+ def test01(self):
sps = 4
rolloff = 0.35
bw = 2*math.pi/100.0
@@ -79,7 +79,7 @@ class test_fll_band_edge_cc(gr_unittest.TestCase):
dst_data = self.vsnk_frq.data()[N:]
expected_result = len(dst_data)* [-0.20,]
- self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4)
+ self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 4)
if __name__ == '__main__':
gr_unittest.run(test_fll_band_edge_cc, "test_fll_band_edge_cc.xml")
diff --git a/gr-digital/python/qa_framer_sink.py b/gr-digital/python/qa_framer_sink.py
index bccc86dc78..e717e6ae05 100755
--- a/gr-digital/python/qa_framer_sink.py
+++ b/gr-digital/python/qa_framer_sink.py
@@ -63,11 +63,11 @@ class test_framker_sink(gr_unittest.TestCase):
self.tb.connect(src, correlator, framer_sink)
self.tb.connect(correlator, vsnk)
- self.tb.run ()
+ self.tb.run()
result_data = rcvd_pktq.delete_head()
result_data = result_data.to_string()
- self.assertEqual (expected_data, result_data)
+ self.assertEqual(expected_data, result_data)
def test_002(self):
@@ -87,11 +87,11 @@ class test_framker_sink(gr_unittest.TestCase):
self.tb.connect(src, correlator, framer_sink)
self.tb.connect(correlator, vsnk)
- self.tb.run ()
+ self.tb.run()
result_data = rcvd_pktq.delete_head()
result_data = result_data.to_string()
- self.assertEqual (expected_data, result_data)
+ self.assertEqual(expected_data, result_data)
if __name__ == '__main__':
gr_unittest.run(test_framker_sink, "test_framker_sink.xml")
diff --git a/gr-digital/python/qa_map.py b/gr-digital/python/qa_map.py
index 3ad99a2c12..0fd7c479a1 100755
--- a/gr-digital/python/qa_map.py
+++ b/gr-digital/python/qa_map.py
@@ -34,14 +34,14 @@ class test_map(gr_unittest.TestCase):
def helper(self, symbols):
src_data = [0, 1, 2, 3, 0, 1, 2, 3]
expected_data = map(lambda x: symbols[x], src_data)
- src = gr.vector_source_b (src_data)
+ src = gr.vector_source_b(src_data)
op = digital.map_bb(symbols)
- dst = gr.vector_sink_b ()
- self.tb.connect (src, op, dst)
- self.tb.run ()
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
result_data = list(dst.data())
- self.assertEqual (expected_data, result_data)
+ self.assertEqual(expected_data, result_data)
def test_001(self):
symbols = [0, 0, 0, 0]
diff --git a/gr-digital/python/qa_mpsk_receiver.py b/gr-digital/python/qa_mpsk_receiver.py
index aa2973eb45..bde8895e76 100755
--- a/gr-digital/python/qa_mpsk_receiver.py
+++ b/gr-digital/python/qa_mpsk_receiver.py
@@ -86,7 +86,7 @@ class test_mpsk_receiver(gr_unittest.TestCase):
self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 1)
- def test02 (self):
+ def test02(self):
# Test QPSK sync
M = 4
theta = 0
@@ -96,7 +96,7 @@ class test_mpsk_receiver(gr_unittest.TestCase):
mu = 0.5
gain_mu = 0.01
omega = 2
- gain_omega = 0.01
+ gain_omega = 0.001
omega_rel = 0.001
self.test = digital.mpsk_receiver_cc(M, theta, loop_bw,
@@ -126,11 +126,11 @@ class test_mpsk_receiver(gr_unittest.TestCase):
self.tb.connect(self.src, self.rrc0, self.rrc1, self.test, self.snk)
self.tb.run()
- expected_result = 10000*[complex(0, +0.5), complex(-0.5, 0),
- complex(0, -0.5), complex(+0.5, 0)]
+ expected_result = 10000*[complex(-0.5, +0.0), complex(+0.0, -0.5),
+ complex(+0.5, +0.0), complex(+0.0, +0.5)]
# get data after a settling period
- dst_data = self.snk.data()[100:]
+ dst_data = self.snk.data()[200:]
# Only compare last Ncmp samples
Ncmp = 1000
diff --git a/gr-digital/python/qa_mpsk_snr_est.py b/gr-digital/python/qa_mpsk_snr_est.py
index 5e3377f7a7..c976bf21a8 100755
--- a/gr-digital/python/qa_mpsk_snr_est.py
+++ b/gr-digital/python/qa_mpsk_snr_est.py
@@ -87,7 +87,7 @@ class test_mpsk_snr_est(gr_unittest.TestCase):
actual_result = self.mpsk_snr_est_setup(op)
self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 2)
- def test_mpsk_snr_est_svn (self):
+ def test_mpsk_snr_est_svn(self):
expected_result = [10.90, 6.00, 4.76, 4.97, 5.49]
N = 10000
diff --git a/gr-digital/python/qa_ofdm_insert_preamble.py b/gr-digital/python/qa_ofdm_insert_preamble.py
index c45893fa38..d084796644 100755
--- a/gr-digital/python/qa_ofdm_insert_preamble.py
+++ b/gr-digital/python/qa_ofdm_insert_preamble.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007,2010,2011 Free Software Foundation, Inc.
+# Copyright 2007,2010-2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,14 +22,14 @@
from gnuradio import gr, gr_unittest
from pprint import pprint
-import digital_swig
+import digital_swig as digital
-class test_ofdm_insert_preamble (gr_unittest.TestCase):
+class test_ofdm_insert_preamble(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
def helper(self, v0, v1, fft_length, preamble):
@@ -41,7 +41,7 @@ class test_ofdm_insert_preamble (gr_unittest.TestCase):
# print "len(v) = %d" % (len(v))
- op = digital_swig.ofdm_insert_preamble(fft_length, preamble)
+ op = digital.ofdm_insert_preamble(fft_length, preamble)
v2s = gr.vector_to_stream(gr.sizeof_gr_complex, fft_length)
dst0 = gr.vector_sink_c()
@@ -105,7 +105,6 @@ class test_ofdm_insert_preamble (gr_unittest.TestCase):
p.append(tuple(t))
v += t
-
r = self.helper(v, npayloads*[1], fft_length, preamble)
self.assertEqual(r[0], tuple(npayloads*[1, 0]))
@@ -175,6 +174,5 @@ class test_ofdm_insert_preamble (gr_unittest.TestCase):
p0, p1, p[12], p[13],
p0, p1, p[14], p[15]))
-
if __name__ == '__main__':
gr_unittest.run(test_ofdm_insert_preamble, "test_ofdm_insert_preamble.xml")
diff --git a/gr-digital/python/qa_pfb_clock_sync.py b/gr-digital/python/qa_pfb_clock_sync.py
index 27322616de..44419264f7 100755
--- a/gr-digital/python/qa_pfb_clock_sync.py
+++ b/gr-digital/python/qa_pfb_clock_sync.py
@@ -27,13 +27,13 @@ import random, cmath
class test_pfb_clock_sync(gr_unittest.TestCase):
- def setUp (self):
- self.tb = gr.top_block ()
+ def setUp(self):
+ self.tb = gr.top_block()
- def tearDown (self):
+ def tearDown(self):
self.tb = None
- def test01 (self):
+ def test01(self):
# Test BPSK sync
excess_bw = 0.35
@@ -83,10 +83,10 @@ class test_pfb_clock_sync(gr_unittest.TestCase):
#for e,d in zip(expected_result, dst_data):
# print e, d
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 1)
- def test02 (self):
+ def test02(self):
# Test real BPSK sync
excess_bw = 0.35
@@ -136,7 +136,7 @@ class test_pfb_clock_sync(gr_unittest.TestCase):
#for e,d in zip(expected_result, dst_data):
# print e, d
- self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 1)
+ self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 1)
if __name__ == '__main__':
diff --git a/gr-digital/python/qa_pn_correlator_cc.py b/gr-digital/python/qa_pn_correlator_cc.py
index 377bef5feb..4e81bf6662 100755
--- a/gr-digital/python/qa_pn_correlator_cc.py
+++ b/gr-digital/python/qa_pn_correlator_cc.py
@@ -26,7 +26,7 @@ import digital_swig as digital
class test_pn_correlator_cc(gr_unittest.TestCase):
def setUp(self):
- self.tb = gr.top_block ()
+ self.tb = gr.top_block()
def tearDown(self):
self.tb = None
diff --git a/gr-digital/python/qa_probe_density.py b/gr-digital/python/qa_probe_density.py
index a782ed45a4..f42f00a7f7 100755
--- a/gr-digital/python/qa_probe_density.py
+++ b/gr-digital/python/qa_probe_density.py
@@ -36,8 +36,8 @@ class test_probe_density(gr_unittest.TestCase):
expected_data = 1
src = gr.vector_source_b(src_data)
op = digital.probe_density_b(1)
- self.tb.connect (src, op)
- self.tb.run ()
+ self.tb.connect(src, op)
+ self.tb.run()
result_data = op.density()
self.assertEqual(expected_data, result_data)
diff --git a/gr-digital/python/qa_scrambler.py b/gr-digital/python/qa_scrambler.py
index f5bd612429..3127a7c1e6 100755
--- a/gr-digital/python/qa_scrambler.py
+++ b/gr-digital/python/qa_scrambler.py
@@ -25,7 +25,7 @@ import digital_swig as digital
class test_scrambler(gr_unittest.TestCase):
- def setUp (self):
+ def setUp(self):
self.tb = gr.top_block()
def tearDown(self):
diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i
index b2fe51f58f..ffcfb8251c 100644
--- a/gr-digital/swig/digital_swig.i
+++ b/gr-digital/swig/digital_swig.i
@@ -26,21 +26,13 @@
//load generated python docstrings
%include "digital_swig_doc.i"
-//enum snr_est_type_t {
-// SNR_EST_SIMPLE = 0, // Simple estimator (>= 7 dB)
-// SNR_EST_SKEW, // Skewness-base est (>= 5 dB)
-// SNR_EST_M2M4, // 2nd & 4th moment est (>= 1 dB)
-// SNR_EST_SVR // SVR-based est (>= 0dB)
-//};
-
-//%include <gri_control_loop.i>
-
%include "gr_cpm.h"
// Used in the constellation objects
%template(unsigned_int_vector) std::vector<unsigned int>;
%{
+#include "digital/metric_type.h"
#include "digital/mpsk_snr_est.h"
#include "digital/additive_scrambler_bb.h"
#include "digital/binary_slicer_fb.h"
@@ -90,6 +82,7 @@
#include "digital/simple_framer.h"
%}
+%include "digital/metric_type.h"
%include "digital/mpsk_snr_est.h"
%include "digital/additive_scrambler_bb.h"
%include "digital/binary_slicer_fb.h"