diff options
-rw-r--r-- | gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am | 2 | ||||
-rw-r--r-- | gnuradio-core/src/python/gnuradio/blks2impl/psk.py | 94 | ||||
-rw-r--r-- | gnuradio-core/src/python/gnuradio/blks2impl/qam.py | 113 |
3 files changed, 0 insertions, 209 deletions
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am b/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am index 3ddf99b5d..5c627b873 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am @@ -41,8 +41,6 @@ grblkspython_PYTHON = \ pfb_channelizer.py \ pfb_decimator.py \ pfb_interpolator.py \ - psk.py \ - qam.py \ rational_resampler.py \ standard_squelch.py \ stream_to_vector_decimator.py \ diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/psk.py b/gnuradio-core/src/python/gnuradio/blks2impl/psk.py deleted file mode 100644 index acedf3b69..000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/psk.py +++ /dev/null @@ -1,94 +0,0 @@ -# -# Copyright 2005,2006 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 math import pi, sqrt, log10 -import math, cmath - -# The following algorithm generates Gray coded constellations for M-PSK for M=[2,4,8] -def make_gray_constellation(m): - # number of bits/symbol (log2(M)) - k = int(log10(m) / log10(2.0)) - - coeff = 1 - const_map = [] - bits = [0]*3 - for i in range(m): - # get a vector of the k bits to use in this mapping - bits[3-k:3] = [((i&(0x01 << k-j-1)) >> k-j-1) for j in range(k)] - - theta = -(2*bits[0]-1)*(2*pi/m)*(bits[0]+abs(bits[1]-bits[2])+2*bits[1]) - re = math.cos(theta) - im = math.sin(theta) - const_map.append(complex(re, im)) # plug it into the constellation - - # return the constellation; by default, it is normalized - return const_map - -# This makes a constellation that increments around the unit circle -def make_constellation(m): - return [cmath.exp(i * 2 * pi / m * 1j) for i in range(m)] - -# Common definition of constellations for Tx and Rx -constellation = { - 2 : make_constellation(2), # BPSK - 4 : make_constellation(4), # QPSK - 8 : make_constellation(8) # 8PSK - } - -gray_constellation = { - 2 : make_gray_constellation(2), # BPSK - 4 : make_gray_constellation(4), # QPSK - 8 : make_gray_constellation(8) # 8PSK - } - -# ----------------------- -# Do Gray code -# ----------------------- -# binary to gray coding -- constellation does Gray coding -binary_to_gray = { - 2 : range(2), - 4 : [0,1,3,2], - 8 : [0, 1, 3, 2, 7, 6, 4, 5] - } - -# gray to binary -gray_to_binary = { - 2 : range(2), - 4 : [0,1,3,2], - 8 : [0, 1, 3, 2, 6, 7, 5, 4] - } - -# ----------------------- -# Don't Gray code -# ----------------------- -# identity mapping -binary_to_ungray = { - 2 : range(2), - 4 : range(4), - 8 : range(8) - } - -# identity mapping -ungray_to_binary = { - 2 : range(2), - 4 : range(4), - 8 : range(8) - } diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/qam.py b/gnuradio-core/src/python/gnuradio/blks2impl/qam.py deleted file mode 100644 index 22b1e1dab..000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/qam.py +++ /dev/null @@ -1,113 +0,0 @@ -# -# Copyright 2005,2006 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 math import pi, sqrt -import math - -# These constellations are generated for Gray coding when symbos [1, ..., m] are used -# Mapping to Gray coding is therefore unnecessary - -def make_constellation(m): - # number of bits/symbol (log2(M)) - k = int(math.log10(m) / math.log10(2.0)) - - coeff = 1 - const_map = [] - for i in range(m): - a = (i&(0x01 << k-1)) >> k-1 - b = (i&(0x01 << k-2)) >> k-2 - bits_i = [((i&(0x01 << k-j-1)) >> k-j-1) for j in range(2, k, 2)] - bits_q = [((i&(0x01 << k-j-1)) >> k-j-1) for j in range(3, k, 2)] - - ss = 0 - ll = len(bits_i) - for ii in range(ll): - rr = 0 - for jj in range(ll-ii): - rr = abs(bits_i[jj] - rr) - ss += rr*pow(2.0, ii+1) - re = (2*a-1)*(ss+1) - - ss = 0 - ll = len(bits_q) - for ii in range(ll): - rr = 0 - for jj in range(ll-ii): - rr = abs(bits_q[jj] - rr) - ss += rr*pow(2.0, ii+1) - im = (2*b-1)*(ss+1) - - a = max(re, im) - if a > coeff: - coeff = a - const_map.append(complex(re, im)) - - norm_map = [complex(i.real/coeff, i.imag/coeff) for i in const_map] - return norm_map - -# Common definition of constellations for Tx and Rx -constellation = { - 4 : make_constellation(4), # QAM4 (QPSK) - 8 : make_constellation(8), # QAM8 - 16: make_constellation(16), # QAM16 - 64: make_constellation(64), # QAM64 - 256: make_constellation(256) # QAM256 - } - -# ----------------------- -# Do Gray code -# ----------------------- -# binary to gray coding -binary_to_gray = { - 4 : range(4), - 8 : range(8), - 16: range(16), - 64: range(64), - 256: range(256) - } - -# gray to binary -gray_to_binary = { - 4 : range(4), - 8 : range(8), - 16: range(16), - 64: range(64), - 256: range(256) - } - -# ----------------------- -# Don't Gray code -# ----------------------- -# identity mapping -binary_to_ungray = { - 4 : range(4), - 8 : range(8), - 16: range(16), - 64: range(64) - } - -# identity mapping -ungray_to_binary = { - 4 : range(4), - 8 : range(8), - 16: range(16), - 64: range(64) - } |