summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Reynwar2011-02-13 19:43:19 -0700
committerBen Reynwar2011-02-13 19:43:19 -0700
commit7fea5a1532e2c9d65406745fa7a18cf5ea3395ad (patch)
tree96dca21c86a0d2a4473b64e1b7f5b7e08acabcd0
parent6e09949418f7c7c0fe21b4bd69d2f4ff079ce941 (diff)
downloadgnuradio-7fea5a1532e2c9d65406745fa7a18cf5ea3395ad.tar.gz
gnuradio-7fea5a1532e2c9d65406745fa7a18cf5ea3395ad.tar.bz2
gnuradio-7fea5a1532e2c9d65406745fa7a18cf5ea3395ad.zip
Fixing bugs in qam.py.
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/qam.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/qam.py b/gnuradio-core/src/python/gnuradio/blks2impl/qam.py
index 143f6e108..bdd27e9bb 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/qam.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/qam.py
@@ -113,7 +113,7 @@ def make_differential_constellation(m, gray_coded):
return const_map
def make_not_differential_constellation(m, gray_coded):
- side = pow(m, 0.5)
+ side = int(pow(m, 0.5))
if (not isinstance(m, int) or m < 4 or not is_power_of_four(m)):
raise ValueError("m must be a power of 4 integer.")
# Each symbol holds k bits.
@@ -122,22 +122,20 @@ def make_not_differential_constellation(m, gray_coded):
# Number rows and columns using gray codes.
gcs = gray_code(side)
# Get inverse gray codes.
- i_gcs = dict([(v, key) for key, v in enumerate(gcs)])
+ i_gcs = mod_codes.invert_code(gcs)
else:
- i_gcs = dict([(i, i) for i in range(0, m)])
+ i_gcs = range(0, side)
# The distance between points is found.
- step = 2/(side-1)
+ step = 2.0/(side-1)
gc_to_x = [-1 + i_gcs[gc]*step for gc in range(0, side)]
-
# First k/2 bits determine x position.
# Following k/2 bits determine y position.
const_map = []
for i in range(m):
- y = gc_to_x(get_bits(i, 0, k/2))
- x = gc_to_x(get_bits(i, k/2, k/2))
+ y = gc_to_x[get_bits(i, 0, k/2)]
+ x = gc_to_x[get_bits(i, k/2, k/2)]
const_map.append(complex(x,y))
-
return const_map
# /////////////////////////////////////////////////////////////////////////////
@@ -165,7 +163,7 @@ def qam_constellation(constellation_points=_def_constellation_points,
# No pre-diff code
# Should add one so that we can gray-code the quadrant bits too.
pre_diff_code = []
- constellation = gr.constellation_rect(points, pre_diff_code, side, side, width, width)
+ constellation = gr.constellation_rect(points, pre_diff_code, 4, side, side, width, width)
return constellation
# /////////////////////////////////////////////////////////////////////////////