-
-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
See results during calculation #476
Comments
If this is possible to do it could be really cool, for example for a live display of statistics collected with OnlineStats.jl. |
Though not as comprehensive as the potential As of right now there are no ways to programmatically stop or start the |
Yeah it could be done via a kind of iterator over an collection which spits out the next value only if i has changed. Something like this mutable struct ClockChecker
last_i
count
ClockChecker() = new(1,0)
end checker = ClockChecker() if running(checker, i) # just check if i has changed since last call, and if so increase counter
j = count(checker)
algorithmic_step(j)
end This hinges at the situation that Pluto doesn't detect mutations in structs (and array elements). |
But it would be good it the clock would not start on loading, but only after the first push of "start". |
+1 for adding a kwarg to allow not start on loading. |
(continuing a discussion from JuliaPluto/PlutoUI.jl#47)
This is a problem, because it breaks the all important goal: "At any instant, the program state is completely described by the code you see." I think that the solution could be lazy lists. The basic use case: Animation([expensive_result(t) for t in 1:100]) Could be made runtime/memory efficient by describing the frames using a lazy map: Animation(map(expensive_result, @lazy 1:100)) Here, In your example, the simulation depends on the previous step, which makes it a trickier Animation(accumulate(advance, @lazy 1:100, init=x0)) with function advance(old_solution::Array, t::Number)::Array
...
return new_solution
end |
Interesting. But I am wondering if Pluto can have more possibility as a stateful machine. I think the key point is how to make this robust. I am quite interested in thinking more into this direction. An example is given here. |
#1597 together with https://github.com/JuliaPluto/PlutoHooks.jl will make this possible! #437 is also related |
For us late-comers, here is how to achieve j-fu's original goal with the new Pluto features. Use PlutoUI to create a clock widget with start/stop buttons: @bind i Clock() Then create a new cell which gets triggered by each update to begin
i # dependency on clock variable
ref = @use_ref(1.0)
θ = 0.01
ref[] *= exp(2π*im*θ)
end The variable |
Just an idea - I am thinking about possibilities to present results of time dependent calculations within Pluto. The possibility to do this via animated
@gif
in Plots is there, but this is quite restricted and a bit far away with other packages.I was thinking about the following: Currently, cell1 like
with the dependent cell2
results in the value 10.
Now I imagine a macro, let's name it
@emit
which allows the following@emit
would trigger the recalculation in cell2 each time it is called, and we would see the developmentof it's results. It could be restricted to work only in places where the cell value would be returned if it would not be there.
The text was updated successfully, but these errors were encountered: