Skip to content

Names of unknowns have a (t) appendix but DataFrame column names notΒ #798

@david-hofmann

Description

@david-hofmann

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.45

Thank you!

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions