JuliaGizmos / Interact.jl

Interactive widgets to play with your Julia code
Other
520 stars 75 forks source link

freeze if too much slider use #330

Open briochemc opened 5 years ago

briochemc commented 5 years ago

I'm not sure this is due to Interact.jl but I have had 3 occurrences where a notebook hanged ("froze") when I moved the slider a few (too many?) times. I was able to reproduce with this tiny notebook which just contains

using Interact, GR
xs, ys, zs = 0:0.1:10, 0:0.1:10, 0:0.1:3
x3D = [cos(x / (z + 0.1)) + log((z * x * y)^2+1) for x in xs, y in ys, z in zs]
x3D[10:20,10:20,:] .= NaN
f1 = figure(figsize=(6,3))
@manipulate for j in 1:length(zs)
    contourf(xs, ys, x3D[:,:,j])
    title("j = $j")
end

Once it hangs, there is not much I can do except restart the notebook/kernel, which is a bit of a pain. Am I the only one to get this behavior? Or is this commonly expected? Maybe there is a way to prevent it from happening?

langesimmons commented 5 years ago

Found this as well with test example of

using Interact, Plots
plotly()
t = 0:0.01:10
@manipulate for a in slider(0:0.1:10, value = 2)

   plot(t, sin.(t.*a))
end

After moving the slider to much, the kernel stays busy and must be restarted. This is on WSL's Ubuntu distro.

asinghvi17 commented 5 years ago

Is this reproducible when using Blink, as opposed to inline jupyter?

piever commented 5 years ago

There are probably limits to data transfer in the jupyter notebook. As the plot is redrawn for every value the slider passes through, this may be reached easily. You can probably add a throttle option to avoid this. See also onchange to get sliders that only trigger the update when released.