Skip to content

Commit 8b5adc0

Browse files
committed
Update forgotten typos.
1 parent ca8d807 commit 8b5adc0

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

commpy/examples/plotConsModem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
# Constellation corresponding to PSKModem for 4 bits per symbols
1111
psk = PSKModem(16)
12-
psk.plotCons()
12+
psk.plot_constellation()
1313

1414
# Constellation corresponding to QAMModem for 2 bits per symbols
1515
qam = QAMModem(4)
16-
qam.plotCons()
16+
qam.plot_constellation()

commpy/modulation.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
166167
class 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.')

commpy/tests/test_modulation.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_bit_lvl_repr():
2121

2222
SNR = arange(10, 16, 5)
2323

24-
def receiverWithBLR(y, H, cons):
24+
def receiver_with_blr(y, H, cons):
2525
beta = int(log2(len(cons)))
2626
# creation de w
2727
reel = [pow(2, i) for i in range(beta // 2 - 1, -1, -1)]
@@ -32,17 +32,17 @@ def receiverWithBLR(y, H, cons):
3232
mes[mes == -1] = 0
3333
return mes
3434

35-
def receiverWithoutBLR(y, H, cons):
35+
def receiver_without_blr(y, H, cons):
3636
return qam.demodulate(mimo_ml(y, H, cons), 'hard')
3737

38-
MymodelWithoutBLR = \
39-
LinkModel(qam.modulate, RayleighChannel, receiverWithoutBLR, qam.num_bits_symbol, qam.constellation, qam.Es)
40-
MymodelWithBLR = \
41-
LinkModel(qam.modulate, RayleighChannel, receiverWithBLR, qam.num_bits_symbol, qam.constellation, qam.Es)
38+
my_model_without_blr = \
39+
LinkModel(qam.modulate, RayleighChannel, receiver_without_blr, qam.num_bits_symbol, qam.constellation, qam.Es)
40+
my_model_with_blr = \
41+
LinkModel(qam.modulate, RayleighChannel, receiver_with_blr, qam.num_bits_symbol, qam.constellation, qam.Es)
4242

43-
BERWithoutBLR = link_performance(MymodelWithoutBLR, SNR, 300e4, 300)
44-
BERWithBLR = link_performance(MymodelWithBLR, SNR, 300e4, 300)
45-
assert_allclose(BERWithoutBLR, BERWithBLR, rtol=0.5,
43+
ber_without_blr = link_performance(my_model_without_blr, SNR, 300e4, 300)
44+
ber_with_blr = link_performance(my_model_with_blr, SNR, 300e4, 300)
45+
assert_allclose(ber_without_blr, ber_with_blr, rtol=0.5,
4646
err_msg='bit_lvl_repr changes the performance')
4747

4848

0 commit comments

Comments
 (0)