Skip to content

Commit 140df4e

Browse files
authored
Merge pull request #20 from datlife/master
Fix type checking for `Complex` ndarray
2 parents dc25537 + d33dae5 commit 140df4e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

commpy/channels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def awgn(input_signal, snr_dB, rate=1.0):
9494
snr_linear = 10**(snr_dB/10.0)
9595
noise_variance = avg_energy/(2*rate*snr_linear)
9696

97-
if type(input_signal[0]) == complex:
97+
if isinstance(input_signal[0], complex):
9898
noise = (sqrt(noise_variance) * randn(len(input_signal))) + (sqrt(noise_variance) * randn(len(input_signal))*1j)
9999
else:
100100
noise = sqrt(2*noise_variance) * randn(len(input_signal))

0 commit comments

Comments
 (0)