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", x_label="Subcarrier",
y_label="Phase", 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( "unwrapped_phase": figure_pb2.Figure(
uuid=str(uuid.uuid4()), uuid=str(uuid.uuid4()),
title="Unwrapped CSI Phase", title="Unwrapped CSI Phase",
@ -62,6 +68,12 @@ figures = {
x_label="Subcarrier", x_label="Subcarrier",
y_label="Phase", 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( "aoa_heatmap": figure_pb2.Figure(
uuid=str(uuid.uuid4()), uuid=str(uuid.uuid4()),
title="AoA Heatmap", title="AoA Heatmap",
@ -105,20 +117,21 @@ class FigureServer(figure_pb2_grpc.FigureServiceServicer):
def add_data(dtype: DataType, new_data: npt.NDArray[np.complex128]) -> None: def add_data(dtype: DataType, new_data: npt.NDArray[np.complex128]) -> None:
match dtype: match dtype:
case DataType.RAW_CSI | DataType.PROCESSED_CSI: case DataType.RAW_CSI | DataType.PROCESSED_CSI:
uuid = ( for component, func in [("phase", np.angle), ("magn", np.abs)]:
figures["raw_phase"].uuid uuid = (
if dtype == DataType.RAW_CSI figures[f"raw_{component}"].uuid
else figures["processed_phase"].uuid if dtype == DataType.RAW_CSI
) else figures[f"processed_{component}"].uuid
lines = [
line_pb2.LineChartData.Line(
y=np.angle(new_data)[:, i, 0], label=f"Antenna {i}"
) )
for i in range(new_data.shape[1]) lines = [
] line_pb2.LineChartData.Line(
linechart = line_pb2.LineChartData(lines=lines) y=func(new_data)[:, i, 0], label=f"Antenna {i}"
for q in clients.get(uuid, []): )
q.put(figure_pb2.FigureData(uuid=uuid, line=linechart)) for i in range(new_data.shape[1])
]
linechart = line_pb2.LineChartData(lines=lines)
for q in clients.get(uuid, []):
q.put(figure_pb2.FigureData(uuid=uuid, line=linechart))
case DataType.HEATMAP: case DataType.HEATMAP:
uuid = figures["aoa_heatmap"].uuid uuid = figures["aoa_heatmap"].uuid
heatmap = heatmap_pb2.HeatmapData( heatmap = heatmap_pb2.HeatmapData(