diff options
author | Tom Rondeau | 2011-07-12 23:02:47 -0400 |
---|---|---|
committer | Tom Rondeau | 2011-07-12 23:06:08 -0400 |
commit | 0b3d5b1a3238d9f72bcdef6aa3131776fb572175 (patch) | |
tree | c7bc86c8097ebf8371a17d83002844feffd866bd /gr-digital | |
parent | 54a1ae3aeea9709e436bb2fc69ae47aeffd1cb29 (diff) | |
download | gnuradio-0b3d5b1a3238d9f72bcdef6aa3131776fb572175.tar.gz gnuradio-0b3d5b1a3238d9f72bcdef6aa3131776fb572175.tar.bz2 gnuradio-0b3d5b1a3238d9f72bcdef6aa3131776fb572175.zip |
fixing build for constellation code. Had to make some changes to the qa code to import the right stuff after being changed from sitting in gnuradio-core.
Diffstat (limited to 'gr-digital')
-rw-r--r-- | gr-digital/lib/Makefile.am | 7 | ||||
-rw-r--r-- | gr-digital/lib/digital_constellation_decoder_cb.cc | 2 | ||||
-rw-r--r-- | gr-digital/lib/digital_constellation_decoder_cb.h | 2 | ||||
-rw-r--r-- | gr-digital/python/Makefile.am | 4 | ||||
-rw-r--r-- | gr-digital/python/__init__.py | 2 | ||||
-rw-r--r-- | gr-digital/python/generic_mod_demod.py | 6 | ||||
-rw-r--r-- | gr-digital/python/psk2.py | 8 | ||||
-rwxr-xr-x | gr-digital/python/qa_constellation.py | 20 | ||||
-rwxr-xr-x | gr-digital/python/qa_constellation_receiver.py | 13 | ||||
-rw-r--r-- | gr-digital/python/qam.py | 10 | ||||
-rw-r--r-- | gr-digital/swig/digital_constellation_receiver_cb.i | 2 |
11 files changed, 45 insertions, 31 deletions
diff --git a/gr-digital/lib/Makefile.am b/gr-digital/lib/Makefile.am index 560d242ad..4f67614d8 100644 --- a/gr-digital/lib/Makefile.am +++ b/gr-digital/lib/Makefile.am @@ -38,13 +38,12 @@ lib_LTLIBRARIES = libgnuradio-digital.la libgnuradio_digital_la_SOURCES = \ digital_constellation.cc \ - digital_constellation_receiver_cb.h \ - digital_constellation_decoder_cb.h \ + digital_constellation_receiver_cb.cc \ + digital_constellation_decoder_cb.cc \ digital_costas_loop_cc.cc \ digital_cma_equalizer_cc.cc \ digital_lms_dd_equalizer_cc.cc \ - digital_kurtotic_equalizer_cc.cc \ - digital_constellation_receiver_cb.h + digital_kurtotic_equalizer_cc.cc libgnuradio_digital_la_LIBADD = \ $(GNURADIO_CORE_LA) diff --git a/gr-digital/lib/digital_constellation_decoder_cb.cc b/gr-digital/lib/digital_constellation_decoder_cb.cc index 8ac34f1d6..4638790f6 100644 --- a/gr-digital/lib/digital_constellation_decoder_cb.cc +++ b/gr-digital/lib/digital_constellation_decoder_cb.cc @@ -32,7 +32,7 @@ digital_constellation_decoder_cb_sptr digital_make_constellation_decoder_cb (digital_constellation_sptr constellation) { - return digital_constellation_decoder_cb_sptr + return gnuradio::get_initial_sptr (new digital_constellation_decoder_cb(constellation)); } diff --git a/gr-digital/lib/digital_constellation_decoder_cb.h b/gr-digital/lib/digital_constellation_decoder_cb.h index 420ae5c74..022456733 100644 --- a/gr-digital/lib/digital_constellation_decoder_cb.h +++ b/gr-digital/lib/digital_constellation_decoder_cb.h @@ -46,7 +46,7 @@ class digital_constellation_decoder_cb : public gr_block unsigned int d_dim; friend digital_constellation_decoder_cb_sptr - gr_make_constellation_decoder_cb (digital_constellation_sptr constellation); + digital_make_constellation_decoder_cb (digital_constellation_sptr constellation); digital_constellation_decoder_cb (digital_constellation_sptr constellation); diff --git a/gr-digital/python/Makefile.am b/gr-digital/python/Makefile.am index f4f72f8d8..f0bfbc28f 100644 --- a/gr-digital/python/Makefile.am +++ b/gr-digital/python/Makefile.am @@ -31,7 +31,9 @@ TESTS += run_tests digitaldir = $(grpythondir)/digital noinst_PYTHON = \ - qa_digital.py \ + qa_digital.py \ + qa_constellation.py \ + qa_constellation_receiver.py \ qa_costas_loop_cc.py digital_PYTHON = \ diff --git a/gr-digital/python/__init__.py b/gr-digital/python/__init__.py index 4bbb9850b..a17128e7d 100644 --- a/gr-digital/python/__init__.py +++ b/gr-digital/python/__init__.py @@ -25,3 +25,5 @@ from digital_swig import * from dbpsk import * from dqpsk import * from d8psk import * +from psk2 import * +from qam import * diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py index a85b21219..04302f0a4 100644 --- a/gr-digital/python/generic_mod_demod.py +++ b/gr-digital/python/generic_mod_demod.py @@ -27,7 +27,9 @@ Generic modulation and demodulation. from gnuradio import gr from gnuradio.modulation_utils2 import extract_kwargs_from_options_for_class -from gnuradio.digital.utils import mod_codes +#from gnuradio.digital.utils import mod_codes +from utils import mod_codes +import digital_swig # default values (used in __init__ and add_options) _def_samples_per_symbol = 2 @@ -282,7 +284,7 @@ class generic_demod(gr.hier_block2): fmin = -0.25 fmax = 0.25 - self.receiver = gr.constellation_receiver_cb( + self.receiver = digital_swig.constellation_receiver_cb( self._constellation, self._phase_alpha, self._phase_beta, fmin, fmax) diff --git a/gr-digital/python/psk2.py b/gr-digital/python/psk2.py index 089af11dd..6ab398e42 100644 --- a/gr-digital/python/psk2.py +++ b/gr-digital/python/psk2.py @@ -27,8 +27,10 @@ from math import pi, log from cmath import exp from gnuradio import gr, modulation_utils2 -from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod -from gnuradio.digital.utils import mod_codes, gray_code +import digital_swig +#from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod +from utils import mod_codes, gray_code +from generic_mod_demod import generic_mod, generic_demod # Default number of points in constellation. _def_constellation_points = 4 @@ -65,7 +67,7 @@ def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code): if post_diff_code is not None: inverse_post_diff_code = mod_codes.invert_code(post_diff_code) points = [points[x] for x in inverse_post_diff_code] - constellation = gr.constellation_psk(points, pre_diff_code, m) + constellation = digital_swig.constellation_psk(points, pre_diff_code, m) return constellation # ///////////////////////////////////////////////////////////////////////////// diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py index 72b9e99bc..02afb8d2d 100755 --- a/gr-digital/python/qa_constellation.py +++ b/gr-digital/python/qa_constellation.py @@ -27,6 +27,9 @@ from gnuradio import gr, gr_unittest, blks2 from utils import mod_codes import digital_swig +# import from local folder +import psk2 +import qam tested_mod_codes = (mod_codes.NO_CODE, mod_codes.GRAY_CODE) @@ -47,7 +50,7 @@ def twod_constell(): (-1+0j), (0-1j)) rot_sym = 2 dim = 2 - return gr.constellation_calcdist(points, [], rot_sym, dim) + return digital_swig.constellation_calcdist(points, [], rot_sym, dim) def threed_constell(): oned_points = ((1+0j), (0+1j), (-1+0j), (0-1j)) @@ -59,22 +62,19 @@ def threed_constell(): points += [oned_points[ia], oned_points[ib], oned_points[ic]] rot_sym = 4 dim = 3 - return gr.constellation_calcdist(points, [], rot_sym, dim) + return digital_swig.constellation_calcdist(points, [], rot_sym, dim) tested_constellation_info = ( - (blks2.psk_constellation, + (psk2.psk_constellation, {'m': (2, 4, 8, 16, 32, 64), 'mod_code': tested_mod_codes, }, True, None), - (blks2.qam_constellation, - {'constellation_points': (4, 16, 64), - 'mod_code': tested_mod_codes, }, - True, 'differential'), - (blks2.bpsk_constellation, {}, True, None), + (digital_swig.constellation_bpsk, {}, True, None), # No differential testing for qpsk because it is gray-coded. # This is because soft decision making is simpler if we can assume # gray coding. - (blks2.qpsk_constellation, {}, False, None), + (digital_swig.constellation_qpsk, {}, False, None), + (digital_swig.constellation_8psk, {}, False, None), (twod_constell, {}, True, None), (threed_constell, {}, True, None), ) @@ -182,7 +182,7 @@ class mod_demod(gr.hier_block2): # RX # Convert the constellation symbols back to binary values. - self.blocks.append(gr.constellation_decoder2_cb(self.constellation.base())) + self.blocks.append(digital_swig.constellation_decoder_cb(self.constellation.base())) # Differential decoding. if self.differential: self.blocks.append(gr.diff_decoder_bb(arity)) diff --git a/gr-digital/python/qa_constellation_receiver.py b/gr-digital/python/qa_constellation_receiver.py index ebdbf3bfb..70b62c7aa 100755 --- a/gr-digital/python/qa_constellation_receiver.py +++ b/gr-digital/python/qa_constellation_receiver.py @@ -25,9 +25,11 @@ import random from gnuradio import gr, blks2, packet_utils, gr_unittest from utils import mod_codes, alignment import digital_swig +from generic_mod_demod import generic_mod, generic_demod from qa_constellation import tested_constellations, twod_constell + # Set a seed so that if errors turn up they are reproducible. # 1234 fails random.seed(1239) @@ -68,6 +70,7 @@ class test_constellation_receiver (gr_unittest.TestCase): demodulation uses constellation_receiver which is what we're really trying to test. """ + # Assumes not more than 64 points in a constellation # Generates some random input data to use. self.src_data = tuple( @@ -76,7 +79,7 @@ class test_constellation_receiver (gr_unittest.TestCase): # output data (a full comparison is too slow in python). self.indices = alignment.random_sample( self.max_data_length, self.max_num_samples, self.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 @@ -119,13 +122,13 @@ class rec_test_tb (gr.top_block): self.src_data = src_data packer = gr.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) src = gr.vector_source_b(self.src_data) - mod = blks2.generic_mod(constellation, differential=differential) + mod = generic_mod(constellation, differential=differential) # Channel channel = gr.channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET) # Receiver Blocks - demod = blks2.generic_demod(constellation, differential=differential, - freq_alpha=FREQ_ALPHA, - phase_alpha=PHASE_ALPHA) + demod = generic_demod(constellation, differential=differential, + freq_alpha=FREQ_ALPHA, + phase_alpha=PHASE_ALPHA) self.dst = gr.vector_sink_b() self.connect(src, packer, mod, channel, demod, self.dst) diff --git a/gr-digital/python/qam.py b/gr-digital/python/qam.py index d22aac55e..5eb34e4b2 100644 --- a/gr-digital/python/qam.py +++ b/gr-digital/python/qam.py @@ -26,9 +26,13 @@ QAM modulation and demodulation. from math import pi, sqrt, log from gnuradio import gr, modulation_utils2 -from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod -from gnuradio.digital.utils.gray_code import gray_code -from gnuradio.digital.utils import mod_codes +#from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod +#from gnuradio.digital.utils.gray_code import gray_code +#from gnuradio.digital.utils import mod_codes + +from generic_mod_demod import generic_mod, generic_demod +from utils.gray_code import gray_code +from utils import mod_codes # Default number of points in constellation. _def_constellation_points = 16 diff --git a/gr-digital/swig/digital_constellation_receiver_cb.i b/gr-digital/swig/digital_constellation_receiver_cb.i index 6ced92551..ad17ef371 100644 --- a/gr-digital/swig/digital_constellation_receiver_cb.i +++ b/gr-digital/swig/digital_constellation_receiver_cb.i @@ -22,7 +22,7 @@ GR_SWIG_BLOCK_MAGIC(digital,constellation_receiver_cb); -%import "digital_constellation.i" +%include "digital_constellation.i" digital_constellation_receiver_cb_sptr digital_make_constellation_receiver_cb (digital_constellation_sptr constellation, |