Skip to content

Commit 6e2f88e

Browse files
committed
Fix syntax error spotted in veerest#65
1 parent 4fa952a commit 6e2f88e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

commpy/modulation.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,11 @@ def demodulate(self, input_symbols, demod_type, noise_var=0):
123123
for bit_index in arange(self.num_bits_symbol):
124124
llr_num = 0
125125
llr_den = 0
126-
for const_index in self.symbol_mapping:
127-
if (const_index >> bit_index) & 1:
128-
llr_num = llr_num + exp(
129-
(-abs(current_symbol - self._constellation[const_index]) ** 2) / noise_var)
126+
for bit_value, symbol in enumerate(self._constellation):
127+
if (bit_value >> bit_index) & 1:
128+
llr_num += exp((-abs(current_symbol - symbol) ** 2) / noise_var)
130129
else:
131-
llr_den = llr_den + exp(
132-
(-abs(current_symbol - self._constellation[const_index]) ** 2) / noise_var)
130+
llr_den += exp((-abs(current_symbol - symbol) ** 2) / noise_var)
133131
demod_bits[i * self.num_bits_symbol + self.num_bits_symbol - 1 - bit_index] = log(llr_num / llr_den)
134132
else:
135133
raise ValueError('demod_type must be "hard" or "soft"')

0 commit comments

Comments
 (0)