Statistics
| Branch: | Tag: | Revision:

root / gr-digital / python / qa_lms_equalizer.py @ 6b774f7f

History | View | Annotate | Download (1.7 kB)

1
#!/usr/bin/env python
2
#
3
# Copyright 2006,2007,2010,2011 Free Software Foundation, Inc.
4
# 
5
# This file is part of GNU Radio
6
# 
7
# GNU Radio is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3, or (at your option)
10
# any later version.
11
# 
12
# GNU Radio is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
# 
17
# You should have received a copy of the GNU General Public License
18
# along with GNU Radio; see the file COPYING.  If not, write to
19
# the Free Software Foundation, Inc., 51 Franklin Street,
20
# Boston, MA 02110-1301, USA.
21
# 
22
23
from gnuradio import gr, gr_unittest
24
import digital_swig
25
26
class test_lms_dd_equalizer(gr_unittest.TestCase):
27
28
    def setUp(self):
29
            self.tb = gr.top_block()
30
31
    def tearDown(self):
32
            self.tb = None
33
            
34
    def transform(self, src_data, gain, const):
35
        SRC = gr.vector_source_c(src_data, False)
36
        EQU = digital_swig.lms_dd_equalizer_cc(4, gain, 1, const.base())
37
        DST = gr.vector_sink_c()
38
        self.tb.connect(SRC, EQU, DST)
39
        self.tb.run()
40
        return DST.data()
41
42
    def test_001_identity(self):
43
            # Constant modulus signal so no adjustments
44
        const = digital_swig.constellation_qpsk()
45
        src_data = const.points()*1000
46
47
        N = 100 # settling time
48
        expected_data = src_data[N:]
49
        result = self.transform(src_data, 0.1, const)[N:]
50
        self.assertComplexTuplesAlmostEqual(expected_data, result, 5)
51
52
if __name__ == "__main__":
53
    gr_unittest.run(test_lms_dd_equalizer, "test_lms_dd_equalizer.xml")