Revision 7fea5a15 gnuradio-core/src/python/gnuradio/blks2impl/qam.py

b/gnuradio-core/src/python/gnuradio/blks2impl/qam.py
113 113
    return const_map
114 114

115 115
def make_not_differential_constellation(m, gray_coded):
116
    side = pow(m, 0.5)
116
    side = int(pow(m, 0.5))
117 117
    if (not isinstance(m, int) or m < 4 or not is_power_of_four(m)):
118 118
        raise ValueError("m must be a power of 4 integer.")
119 119
    # Each symbol holds k bits.
......
122 122
        # Number rows and columns using gray codes.
123 123
        gcs = gray_code(side)
124 124
        # Get inverse gray codes.
125
        i_gcs = dict([(v, key) for key, v in enumerate(gcs)])
125
        i_gcs = mod_codes.invert_code(gcs)
126 126
    else:
127
        i_gcs = dict([(i, i) for i in range(0, m)])
127
        i_gcs = range(0, side)
128 128
    # The distance between points is found.
129
    step = 2/(side-1)
129
    step = 2.0/(side-1)
130 130

131 131
    gc_to_x = [-1 + i_gcs[gc]*step for gc in range(0, side)]
132

133 132
    # First k/2 bits determine x position.
134 133
    # Following k/2 bits determine y position.
135 134
    const_map = []
136 135
    for i in range(m):
137
        y = gc_to_x(get_bits(i, 0, k/2))
138
        x = gc_to_x(get_bits(i, k/2, k/2))
136
        y = gc_to_x[get_bits(i, 0, k/2)]
137
        x = gc_to_x[get_bits(i, k/2, k/2)]
139 138
        const_map.append(complex(x,y))
140
    
141 139
    return const_map
142 140

143 141
# /////////////////////////////////////////////////////////////////////////////
......
165 163
    # No pre-diff code
166 164
    # Should add one so that we can gray-code the quadrant bits too.
167 165
    pre_diff_code = []
168
    constellation = gr.constellation_rect(points, pre_diff_code, side, side, width, width)
166
    constellation = gr.constellation_rect(points, pre_diff_code, 4, side, side, width, width)
169 167
    return constellation
170 168

171 169
# /////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff