mmserv

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

util.py (1050B)


      1 from os import path
      2 import numpy as np
      3 
      4 
      5 def load_xHRy(NUM_RX, NUM_TX, NUM_SC) -> tuple:
      6     """Load x, H, R and y from the data files.
      7     Assumes that the following files are present in the data directory:
      8     x_re.bin, x_im.bin, H_re.bin, H_im.bin, R_re.bin, R_im.bin, y_re.bin, y_im.bin
      9     and they contain float32 data of the appropriate sizes.
     10 
     11     Returns:
     12         tuple: x, H, R, y
     13     """
     14     x = np.fromfile("data/x_re.bin", dtype=np.float32)
     15     x = x + 1j*np.fromfile("data/x_im.bin", dtype=np.float32)
     16     x = x.reshape((NUM_TX, NUM_SC))
     17     H = np.fromfile("data/H_re.bin", dtype=np.float32)
     18     H = H + 1j*np.fromfile("data/H_im.bin", dtype=np.float32)
     19     H = H.reshape((NUM_RX, NUM_TX, NUM_SC))
     20     R = np.fromfile("data/R_re.bin", dtype=np.float32)
     21     R = R + 1j*np.fromfile("data/R_im.bin", dtype=np.float32)
     22     R = R.reshape((NUM_TX, NUM_TX, NUM_SC))
     23     y = np.fromfile("data/y_re.bin", dtype=np.float32)
     24     y = y + 1j*np.fromfile("data/y_im.bin", dtype=np.float32)
     25     y = y.reshape((NUM_RX, NUM_SC))
     26 
     27     return x, H, R, y