@@ -131,9 +131,9 @@ def plot_constellation(self):
131131 x = symb .real
132132 y = symb .imag
133133
134- plt .plot (x , y , '+' ,linewidth = 4 )
134+ plt .plot (x , y , '+' , linewidth = 4 )
135135 for i in range (len (x )):
136- plt .text (x [i ], y [i ] , listBin [i ])
136+ plt .text (x [i ], y [i ], listBin [i ])
137137
138138 plt .title ('Constellation' )
139139 plt .grid ()
@@ -163,6 +163,7 @@ def __init__(self, m):
163163 self .constellation = list (map (self ._constellation_symbol ,
164164 self .symbol_mapping ))
165165
166+
166167class QAMModem (Modem ):
167168 """ Creates a Quadrature Amplitude Modulation (QAM) Modem object."""
168169
@@ -295,12 +296,12 @@ def kbest(y, h, constellation, K):
295296 else :
296297 const_type = float
297298 X = empty ((nb_rx , K * m ), dtype = const_type ) # Set of current candidates
298- d = tile (yt [:, None ], (1 , K * m )) # Corresponding distance vector
299- d_tot = zeros (K * m , dtype = float ) # Corresponding total distance
300- hyp = empty (K * m , dtype = const_type ) # Hypothesis vector
299+ d = tile (yt [:, None ], (1 , K * m )) # Corresponding distance vector
300+ d_tot = zeros (K * m , dtype = float ) # Corresponding total distance
301+ hyp = empty (K * m , dtype = const_type ) # Hypothesis vector
301302
302303 # Processing
303- for coor in range (nb_rx - 1 , - 1 , - 1 ):
304+ for coor in range (nb_rx - 1 , - 1 , - 1 ):
304305 nb_hyp = nb_can * m
305306
306307 # Copy best candidates m times
@@ -312,7 +313,7 @@ def kbest(y, h, constellation, K):
312313 hyp [:nb_hyp ] = repeat (constellation , nb_can )
313314 X [coor , :nb_hyp ] = hyp [:nb_hyp ]
314315 d [coor , :nb_hyp ] -= r [coor , coor ] * hyp [:nb_hyp ]
315- d_tot [:nb_hyp ] += abs (d [coor , :nb_hyp ])** 2
316+ d_tot [:nb_hyp ] += abs (d [coor , :nb_hyp ]) ** 2
316317
317318 # Select best candidates
318319 argsort = d_tot [:nb_hyp ].argsort ()
@@ -345,8 +346,8 @@ def bit_lvl_repr(H, w):
345346 beta = len (w )
346347 if beta % 2 == 0 :
347348 m , n = H .shape
348- In = eye (n , n )
349- kr = kron (In , w )
350- return dot (H , kr )
349+ In = eye (n , n )
350+ kr = kron (In , w )
351+ return dot (H , kr )
351352 else :
352- raise ValueError ('Beta must be even.' )
353+ raise ValueError ('Beta must be even.' )
0 commit comments