fix preprocessing arguments

This commit is contained in:
Christos Falas 2024-12-29 12:30:56 +00:00
parent 671b3ae353
commit 691b5821cb
No known key found for this signature in database

View File

@ -1,5 +1,4 @@
import numpy as np import numpy as np
from .csi import CSI
import logging import logging
from queue import Queue from queue import Queue
from . import config from . import config
@ -30,15 +29,18 @@ class Preprocessor:
output="sos", output="sos",
) )
def preprocess(self, csi: CSI): def preprocess(self, h: npt.NDArray[np.complex128]) -> npt.NDArray[np.complex128]:
h = csi.matrix
# CSI data is not available for pilot subcarriers. # CSI data is not available for pilot subcarriers.
h_hat = np.where( h_hat = np.where(
np.expand_dims(h[:, 0, 0] == 0, axis=(1, 2)), np.expand_dims(h[:, 0, 0] == 0, axis=(1, 2)),
correlate(h, [[[1 / 2]], [[0]], [[1 / 2]]], mode="same"), correlate(h, [[[1 / 2]], [[0]], [[1 / 2]]], mode="same"),
h, h,
) )
# Skip every other subcarrier
# h_hat = h_hat[::2, :, :]
# logger.info(f"CSI shape: {h_hat.shape}")
h_hat = np.multiply(h_hat, h_hat.conj() / abs(h_hat.conj())) h_hat = np.multiply(h_hat, h_hat.conj() / abs(h_hat.conj()))
h_hat = np.nan_to_num(h_hat) h_hat = np.nan_to_num(h_hat)