From 04ecb0c65ad1167e0b2ab5e23962f28166aabf53 Mon Sep 17 00:00:00 2001 From: markdisterhof <68807695+markdisterhof@users.noreply.github.com> Date: Thu, 13 May 2021 18:58:55 +0200 Subject: [PATCH] Update fundamental.py Previous code caused Error: ''' TypeError Traceback (most recent call last) in 1 a = [-1,1,1,-1] 2 ----> 3 (a < 0).astype(int) TypeError: '<' not supported between instances of 'list' and 'int' ''' Also comparator changed so that mapping is (-1 -> 0) and (1 -> 1) instead of (-1 -> 1) and (1 -> 0). --- pyphysim/modulators/fundamental.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyphysim/modulators/fundamental.py b/pyphysim/modulators/fundamental.py index 32162d0..32193fc 100644 --- a/pyphysim/modulators/fundamental.py +++ b/pyphysim/modulators/fundamental.py @@ -644,7 +644,7 @@ def demodulate(self, receivedData: np.ndarray) -> np.ndarray: The demodulated data. """ # noinspection PyUnresolvedReferences - return (receivedData < 0).astype(int) + return [int(i > 0) for i in receivedData] # xxxxx End of BPSK Class xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx