mirror of
https://github.com/romanz/amodem.git
synced 2026-02-07 09:28:02 +08:00
Fix constellation symbols' plot
This commit is contained in:
6
recv.py
6
recv.py
@@ -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,
|
||||
|
||||
6
show.py
6
show.py
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user