Created
September 22, 2020 09:57
-
-
Save theogf/9069bacc7038ad6fae37d622acd2a7ec to your computer and use it in GitHub Desktop.
Code for segfault when using observables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Makie | |
using AbstractPlotting.MakieLayout | |
using OnlineStats | |
t = Node(0) | |
function foo() | |
scene, layout = layoutscene() | |
axis = layout[1,1] = LAxis(scene) | |
t = Node(0) | |
it = lift(t, init = MovingWindow(10, Float32)) do t | |
fit!(it[], Float32(t)) | |
end | |
bar!(axis, t, it) | |
return scene, axis, t | |
end | |
function bar!(axis, t, it) | |
m = lift(t, init = Mean(Float32)) do t | |
fit!(m[], Float32(t)) | |
end | |
v = lift(m, init = MovingWindow(10, Float32)) do m | |
fit!(v[], value(m)) | |
end | |
p = lift(v, init = [Point2f0(0, 0)]) do v | |
Point2f0.(value(it[]), value(v)) | |
end | |
scatter!(axis, p) | |
end | |
scene, axis, t = foo() | |
t[] = 40 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment