Skip to content
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

Closed
jonniedie opened this issue Feb 27, 2021 · 20 comments · Fixed by SciML/SciMLBase.jl#30
Closed

Error showing EnsembleSolution in Pluto notebooks #728

jonniedie opened this issue Feb 27, 2021 · 20 comments · Fixed by SciML/SciMLBase.jl#30

Comments

@jonniedie
Copy link

I'm getting an error Failed to show value: type EnsembleSolution has no field prob when showing EnsembleSolutions 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.

@ChrisRackauckas
Copy link
Member

Reproducer? I can't reproduce on latest versions.

@jonniedie
Copy link
Author

jonniedie commented Mar 2, 2021

FWIW, I am on 1.6.0-rc1. That could be something

Julia Version 1.6.0-rc1
Commit a58bdd9010 (2021-02-06 15:49 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, westmere)
Environment:
  JULIA_NUM_THREADS = 8
  JULIA_REVISE_WORKER_ONLY = 1
      Status `~/.julia/environments/v1.6/Project.toml`
  [0c46a032] DifferentialEquations v6.16.0
  [c3e4b0f8] Pluto v0.12.20

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

@jonniedie
Copy link
Author

I also get it in 1.5.3.

@ChrisRackauckas
Copy link
Member

That seems fine in the REPL for me. Is it only Pluto?

@jonniedie
Copy link
Author

Yeah, only Pluto. It's fine in the REPL.

@ChrisRackauckas
Copy link
Member

ChrisRackauckas commented Mar 2, 2021

oh what error does it throw? I don't use Pluto.

@jonniedie
Copy link
Author

I was thinking it might just be a Pluto quirk, but the error says type EnsembleSolution has no field prob, so for some reason it's looking for a property named prob.

@jonniedie
Copy link
Author

jonniedie commented Mar 2, 2021

Failed to show value:
type EnsembleSolution has no field prob
getproperty(::SciMLBase.EnsembleSolution{Float64, 3, Vector{OrdinaryDiffEq.ODECompositeSolution{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.workspace547.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.CompositeAlgorithm{Tuple{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}}, OrdinaryDiffEq.AutoSwitchCache{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}, Rational{Int64}, Int64}}, OrdinaryDiffEq.CompositeInterpolationData{SciMLBase.ODEFunction{true, typeof(Main.workspace547.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.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}, OrdinaryDiffEq.Rosenbrock23Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{SciMLBase.ODEFunction{true, typeof(Main.workspace547.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Float64}, Matrix{Float64}}, SciMLBase.UJacobianWrapper{SciMLBase.ODEFunction{true, typeof(Main.workspace547.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, Matrix{Float64}}, DiffEqBase.DefaultLinSolve, FiniteDiff.JacobianCache{Vector{Float64}, Vector{Float64}, Vector{Float64}, UnitRange{Int64}, Nothing, Val{:forward}(), Float64}, FiniteDiff.GradientCache{Nothing, Vector{Float64}, Vector{Float64}, Float64, Val{:forward}(), Float64, Val{true}()}}}, OrdinaryDiffEq.AutoSwitchCache{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}, Rational{Int64}, Int64}}}, DiffEqBase.DEStats}}}, ::Symbol)@Base.jl:33
rows(::SciMLBase.EnsembleSolution{Float64, 3, Vector{OrdinaryDiffEq.ODECompositeSolution{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.workspace547.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.CompositeAlgorithm{Tuple{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}}, OrdinaryDiffEq.AutoSwitchCache{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}, Rational{Int64}, Int64}}, OrdinaryDiffEq.CompositeInterpolationData{SciMLBase.ODEFunction{true, typeof(Main.workspace547.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.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}, OrdinaryDiffEq.Rosenbrock23Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{SciMLBase.ODEFunction{true, typeof(Main.workspace547.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Float64}, Matrix{Float64}}, SciMLBase.UJacobianWrapper{SciMLBase.ODEFunction{true, typeof(Main.workspace547.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, Matrix{Float64}}, DiffEqBase.DefaultLinSolve, FiniteDiff.JacobianCache{Vector{Float64}, Vector{Float64}, Vector{Float64}, UnitRange{Int64}, Nothing, Val{:forward}(), Float64}, FiniteDiff.GradientCache{Nothing, Vector{Float64}, Vector{Float64}, Float64, Val{:forward}(), Float64, Val{true}()}}}, OrdinaryDiffEq.AutoSwitchCache{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}, Rational{Int64}, Int64}}}, DiffEqBase.DEStats}}})@tabletraits.jl:22
table_data(::SciMLBase.EnsembleSolution{Float64, 3, Vector{OrdinaryDiffEq.ODECompositeSolution{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.workspace547.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.CompositeAlgorithm{Tuple{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}}, OrdinaryDiffEq.AutoSwitchCache{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}, Rational{Int64}, Int64}}, OrdinaryDiffEq.CompositeInterpolationData{SciMLBase.ODEFunction{true, typeof(Main.workspace547.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.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}, OrdinaryDiffEq.Rosenbrock23Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{SciMLBase.ODEFunction{true, typeof(Main.workspace547.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Float64}, Matrix{Float64}}, SciMLBase.UJacobianWrapper{SciMLBase.ODEFunction{true, typeof(Main.workspace547.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, Matrix{Float64}}, DiffEqBase.DefaultLinSolve, FiniteDiff.JacobianCache{Vector{Float64}, Vector{Float64}, Vector{Float64}, UnitRange{Int64}, Nothing, Val{:forward}(), Float64}, FiniteDiff.GradientCache{Nothing, Vector{Float64}, Vector{Float64}, Float64, Val{:forward}(), Float64, Val{true}()}}}, OrdinaryDiffEq.AutoSwitchCache{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}, Rational{Int64}, Int64}}}, DiffEqBase.DEStats}}}, ::IOContext{IOBuffer})@PlutoRunner.jl:817
show_richest(::IOContext{IOBuffer}, ::Any)@PlutoRunner.jl:600
var"#sprint_withreturned#28"(::IOContext{Base.DevNull}, ::Int64, ::typeof(Main.PlutoRunner.sprint_withreturned), ::Function, ::SciMLBase.EnsembleSolution{Float64, 3, Vector{OrdinaryDiffEq.ODECompositeSolution{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.workspace547.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.CompositeAlgorithm{Tuple{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}}, OrdinaryDiffEq.AutoSwitchCache{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}, Rational{Int64}, Int64}}, OrdinaryDiffEq.CompositeInterpolationData{SciMLBase.ODEFunction{true, typeof(Main.workspace547.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.CompositeCache{Tuple{OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}, OrdinaryDiffEq.Rosenbrock23Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{SciMLBase.ODEFunction{true, typeof(Main.workspace547.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Float64}, Matrix{Float64}}, SciMLBase.UJacobianWrapper{SciMLBase.ODEFunction{true, typeof(Main.workspace547.f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, Matrix{Float64}}, DiffEqBase.DefaultLinSolve, FiniteDiff.JacobianCache{Vector{Float64}, Vector{Float64}, Vector{Float64}, UnitRange{Int64}, Nothing, Val{:forward}(), Float64}, FiniteDiff.GradientCache{Nothing, Vector{Float64}, Vector{Float64}, Float64, Val{:forward}(), Float64, Val{true}()}}}, OrdinaryDiffEq.AutoSwitchCache{OrdinaryDiffEq.Tsit5, OrdinaryDiffEq.Rosenbrock23{0, false, DiffEqBase.DefaultLinSolve, DataType}, Rational{Int64}, Int64}}}, DiffEqBase.DEStats}}})@PlutoRunner.jl:550
format_output_default(::Any, ::Any)@PlutoRunner.jl:475
#format_output#17@PlutoRunner.jl:492[inlined]
formatted_result_of(::Base.UUID, ::Bool, ::Nothing)@PlutoRunner.jl:417
top-level scope@none:1

@ChrisRackauckas
Copy link
Member

@YingboMa do you know if we need a new show or something?

@YingboMa
Copy link
Member

YingboMa commented Mar 2, 2021

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.

The problem printing is also messed up.
image

@ChrisRackauckas
Copy link
Member

@fonsp would you happen to know what's different about the Pluto printing system?

@fonsp
Copy link

fonsp commented Mar 4, 2021

Thanks for the example, i'll take a look!

@fonsp
Copy link

fonsp commented Mar 4, 2021

The problem printing is also messed up.

SciML/SciMLBase.jl#30 (though this is unrelated to the original issue)

@fonsp
Copy link

fonsp commented Mar 4, 2021

I am fixing this on the Pluto side: Pluto was trying to use its built-in (interactive 🌈) table viewer to display the EnsembleSolution, which failed. My fix will be to wrap Pluto's display code in a try block, and fall back to basic text/plain display when the table view fails.

Why did the table view fail?

The problem is that EnsembleSolution is a Tables.jl table with "row access", but calling Tables.rows(sols) fails. (MWE below.)

(This error caused the Pluto display bug because Pluto used Tables.istable(output) && Tables.rowaccess(output) to determine that sols should be displayed using Pluto's built-in table viewer, which internally calls Tables.rows.)

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 interface

Of course, one solution would be to find the source of this bug and fix it. Alternatively, if implementing a tables interface for EnsembleSolution was never intended, you could either define:

Tables.istable(::EnsembleSolution) = false
# or
Tables.rowaccess(::EnsembleSolution) = false

to tell Tables consumers that Tables.rows(::EnsembleSolution) is not implemented.

@ChrisRackauckas
Copy link
Member

@fonsp
Copy link

fonsp commented Mar 4, 2021

It does, but it (erroneously) accesses sol.prob. It looks like EnsembleSolution is a collection of solutions, each with its own prob, i.e. [s.prob for s in sol.u]. I don't fully understand the context here, but it seems like EnsembleSolution should not have a 2D table interface?

@ChrisRackauckas
Copy link
Member

Oh yes, ensemble is weird. It's an array of tables. If that a table? 🤔 .

@ChrisRackauckas
Copy link
Member

Made it not a table.

@fonsp
Copy link

fonsp commented Mar 4, 2021

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 :)

@ChrisRackauckas
Copy link
Member

They don't, so that solves that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants