diff options
author | Ben Reynwar <ben@reynwar.net> | 2013-03-06 13:42:31 -0700 |
---|---|---|
committer | Ben Reynwar <ben@reynwar.net> | 2013-03-06 13:42:31 -0700 |
commit | 9ff75b4133400de216afe236d4cdbb368ec8afd8 (patch) | |
tree | c2d06b69ebfca85bf8b05544273596be2b946474 | |
parent | bed49a09f0c395f29d0a367a4bafce12b9765fa9 (diff) |
digital: Adding a QAM-like constellation with 32 points.
-rw-r--r-- | gr-digital/python/CMakeLists.txt | 1 | ||||
-rwxr-xr-x | gr-digital/python/qa_constellation.py | 4 | ||||
-rw-r--r-- | gr-digital/python/qamlike.py | 75 |
3 files changed, 80 insertions, 0 deletions
diff --git a/gr-digital/python/CMakeLists.txt b/gr-digital/python/CMakeLists.txt index 8f2af0664d..9be5e1ae75 100644 --- a/gr-digital/python/CMakeLists.txt +++ b/gr-digital/python/CMakeLists.txt @@ -43,6 +43,7 @@ GR_PYTHON_INSTALL( pkt.py psk.py qam.py + qamlike.py qpsk.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/digital COMPONENT "digital_python" diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py index 0e3ab72ee4..ddd8c71e64 100755 --- a/gr-digital/python/qa_constellation.py +++ b/gr-digital/python/qa_constellation.py @@ -30,6 +30,7 @@ import digital_swig # import from local folder import psk import qam +import qamlike tested_mod_codes = (mod_codes.NO_CODE, mod_codes.GRAY_CODE) @@ -98,6 +99,9 @@ medium_constellation_info = ( 'mod_code': tested_mod_codes, 'large_ampls_to_corners': [False, True],}, True, None), + (qamlike.qam32_holeinside_constellation, + {'large_ampls_to_corners': [True]}, + True, None), ) # These constellation are basically broken in our test diff --git a/gr-digital/python/qamlike.py b/gr-digital/python/qamlike.py new file mode 100644 index 0000000000..2f8c855339 --- /dev/null +++ b/gr-digital/python/qamlike.py @@ -0,0 +1,75 @@ +# Copyright 2013 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. +# + +""" +This file contains constellations that are similar to QAM, but are not perfect squares. +""" + +import digital_swig +from qam import large_ampls_to_corners_mapping + +def qam32_holeinside_constellation(large_ampls_to_corners=False): + # First make constellation for one quadrant. + # 0 1 2 + # 2 - 010 111 110 + # 1 - 011 101 100 + # 0 - 000 001 + + # Have put hole in the side rather than corner. + # Corner point is helpful for frequency locking. + + # It has an attempt at some gray-coding, but not + # a very good one. + + # Indices are (horizontal, vertical). + indices_and_numbers = ( + ((0, 0), 0b000), + ((0, 1), 0b011), + ((0, 2), 0b010), + ((1, 0), 0b001), + ((1, 1), 0b101), + ((1, 2), 0b111), + ((2, 1), 0b100), + ((2, 2), 0b110), + ) + points = [None]*32 + for indices, number in indices_and_numbers: + p_in_quadrant = 0.5+indices[0] + 1j*(0.5+indices[1]) + for quadrant in range(4): + index = number + 8 * quadrant + rotation = pow(1j, quadrant) + p = p_in_quadrant * rotation + points[index] = p + side = 6 + width = 1 + # Double number of boxes on side + # This is so that points in the 'hole' get assigned correctly. + side = 12 + width = 0.5 + pre_diff_code = [] + if not large_ampls_to_corners: + constellation = digital_swig.constellation_rect(points, pre_diff_code, 4, + side, side, width, width) + else: + sector_values = large_ampls_to_corners_mapping(side, points, width) + constellation = digital_swig.constellation_expl_rect( + points, pre_diff_code, 4, side, side, width, width, sector_values) + return constellation + |