Skip to content
This repository was archived by the owner on Mar 25, 2024. It is now read-only.

Commit a8e4bf4

Browse files
committed
Additional check is added
1 parent e38aac1 commit a8e4bf4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ModulationPy/ModulationPy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,10 @@ def modulate(self, x):
255255
modulated : 1-D array of complex values
256256
Modulated symbols (signal envelope).
257257
'''
258-
258+
259+
if (self.bin_input == True) and ((len(x) % int(np.log2(self.M))) != 0):
260+
raise ValueError("The length of the binary input should be a multiple of log2(M)")
261+
259262
if self.bin_input == True:
260263
modulated = self.__bin_modulate(x)
261264
else:
@@ -268,7 +271,7 @@ def demodulate(self, x, noise_var=1.):
268271
Parameters
269272
----------
270273
x : 1-D ndarray of complex symbols
271-
Decimal or binary stream to be modulated.
274+
Decimal or binary stream to be demodulated.
272275
noise_var: float
273276
Additive noise variance.
274277
Returns

0 commit comments

Comments
 (0)