summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Reynwar <ben@reynwar.net>2013-03-06 13:41:33 -0700
committerBen Reynwar <ben@reynwar.net>2013-03-06 13:41:33 -0700
commitbed49a09f0c395f29d0a367a4bafce12b9765fa9 (patch)
tree90ef0ca9fd1127285ae67c724f35c9012faf38df
parent4c0802e83d72ca43536c2cc2842bb0aadb9c71ec (diff)
digital: Making qa_constellation_receiver more reliable.
-rwxr-xr-xgr-digital/python/qa_constellation.py52
-rwxr-xr-xgr-digital/python/qa_constellation_receiver.py50
2 files changed, 71 insertions, 31 deletions
diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py
index 1560021f56..0e3ab72ee4 100755
--- a/gr-digital/python/qa_constellation.py
+++ b/gr-digital/python/qa_constellation.py
@@ -64,19 +64,19 @@ def threed_constell():
dim = 3
return digital_swig.constellation_calcdist(points, [], rot_sym, dim)
-tested_constellation_info = (
+# A list of tuples for constellation testing. The contents of the
+# tuples are (constructor, poss_args, differential, diff_argname).
+
+# These constellations should lock on well.
+easy_constellation_info = (
(psk.psk_constellation,
- {'m': (2, 4, 8, 16, 32, 64),
- 'mod_code': tested_mod_codes, },
- True, None),
- (qam.qam_constellation,
- {'constellation_points': (4, 16, 64),
+ {'m': (2, 4, 8, 16, ),
'mod_code': tested_mod_codes, },
True, None),
(qam.qam_constellation,
- {'constellation_points': (16, 64),
- 'mod_code': [mod_codes.GRAY_CODE],
- 'large_ampls_to_corners': [True]},
+ {'constellation_points': (4,),
+ 'mod_code': tested_mod_codes,
+ 'large_ampls_to_corners': [False],},
True, None),
(digital_swig.constellation_bpsk, {}, True, None),
(digital_swig.constellation_qpsk, {}, False, None),
@@ -86,11 +86,41 @@ tested_constellation_info = (
(threed_constell, {}, True, None),
)
-def tested_constellations():
+# These constellations don't work nicely.
+# We have a lower required error rate.
+medium_constellation_info = (
+ (psk.psk_constellation,
+ {'m': (32, 64),
+ 'mod_code': tested_mod_codes, },
+ True, None),
+ (qam.qam_constellation,
+ {'constellation_points': (16 ,),
+ 'mod_code': tested_mod_codes,
+ 'large_ampls_to_corners': [False, True],},
+ True, None),
+)
+
+# These constellation are basically broken in our test
+difficult_constellation_info = (
+ (qam.qam_constellation,
+ {'constellation_points': (64,),
+ 'mod_code': tested_mod_codes,
+ 'large_ampls_to_corners': [False, True],},
+ True, None),
+)
+
+def tested_constellations(easy=True, medium=True, difficult=True):
"""
Generator to produce (constellation, differential) tuples for testing purposes.
"""
- for constructor, poss_args, differential, diff_argname in tested_constellation_info:
+ constellation_info = []
+ if easy:
+ constellation_info += easy_constellation_info
+ if medium:
+ constellation_info += medium_constellation_info
+ if difficult:
+ constellation_info += difficult_constellation_info
+ for constructor, poss_args, differential, diff_argname in constellation_info:
if differential:
diff_poss = (True, False)
else:
diff --git a/gr-digital/python/qa_constellation_receiver.py b/gr-digital/python/qa_constellation_receiver.py
index 2d25433b92..37e56b4cf7 100755
--- a/gr-digital/python/qa_constellation_receiver.py
+++ b/gr-digital/python/qa_constellation_receiver.py
@@ -39,7 +39,9 @@ SEED = 1239
# We need this many to let the frequency recovery block converge.
DATA_LENGTH = 2000
# Test fails if fraction of output that is correct is less than this.
-REQ_CORRECT = 0.7
+EASY_REQ_CORRECT = 0.9
+# For constellations that aren't expected to work so well.
+MEDIUM_REQ_CORRECT = 0.8
# CHANNEL PARAMETERS
NOISE_VOLTAGE = 0.01
@@ -78,25 +80,33 @@ class test_constellation_receiver (gr_unittest.TestCase):
self.indices = alignment.random_sample(
self.max_data_length, self.max_num_samples, SEED)
- for constellation, differential in tested_constellations():
- # The constellation_receiver doesn't work for constellations
- # of multple dimensions (i.e. multiple complex numbers to a
- # single symbol).
- # That is not implemented since the receiver has no way of
- # knowing where the beginning of a symbol is.
- # It also doesn't work for non-differential modulation.
- if constellation.dimensionality() != 1 or not differential:
- continue
- data_length = DATA_LENGTH * constellation.bits_per_symbol()
- tb = rec_test_tb(constellation, differential,
- src_data=self.src_data[:data_length])
- tb.run()
- data = tb.dst.data()
- d1 = tb.src_data[:int(len(tb.src_data)*self.ignore_fraction)]
- d2 = data[:int(len(data)*self.ignore_fraction)]
- correct, overlap, offset, indices = alignment.align_sequences(
- d1, d2, indices=self.indices)
- self.assertTrue(correct > REQ_CORRECT)
+ requirements = (
+ (EASY_REQ_CORRECT, tested_constellations(easy=True, medium=False, difficult=False)),
+ (MEDIUM_REQ_CORRECT, tested_constellations(easy=False, medium=True, difficult=False)),
+ )
+ for req_correct, tcs in requirements:
+ for constellation, differential in tcs:
+ # The constellation_receiver doesn't work for constellations
+ # of multple dimensions (i.e. multiple complex numbers to a
+ # single symbol).
+ # That is not implemented since the receiver has no way of
+ # knowing where the beginning of a symbol is.
+ # It also doesn't work for non-differential modulation.
+ if constellation.dimensionality() != 1 or not differential:
+ continue
+ data_length = DATA_LENGTH * constellation.bits_per_symbol()
+ tb = rec_test_tb(constellation, differential,
+ src_data=self.src_data[:data_length])
+ tb.run()
+ data = tb.dst.data()
+ d1 = tb.src_data[:int(len(tb.src_data)*self.ignore_fraction)]
+ d2 = data[:int(len(data)*self.ignore_fraction)]
+ correct, overlap, offset, indices = alignment.align_sequences(
+ d1, d2, indices=self.indices)
+ if correct <= req_correct:
+ print("Constellation is {0}. Differential is {1}. Required correct is {2}. Correct is {3}. FAIL.".
+ format(constellation, differential, req_correct, correct))
+ self.assertTrue(correct > req_correct)
class rec_test_tb (gr.top_block):