-
-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Description
A nice to have: consistency between unknown names and DataFrame column names
The names of unknowns/variables of an ODESystem come with a (t) appendix. However, when transforming the solution to a DataFrame the (t) is gone. This way one cannot directly use the name of a variable as an index.
It would be helpful to make naming consistent.
Minimal Reproducible Example π
using ModelingToolkit
using DataFrames
using OrdinaryDiffEq
const t = ModelingToolkit.t_nounits
const D = ModelingToolkit.D_nounits
@variables x(t)=1.0
eqn = [D(x) ~ 0.0]
@named sys = ODESystem(eqn,t,[x],[],tspan=(0, 10.0))
sys = structural_simplify(sys)
prob = ODEProblem(sys)
sol = solve(prob)
dfsys = DataFrame(sol)
String(Symbol(unknowns(sys)[1]))
names(dfsys)[2]
Package Versions
Status `~/.julia/environments/v1.10/Project.toml`
[13f3f980] CairoMakie v0.12.11
β [a93c6f00] DataFrames v1.6.1
β [0c46a032] DifferentialEquations v7.13.0
[86223c79] Graphs v1.11.2
[23992714] MAT v0.10.7
β [961ee093] ModelingToolkit v9.40.0
[769b91e5] Neuroblox v0.4.2 `../../../Projects/neuroblox/codes/Neuroblox.jl`
[bac558e1] OrderedCollections v1.6.3
β [1dea7af3] OrdinaryDiffEq v6.87.0
β [91a5bcdd] Plots v1.40.1
β [c3e4b0f8] Pluto v0.19.45Thank you!
Metadata
Metadata
Assignees
Labels
No labels