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
Error showing EnsembleSolution in Pluto notebooks #728
Comments
Reproducer? I can't reproduce on latest versions. |
FWIW, I am on 1.6.0-rc1. That could be something
Here's a saved notebook that reproduces it for me. I think it should work if you just open it up up in Pluto. ### A Pluto.jl notebook ###
# v0.12.20
using Markdown
using InteractiveUtils
# ╔═╡ 72ef6b9e-7af4-11eb-2c7b-5d41b939781d
using DifferentialEquations
# ╔═╡ 80e83654-7af4-11eb-14f6-ed421dc94a40
f(dx, x, p, t) = (dx .= p*x)
# ╔═╡ 8b6d6d18-7af4-11eb-1a9f-79fd6f522d5d
x0 = [1, 0]
# ╔═╡ 980e2be0-7af4-11eb-0008-f394252de978
A = [0 1; -1.0 -1]
# ╔═╡ a76930b2-7af4-11eb-304f-0120cbf3ce5c
prob = ODEProblem(f, x0, (0.0, 100.0), A)
# ╔═╡ b5113688-7af4-11eb-0e95-99ca21c18bfc
ens_prob = EnsembleProblem(prob;
prob_func = (prob,i,rep) -> (prob.p[2,1] = -rand(); prob),
)
# ╔═╡ fb05d36a-7af4-11eb-1271-e5bc01a88fd5
sols = solve(ens_prob; trajectories=100)
# ╔═╡ Cell order:
# ╠═72ef6b9e-7af4-11eb-2c7b-5d41b939781d
# ╠═80e83654-7af4-11eb-14f6-ed421dc94a40
# ╠═8b6d6d18-7af4-11eb-1a9f-79fd6f522d5d
# ╠═980e2be0-7af4-11eb-0008-f394252de978
# ╠═a76930b2-7af4-11eb-304f-0120cbf3ce5c
# ╠═b5113688-7af4-11eb-0e95-99ca21c18bfc
# ╠═fb05d36a-7af4-11eb-1271-e5bc01a88fd5 |
I also get it in 1.5.3. |
That seems fine in the REPL for me. Is it only Pluto? |
Yeah, only Pluto. It's fine in the REPL. |
oh what error does it throw? I don't use Pluto. |
I was thinking it might just be a Pluto quirk, but the error says |
|
@YingboMa do you know if we need a new show or something? |
getproperty(::SciMLBase.EnsembleSolution{Float64, 3, Vector{SciMLBase.ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Matrix{Float64}, SciMLBase.ODEFunction{true, typeof(Main.workspace17.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{true, typeof(Main.workspace17.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}}, DiffEqBase.DEStats}}}, ::Symbol)@Base.jl:33
rows(::SciMLBase.EnsembleSolution{Float64, 3, Vector{SciMLBase.ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Matrix{Float64}, SciMLBase.ODEFunction{true, typeof(Main.workspace17.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{true, typeof(Main.workspace17.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}}, DiffEqBase.DEStats}}})@tabletraits.jl:22
table_data(::SciMLBase.EnsembleSolution{Float64, 3, Vector{SciMLBase.ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Matrix{Float64}, SciMLBase.ODEFunction{true, typeof(Main.workspace17.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{true, typeof(Main.workspace17.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}}, DiffEqBase.DEStats}}}, ::IOContext{IOBuffer})@PlutoRunner.jl:827
show_richest(::IOContext{IOBuffer}, ::Any)@PlutoRunner.jl:607
var"#sprint_withreturned#28"(::IOContext{Base.DevNull}, ::Int64, ::typeof(Main.PlutoRunner.sprint_withreturned), ::Function, ::SciMLBase.EnsembleSolution{Float64, 3, Vector{SciMLBase.ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Matrix{Float64}, SciMLBase.ODEFunction{true, typeof(Main.workspace17.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{true, typeof(Main.workspace17.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}}, DiffEqBase.DEStats}}})@PlutoRunner.jl:557
format_output_default(::Any, ::Any)@PlutoRunner.jl:482
#format_output#17@PlutoRunner.jl:499[inlined]
formatted_result_of(::Base.UUID, ::Bool, ::Nothing)@PlutoRunner.jl:424
top-level scope@none:1 This is the full stack trace. |
@fonsp would you happen to know what's different about the Pluto printing system? |
Thanks for the example, i'll take a look! |
SciML/SciMLBase.jl#30 (though this is unrelated to the original issue) |
I am fixing this on the Pluto side: Pluto was trying to use its built-in (interactive 🌈) table viewer to display the Why did the table view fail?The problem is that (This error caused the Pluto display bug because Pluto used julia> using DifferentialEquations
julia> f(dx, x, p, t) = (dx .= p*x)
f (generic function with 1 method)
julia> x0 = [1, 0]
2-element Array{Int64,1}:
1
0
julia> A = [0 1; -1.0 -1]
2×2 Array{Float64,2}:
0.0 1.0
-1.0 -1.0
julia> prob = ODEProblem(f, x0, (0.0, 100.0), A)
ODEProblem with uType Array{Int64,1} and tType Float64. In-place: true
timespan: (0.0, 100.0)
u0: [1, 0]
julia> ens_prob = EnsembleProblem(prob;
prob_func = (prob,i,rep) -> (prob.p[2,1] = -rand(); prob),
)
EnsembleProblem with problem ODEProblem
julia> sols = solve(ens_prob; trajectories=100)
EnsembleSolution Solution of length 100 with uType:
OrdinaryDiffEq.ODECompositeSolution{...}
julia> using Tables
julia> Tables.istable(sols)
true
julia> Tables.rowaccess(sols)
true
julia> Tables.rows(sols)
ERROR: type EnsembleSolution has no field prob
Stacktrace:
[1] getproperty(::EnsembleSolution{Float64,3,Array{OrdinaryDiffEq.ODECompositeSolution{...},1}}, ::Symbol) at ./Base.jl:33
[2] rows(::EnsembleSolution{Float64,3,Array{OrdinaryDiffEq.ODECompositeSolution{...},1}}) at /Users/fons/Documents/SciMLBase.jl/src/tabletraits.jl:22
[3] top-level scope at REPL[11]:1
Note that this is from the REPL -- it is not a (Pluto) display problem, but an incomplete implementation of the Tables.jl interface. Fixing the Table interfaceOf course, one solution would be to find the source of this bug and fix it. Alternatively, if implementing a tables interface for Tables.istable(::EnsembleSolution) = false
# or
Tables.rowaccess(::EnsembleSolution) = false to tell Tables consumers that |
Does https://github.com/SciML/SciMLBase.jl/blob/master/src/tabletraits.jl#L18-L29 not give the row iteration? |
It does, but it (erroneously) accesses |
Oh yes, ensemble is weird. It's an array of tables. If that a table? 🤔 . |
Made it not a table. |
Sounds like the right solution for now. I suppose that if all trajectories share the same time axis then you could view it as a table, but this might not be worth the effort :) |
They don't, so that solves that. |
I'm getting an error
Failed to show value: type EnsembleSolution has no field prob
when showingEnsembleSolution
s in Pluto notebooks. It's not a show stopper--I can just put a semicolon to suppress the output--but figured it was something worth mentioning.Possibly related: running the example from the README in the DiffEqUncertainty docs also errors when showing the Koopman expectation in a Pluto notebook. For that one, it looks like it's a missing
has_syms
method.I believe these might both be due to the migration of some things from DiffEqBase to SciMLBase, but I'm not totally sure on that.
The text was updated successfully, but these errors were encountered: