John's suggestion is also a good way to do this. You can sample the signals
at a specific interval instead of on button clicks:

# At 2 fps, with repeats dropped.
sampled_coeffs = droprepeats(sampleon(fps(2), lift(tuple, α, β, γ)))

On Mon, Sep 8, 2014 at 9:36 PM, Shashi Gowda <[email protected]>
wrote:

> Unfortunately, the @manipulate macro can only rerun the expression at
> every update of any of its input.
>
> What you need here is Reactive
> <http://julialang.org/Reactive.jl/api.html#sample-and-merge>'s `sampleon`
> function:
>
> using Reactive, Interact
> f = figure();
>
> α=slider(1:0.1:3)
> β=slider(1:0.1:3)
> γ=slider(1:0.1:3)
> replot = button("Replot") # Commit your changes
> map(display, α, β, γ, replot) # optional
>
> sampled_coeffs = sampleon(redo, lift(tuple, α, β, γ))
>
> withfig(f)
>
> @lift plot(apply(fun, sampled_coeffs))
>
> IPython doesn't do update on release, Interact, in fact, uses the same
> widgets. What it does do is have at most 4 updates at any given time in the
> processing pipeline (any more updates replace the last update in the queue).
>
> On Mon, Sep 8, 2014 at 8:45 PM, Andrei Berceanu <[email protected]>
> wrote:
>
>> Another option would be to use drop-down boxes with selectable values or
>> custom text boxes instead of sliders, at least as a temporary fix. Anyone
>> knows how I can do that?
>> By the way, iirc, IPython does have the update-on-release mechanism
>> implemented in their interactive widget functionality.
>>
>> On Monday, September 8, 2014 4:10:05 PM UTC+2, John Myles White wrote:
>>>
>>> I suspect the only way to do this is to change Interact so that it
>>> exposes a minimum time threshold before it registers a state change.
>>>
>>>  — John
>>>
>>> On Sep 8, 2014, at 4:16 AM, Andrei Berceanu <[email protected]>
>>> wrote:
>>>
>>> > I have some code along the lines of
>>> >
>>> > f = figure()
>>> > @manipulate for α=1:0.1:3, β=1:0.1:3, γ=1:0.1:3; withfig(f) do
>>> >         y = fun(α,β,γ)
>>> >         PyPlot.plot(x, y)
>>> >     end
>>> > end
>>> >
>>> > where fun is a *very slow* function to evaluate. Is there any way to
>>> tell @manipulate to update the resulting plot only after I release the
>>> sliders? Otherwise what I get is, I release them to the desised values and
>>> then have to wait ages for all the intermediate plots to be drawn.
>>> >
>>> > Tnx!
>>>
>>>
>

Reply via email to