I would like to benchmark interactive topoplot. More specifically, measure the time between drawing topoplot with one time point on the slider and another.
I tried several times, but failed. For now, I want it to at least move the slider from one point to another. Do you have any ideas?
function interactive_topo_function()
data, pos = TopoPlots.example_data()
N = 1:length(pos)
f = Figure()
xs = range(0, length=size(data, 2), step=1 ./ 100)
sg = SliderGrid(f[2, 1],
(label = "time", range = xs, format = "{:.3f} ms", startvalue = 0.02),
)
time = sg.sliders[1].value
topo_slice = lift((t, data) -> mean(data[:, indexin(t, xs), :], dims=2)[:,1], time, data)
topo_axis = Axis(f[1, 1], aspect = DataAspect(), title = "Interactive topoplot")
topo = eeg_topoplot!(topo_axis, topo_slice,
N,
positions=pos,
enlarge=1.2,
markersize = 10,
lablesize = 10)
str = lift(t -> "[$(round(t, digits = 3)) ms]", time)
text!(topo_axis, 1, 1, text = str, align = (:center, :center))
hidedecorations!(topo_axis)
hidespines!(topo_axis)
sg.sliders[1].value.val = 3.96
notify(sg.sliders[1].value)
f
end
#@benchmark
#@time
interactive_topo_function()