mmserv

Minimum Mean Square Error detection on RISC-V Vector Extention
git clone https://git.ea.contact/mmserv
Log | Files | Refs | README

viz_compare_x.py (1573B)


      1 #!/usr/bin/env python3
      2 
      3 from util import read_defines
      4 
      5 import numpy as np
      6 from matplotlib import pyplot as plt
      7 
      8 # read `out/x_mmse.bin` and plot the complex signal data samples
      9 
     10 NUM_RX_ANT, NUM_TX_ANT, NUM_SC = read_defines()
     11 x = np.fromfile("data/x_re.bin", dtype=np.float32) \
     12     + 1j * np.fromfile("data/x_im.bin", dtype=np.float32)
     13 x = x.reshape((NUM_TX_ANT, NUM_SC))
     14 x_mmse = np.fromfile("out/x_mmse_re.bin", dtype=np.float32) \
     15     + 1j * np.fromfile("out/x_mmse_im.bin", dtype=np.float32)
     16 x_mmse = x_mmse.reshape((NUM_TX_ANT, NUM_SC))
     17 x_mmse_python = np.fromfile("out/x_mmse_python_re.bin", dtype=np.float32) \
     18     + 1j * np.fromfile("out/x_mmse_python_im.bin", dtype=np.float32)
     19 x_mmse_python = x_mmse_python.reshape((NUM_TX_ANT, NUM_SC))
     20 
     21 for tx in range(NUM_TX_ANT):
     22     plt.scatter(x_mmse[tx].real,
     23                 x_mmse[tx].imag,
     24                 label=f"MMSE Tx {tx}",
     25                 marker="x",
     26                 color=plt.cm.hsv(tx / NUM_TX_ANT))
     27     plt.scatter(x[tx].real,
     28                 x[tx].imag,
     29                 label=f"Orig Tx {tx}",
     30                 marker="o",
     31                 color=plt.cm.hsv(tx / NUM_TX_ANT))
     32     plt.scatter(x_mmse_python[tx].real,
     33                 x_mmse_python[tx].imag,
     34                 label=f"MMSE Python Tx {tx}",
     35                 marker="^",
     36                 color=plt.cm.hsv(tx / NUM_TX_ANT))
     37 plt.axhline(0, color='black')
     38 plt.axvline(0, color='black')
     39 plt.xlim(-1.1, 1.1)
     40 plt.ylim(-1.1, 1.1)
     41 plt.title("Approximated MMSE Signal vs Original Signal Samples")
     42 plt.ylabel("Imaginary")
     43 plt.xlabel("Real")
     44 plt.legend()
     45 plt.show()