Improve heatmap visualisation
- Correct axis titles - Add axis ticks to indicate angle of arrival/time of flight instead of arbitrary numbering
This commit is contained in:
parent
e3d0544b66
commit
6ef4fe3dc1
@ -36,10 +36,24 @@ const plotData = computed(() => {
|
|||||||
color: line.color ? line.color : undefined,
|
color: line.color ? line.color : undefined,
|
||||||
}))
|
}))
|
||||||
case 'heatmap':
|
case 'heatmap':
|
||||||
|
const xmin = data.value.figure.heatmap.xMin ?? 0
|
||||||
|
const xmax = data.value.figure.heatmap.xMax ?? data.value.figure.heatmap.width
|
||||||
|
const ymin = data.value.figure.heatmap.yMin ?? 0
|
||||||
|
const ymax = data.value.figure.heatmap.yMax ?? data.value.figure.heatmap.height
|
||||||
|
const x = Array(data.value.figure.heatmap.width)
|
||||||
|
.fill(0)
|
||||||
|
.map((_, i) => xmin + ((xmax - xmin) * i) / data.value.figure.heatmap.width)
|
||||||
|
const y = Array(data.value.figure.heatmap.height)
|
||||||
|
.fill(0)
|
||||||
|
.map((_, i) => ymin + ((ymax - ymin) * i) / data.value.figure.heatmap.height)
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
z: reshape(data.value.figure.heatmap.data, data.value.figure.heatmap.width),
|
z: reshape(data.value.figure.heatmap.data, data.value.figure.heatmap.width),
|
||||||
|
x: x,
|
||||||
|
y: y,
|
||||||
type: 'heatmap' as const,
|
type: 'heatmap' as const,
|
||||||
|
colorscale: 'Blues',
|
||||||
|
reversescale: true,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
case 'histogram':
|
case 'histogram':
|
||||||
|
|||||||
@ -6,4 +6,8 @@ message HeatmapData {
|
|||||||
uint32 width = 3;
|
uint32 width = 3;
|
||||||
uint32 height = 4;
|
uint32 height = 4;
|
||||||
string cmap = 5;
|
string cmap = 5;
|
||||||
|
float x_min = 6;
|
||||||
|
float x_max = 7;
|
||||||
|
float y_min = 8;
|
||||||
|
float y_max = 9;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import grpc
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import numpy.typing as npt
|
import numpy.typing as npt
|
||||||
|
|
||||||
|
from ...config import config
|
||||||
from .generated import figure_pb2, figure_pb2_grpc
|
from .generated import figure_pb2, figure_pb2_grpc
|
||||||
from .generated.figure_type import heatmap_pb2, histogram_pb2, line_pb2
|
from .generated.figure_type import heatmap_pb2, histogram_pb2, line_pb2
|
||||||
|
|
||||||
@ -64,8 +65,8 @@ figures = {
|
|||||||
"aoa_heatmap": figure_pb2.Figure(
|
"aoa_heatmap": figure_pb2.Figure(
|
||||||
uuid=str(uuid.uuid4()),
|
uuid=str(uuid.uuid4()),
|
||||||
title="AoA Heatmap",
|
title="AoA Heatmap",
|
||||||
x_label="ToF",
|
x_label="AoA",
|
||||||
y_label="AoA",
|
y_label="ToF",
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,6 +126,10 @@ def add_data(dtype: DataType, new_data: npt.NDArray[np.complex128]) -> None:
|
|||||||
data=new_data.flatten(),
|
data=new_data.flatten(),
|
||||||
width=new_data.shape[1],
|
width=new_data.shape[1],
|
||||||
height=new_data.shape[0],
|
height=new_data.shape[0],
|
||||||
|
x_min=0,
|
||||||
|
x_max=np.pi,
|
||||||
|
y_min=0,
|
||||||
|
y_max=config.music.heatmap.tof_max,
|
||||||
)
|
)
|
||||||
for q in clients.get(uuid, []):
|
for q in clients.get(uuid, []):
|
||||||
q.put(figure_pb2.FigureData(uuid=uuid, heatmap=heatmap))
|
q.put(figure_pb2.FigureData(uuid=uuid, heatmap=heatmap))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user