Add figure for magnitude

This commit is contained in:
Christos Falas 2025-03-04 14:07:21 +00:00
parent 6ef4fe3dc1
commit f6e10bedec
No known key found for this signature in database

View File

@ -43,6 +43,12 @@ figures = {
x_label="Subcarrier",
y_label="Phase",
),
"raw_magn": figure_pb2.Figure(
uuid=str(uuid.uuid4()),
title="Raw CSI Amplitude",
x_label="Subcarrier",
y_label="Amplitude",
),
"unwrapped_phase": figure_pb2.Figure(
uuid=str(uuid.uuid4()),
title="Unwrapped CSI Phase",
@ -62,6 +68,12 @@ figures = {
x_label="Subcarrier",
y_label="Phase",
),
"processed_magn": figure_pb2.Figure(
uuid=str(uuid.uuid4()),
title="Preprocessed CSI Amplitude",
x_label="Subcarrier",
y_label="Amplitude",
),
"aoa_heatmap": figure_pb2.Figure(
uuid=str(uuid.uuid4()),
title="AoA Heatmap",
@ -105,14 +117,15 @@ class FigureServer(figure_pb2_grpc.FigureServiceServicer):
def add_data(dtype: DataType, new_data: npt.NDArray[np.complex128]) -> None:
match dtype:
case DataType.RAW_CSI | DataType.PROCESSED_CSI:
for component, func in [("phase", np.angle), ("magn", np.abs)]:
uuid = (
figures["raw_phase"].uuid
figures[f"raw_{component}"].uuid
if dtype == DataType.RAW_CSI
else figures["processed_phase"].uuid
else figures[f"processed_{component}"].uuid
)
lines = [
line_pb2.LineChartData.Line(
y=np.angle(new_data)[:, i, 0], label=f"Antenna {i}"
y=func(new_data)[:, i, 0], label=f"Antenna {i}"
)
for i in range(new_data.shape[1])
]