From a49e839dc19a579b15f2c0d3349469f55bb369fd Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sat, 12 Jul 2014 08:26:57 +0300 Subject: [PATCH] move constellation symbols definition to common.py --- common.py | 4 ++++ sigproc.py | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common.py b/common.py index e797b67..c418e96 100644 --- a/common.py +++ b/common.py @@ -12,6 +12,10 @@ carrier_index = 0 Fc = frequencies[carrier_index] Tc = 1.0 / Fc +symbols = np.array([complex(x, y) + for x in np.linspace(-1, 1, 4) + for y in np.linspace(-1, 1, 4)]) / np.sqrt(2) + Tsym = 1e-3 Nsym = int(Tsym / Ts) baud = int(1/Tsym) diff --git a/sigproc.py b/sigproc.py index a3efd1e..73c5192 100644 --- a/sigproc.py +++ b/sigproc.py @@ -56,9 +56,7 @@ class QAM(object): S = self.symbols[index] yield self._dec[S] -_xs, _ys = np.linspace(-1, 1, 4), np.linspace(-1, 1, 4) # QAM-16 -_symbols = np.array([complex(x, y) for x in _xs for y in _ys]) * np.sqrt(0.5) -modulator = QAM(_symbols) +modulator = QAM(common.symbols) modem_bps = common.baud * modulator.bits_per_symbol * len(common.frequencies)