-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
The output functions defined in src/output-analysis.jl, e.g. total_biomass() fail when using interpolated solution.
A solution might be to add DiffEqArray to accepted types or to relax the type constrain?
A reproducible example:
vegan = Foodweb([:ours => :plant])
m = default_model(vegan)
sol = simulate(m, rand(length(get_species_names(m))), 100)# Works
julia> total_biomass(sol[:, end])
0.5795782663712777# Interpolate the solution to get equally sized time steps
last_t = round(sol.t[end])
sol2 = sol(collect(last_t-50:1:last_t))
# Fail because sol2 is of type DiffEqArray
julia> total_biomass(sol2)
ERROR: MethodError: no method matching total_biomass(::DiffEqArray{Float64, 2, Vector{…}, Vector{…}, @NamedTuple{…}, ODESolution{…}, Nothing})
Closest candidates are:
total_biomass(::AbstractVector)
@ EcologicalNetworksDynamics ~/.julia/packages/EcologicalNetworksDynamics/R3OJZ/src/output-analysis.jl:125
total_biomass(::SciMLBase.AbstractODESolution)
@ EcologicalNetworksDynamics ~/.julia/packages/EcologicalNetworksDynamics/R3OJZ/src/output-analysis.jl:111
Stacktrace:
[1] top-level scope
@ REPL[180]:1
[2] top-level scope
@ none:1
Some type information was truncated. Use `show(err)` to see complete types.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels