Fix constellation symbols' plot

This commit is contained in:
Roman Zeyde
2014-08-01 10:05:39 +03:00
parent 8a669feb91
commit f3b023d2ef
2 changed files with 6 additions and 6 deletions

View File

@@ -135,7 +135,8 @@ def train_receiver(symbols, freqs):
y = np.array(Y) / scaling_factor
if pylab:
pylab.subplot(HEIGHT, WIDTH, i+1)
show.constellation(y, 'Train: $F_c = {}Hz$'.format(freq))
show.constellation(y, modem.qam.symbols,
'Train: $F_c = {}Hz$'.format(freq))
pylab.plot(S.real, S.imag, '.-')
train_result = np.round(y)
@@ -262,7 +263,8 @@ def main(args):
symbol_list = np.array(stats['symbol_list'])
for i, freq in enumerate(modem.freqs):
pylab.subplot(HEIGHT, WIDTH, i+1)
show.constellation(symbol_list[i], '$F_c = {} Hz$'.format(freq))
show.constellation(symbol_list[i], modem.qam.symbols,
'$F_c = {} Hz$'.format(freq))
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG,

View File

@@ -2,14 +2,12 @@
import pylab
import numpy as np
import sigproc
def constellation(y, title):
def constellation(y, symbols, title):
theta = np.linspace(0, 2*np.pi, 1000)
pylab.plot(y.real, y.imag, '.')
pylab.plot(np.cos(theta), np.sin(theta), ':')
points = np.array(sigproc.modulator.symbols)
points = np.array(symbols)
pylab.plot(points.real, points.imag, '+')
pylab.grid('on')
pylab.axis('equal')