JuliaDynamics / InteractiveDynamics.jl

Fast, general-purpose interactive applications for complex systems
https://juliadynamics.github.io/InteractiveDynamics.jl/dev/
MIT License
171 stars 25 forks source link

Example orbitdiagram.jl fails -- scatter marker shape error #126

Open loiseaujc opened 1 year ago

loiseaujc commented 1 year ago

Hej,

My bad for my previous issue with the old package name! I have now updated to InteractiveDynamics.jl v0.21.12 but I run into a different error. Whenever running the orbitdiagram.jl script from the folder example, it fails with the following error

ERROR: LoadError: Circle{Float32}(Float32[0.0, 0.0], 1.0f0) is not a valid scatter marker shape.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] marker_to_sdf_shape(x::Circle{Float32})
    @ Makie ~/.julia/packages/Makie/gAmAB/src/utilities/texture_atlas.jl:416
  [3] (::GLMakie.var"#185#192")(m::Circle{Float32})
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:219
  [4] #map#13
    @ ~/.julia/packages/Observables/PHGQ8/src/Observables.jl:564 [inlined]
  [5] map(::GLMakie.var"#185#192", ::Observable{Circle{Float32}})
    @ Observables ~/.julia/packages/Observables/PHGQ8/src/Observables.jl:562
  [6] (::GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}})(gl_attributes::Dict{Symbol, Any})
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:219
  [7] (::GLMakie.var"#168#171"{GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}}, GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}})()
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:111
  [8] get!(default::GLMakie.var"#168#171"{GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}}, GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}}, h::Dict{UInt64, GLMakie.GLAbstraction.RenderObject}, key::UInt64)
    @ Base ./dict.jl:481
  [9] cached_robj!(robj_func::GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}}, screen::GLMakie.Screen{GLFW.Window}, scene::Scene, x::Scatter{Tuple{Vector{Point{2, Float32}}}})
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:84
 [10] draw_atomic
    @ ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:198 [inlined]
 [11] insert!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene, x::Scatter{Tuple{Vector{Point{2, Float32}}}})
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:126
 [12] push!(scene::Scene, plot::Scatter{Tuple{Vector{Point{2, Float32}}}})
    @ Makie ~/.julia/packages/Makie/gAmAB/src/scenes.jl:413
 [13] plot!(scene::Scene, P::Type{Scatter{Tuple{Vector{Point{2, Float32}}}}}, attributes::Attributes, input::Tuple{Observable{Vector{Point{2, Float32}}}}, args::Observable{Tuple{Vector{Point{2, Float32}}}})
    @ Makie ~/.julia/packages/Makie/gAmAB/src/interfaces.jl:414
 [14] plot!(scene::Scene, P::Type{Scatter}, attributes::Attributes, args::Observable{Vector{Point{2, Float32}}}; kw_attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Makie ~/.julia/packages/Makie/gAmAB/src/interfaces.jl:328
 [15] plot!
    @ ~/.julia/packages/Makie/gAmAB/src/interfaces.jl:295 [inlined]
 [16] plot!(la::Axis, P::Type{Scatter}, attributes::Attributes, args::Observable{Vector{Point{2, Float32}}}; kw_attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Makie ~/.julia/packages/Makie/gAmAB/src/makielayout/blocks/axis.jl:778
 [17] plot!
    @ ~/.julia/packages/Makie/gAmAB/src/makielayout/blocks/axis.jl:765 [inlined]
 [18] #plot!#1374
    @ ~/.julia/packages/Makie/gAmAB/src/makielayout/blocks/axis.jl:795 [inlined]
 [19] scatter!(::Axis, ::Vararg{Any}; attributes::Base.Pairs{Symbol, Any, NTuple{4, Symbol}, NamedTuple{(:marker, :markersize, :color, :strokewidth), Tuple{Circle{Float32}, Pixel{Int64}, Observable{ColorTypes.RGBA{Float32}}, Float64}}})
    @ MakieCore ~/.julia/packages/MakieCore/LOKNz/src/recipes.jl:38
 [20] interactive_orbitdiagram(ds::DiscreteDynamicalSystem{false, SVector{2, Float64}, 2, typeof(DynamicalSystemsBase.Systems.hoop), Vector{Float64}, typeof(DynamicalSystemsBase.Systems.hoop_jac), SMatrix{2, 2, Float64, 4}, false}, p_index::Int64, p_min::Float64, p_max::Float64, i0::Int64; u0::SVector{2, Float64}, parname::String, title::String)
    @ InteractiveDynamics ~/.julia/packages/InteractiveDynamics/x2wQQ/src/chaos/orbitdiagram.jl:81
 [21] top-level scope
    @ ~/Downloads/InteractiveDynamics.jl-main/examples/dynamicalsystems/orbitdiagram.jl:14
 [22] include(fname::String)
    @ Base.MainInclude ./client.jl:476
 [23] top-level scope
    @ REPL[1]:1

It seems to me that it comes from the definition const MARKER = Circle(Point2f(0, 0), Float32(1)) in colors.jl but I am not yet familiar with the whole Julia / Makie to be 100% (I'm a Fortran person).


For info, I have installed everything in a dedicated env. Here are the only packages I have:

loiseaujc commented 1 year ago

I'm met with the same error if I run the examples/psos.jl script as well.

Datseris commented 1 year ago

Yeah thats a breaking change from Makie that needs to be updated here...

loiseaujc commented 1 year ago

I'll try to send a pull request to fix it tomorrow if I find the time.

loiseaujc commented 1 year ago

Alright, the problem is (partially) fixed I believe.

Simply changing const MARKER = Circle(Point2f(0, 0), Float32(1)) to Circle in colors.jl fixed the problem for orbitdiagram.jl. I don't feel like sending such a simple pull request yet as I still have problems with psos.jl. Here is the error log

ERROR: LoadError: Circle{Float32}(Float32[0.0, 0.0], 1.0f0) is not a valid scatter marker shape.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] marker_to_sdf_shape(x::Circle{Float32})
    @ Makie ~/.julia/packages/Makie/gAmAB/src/utilities/texture_atlas.jl:416
  [3] (::GLMakie.var"#185#192")(m::Circle{Float32})
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:219
  [4] #map#13
    @ ~/.julia/packages/Observables/PHGQ8/src/Observables.jl:564 [inlined]
  [5] map(::GLMakie.var"#185#192", ::Observable{Circle{Float32}})
    @ Observables ~/.julia/packages/Observables/PHGQ8/src/Observables.jl:562
  [6] (::GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}})(gl_attributes::Dict{Symbol, Any})
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:219
  [7] (::GLMakie.var"#168#171"{GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}}, GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}})()
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:111
  [8] get!(default::GLMakie.var"#168#171"{GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}}, GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}}, h::Dict{UInt64, GLMakie.GLAbstraction.RenderObject}, key::UInt64)
    @ Base ./dict.jl:481
  [9] cached_robj!(robj_func::GLMakie.var"#182#189"{GLMakie.Screen{GLFW.Window}, Scene, Scatter{Tuple{Vector{Point{2, Float32}}}}}, screen::GLMakie.Screen{GLFW.Window}, scene::Scene, x::Scatter{Tuple{Vector{Point{2, Float32}}}})
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:84
 [10] draw_atomic
    @ ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:198 [inlined]
 [11] insert!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene, x::Scatter{Tuple{Vector{Point{2, Float32}}}})
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/drawing_primitives.jl:126
 [12] insertplots!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene)
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/screen.jl:435
 [13] insertplots!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene) (repeats 2 times)
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/screen.jl:438
 [14] display_scene!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene)
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/screen.jl:374
 [15] GLMakie.Screen(scene::Scene, config::GLMakie.ScreenConfig; visible::Nothing, start_renderloop::Bool)
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/screen.jl:391
 [16] GLMakie.Screen(scene::Scene, config::GLMakie.ScreenConfig)
    @ GLMakie ~/.julia/packages/GLMakie/N16Fq/src/screen.jl:387
 [17] getscreen(::Module, ::Scene; screen_config::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Makie ~/.julia/packages/Makie/gAmAB/src/display.jl:336
 [18] getscreen
    @ ~/.julia/packages/Makie/gAmAB/src/display.jl:324 [inlined]
 [19] display(figlike::Figure; backend::Module, update::Bool, screen_config::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Makie ~/.julia/packages/Makie/gAmAB/src/display.jl:148
 [20] display
    @ ~/.julia/packages/Makie/gAmAB/src/display.jl:133 [inlined]
 [21] interactive_poincaresos(ds::ContinuousDynamicalSystem{true, Vector{Float64}, 4, typeof(DynamicalSystemsBase.Systems.hhrule!), Nothing, typeof(DynamicalSystemsBase.Systems.hhjacob!), Matrix{Float64}, false}, plane::Tuple{Int64, Float64}, idxs::Tuple{Int64, Int64}, complete::typeof(complete); direction::Int64, tfinal::Tuple{Float64, Float64}, rootkw::NamedTuple{(:xrtol, :atol), Tuple{Float64, Float64}}, color::typeof(randomcolor), scatterkwargs::Tuple{}, labels::Tuple{String, String}, diffeq::NamedTuple{(:alg, :abstol, :reltol), Tuple{Vern9{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, Float64, Float64}})
    @ InteractiveDynamics ~/GitHub/InteractiveDynamics.jl/src/chaos/poincareclick.jl:121
 [22] top-level scope
    @ ~/GitHub/InteractiveDynamics.jl/examples/dynamicalsystems/psos.jl:22
 [23] include(fname::String)
    @ Base.MainInclude ./client.jl:476
 [24] top-level scope
    @ REPL[1]:1
in expression starting at /home/loiseau/GitHub/InteractiveDynamics.jl/examples/dynamicalsystems/psos.jl:22

I'm still not entirely familiar with the Julia error messages and so I have some difficulties parsing this log. My understanding however is that the error is not coming from InteractiveDynamics.jl but from one of its dependencies as, if I change MARKER to say Rect, I still do get the Circle{Float32} error.