Hello, I have taken a relatively large amount of readings over time and would now like to look at them in detail. For this purpose I use an interval slider in Makie with which I can zoom into my data. This works already very well.
In the next step I want to run a fast fourier transformation dynamically over the selected area. This should be adjusted with the slider position. I’ve played around a bit, but haven’t made it to work yet. Maybe someone of you has an idea.
intSh1 = IntervalSlider(fig[2, 1], range = collect(1:1:length(test_time)), startvalues = (1, length(test_time)), linewidth = 20)
Label(fig[2, 1], @lift(string(test_time[$(intSh1.interval)[1]]) * " sec bis " * string(test_time[$(intSh1.interval)[2]]) * " sec"), tellwidth = false)
vlines!(ax0, @lift(test_time[$(intSh1.interval)[1]]), ymin = -2.0, ymax = 2.0, color = :red, linewidth = 2)
vlines!(ax0, @lift(test_time[$(intSh1.interval)[2]]), ymin = -2.0, ymax = 2.0, color = :red, linewidth = 2)
F = rfft(volt) |> fftshift
freqs = rfftfreq(length(test_time), 1/(steptime*1e-3)) |> fftshift
new_fft = lift(intSh1.interval) do val
F = rfft(volt[val[1]:val[2]]) |> fftshift
freqs = rfftfreq(length(test_time[val[1]:val[2]]), 1/(steptime*1e-3)) |> fftshift
end
new_lims = lift(intSh1.interval) do val
limits!(ax1, FRect(test_time[val[1]], -0.75, test_time[val[2]] - test_time[val[1]], 1.5))
end
lines!(ax0, test_time, volt, linewidth = 0.5, color = :blue)
lines!(ax1, test_time, volt, linewidth = 1, color = :blue)
lines!(ax2, freqs, abs.(F), linewidth = 1, color = :blue)
display(fig)