Skip to content

Commit

Permalink
Merge pull request #813 from AayushSabharwal/as/rm-tabletraits
Browse files Browse the repository at this point in the history
refactor: remove Tables.jl impl, fall back to RecursiveArrayTools
  • Loading branch information
ChrisRackauckas authored Oct 9, 2024
2 parents e683d52 + 17e3b0e commit a224914
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 78 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[weakdeps]
ChainRules = "082447d4-558c-5d27-93f4-14fc19e9eca2"
Expand Down Expand Up @@ -111,9 +110,10 @@ Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["Pkg", "Plots", "UnicodePlots", "PyCall", "PythonCall", "SafeTestsets", "Serialization", "Test", "StableRNGs", "StaticArrays", "StochasticDiffEq", "Aqua", "Zygote", "PartialFunctions", "DataFrames", "OrdinaryDiffEq", "ForwardDiff"]
test = ["Pkg", "Plots", "UnicodePlots", "PyCall", "PythonCall", "SafeTestsets", "Serialization", "Test", "StableRNGs", "StaticArrays", "StochasticDiffEq", "Aqua", "Zygote", "PartialFunctions", "DataFrames", "OrdinaryDiffEq", "ForwardDiff", "Tables"]
3 changes: 1 addition & 2 deletions src/SciMLBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if isdefined(Base, :Experimental) &&
@eval Base.Experimental.@max_methods 1
end
using ConstructionBase
using RecipesBase, RecursiveArrayTools, Tables
using RecipesBase, RecursiveArrayTools
using SciMLStructures
using SymbolicIndexingInterface
using DocStringExtensions
Expand Down Expand Up @@ -741,7 +741,6 @@ include("ensemble/ensemble_analysis.jl")
include("solve.jl")
include("interpolation.jl")
include("integrator_interface.jl")
include("tabletraits.jl")
include("remake.jl")
include("callbacks.jl")

Expand Down
66 changes: 0 additions & 66 deletions src/tabletraits.jl

This file was deleted.

12 changes: 12 additions & 0 deletions test/downstream/tables.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using ModelingToolkit, OrdinaryDiffEq, Tables, Test
using ModelingToolkit: t_nounits as t, D_nounits as D

@variables x(t) y(t)
@parameters p q
@mtkbuild sys = ODESystem(
[D(x) ~ p * x + q * y, 0 ~ y^2 - 2x * y - 4], t, guesses = [y => 1.0])
prob = ODEProblem(sys, [x => 1.0], (0.0, 5.0), [p => 1.0, q => 2.0])
sol = solve(prob, Rodas5P())

@test sort(collect(Tables.columnnames(Tables.columns(sol)))) ==
[:timestamp, Symbol("x(t)"), Symbol("y(t)")]
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ end
@time @safetestset "ODE Solution Stripping" begin
include("downstream/ode_stripping.jl")
end
@time @safetestset "Tables interface with MTK" begin
include("downstream/tables.jl")
end
end

if !is_APPVEYOR && (GROUP == "Downstream" || GROUP == "SymbolicIndexingInterface")
Expand Down
17 changes: 9 additions & 8 deletions test/traits.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using SciMLBase, Test
using SciMLBase, Tables, Test
using OrdinaryDiffEq, DataFrames, SymbolicIndexingInterface

@test SciMLBase.Tables.isrowtable(ODESolution)
@test SciMLBase.Tables.isrowtable(RODESolution)
@test SciMLBase.Tables.isrowtable(DAESolution)
@test !SciMLBase.Tables.isrowtable(SciMLBase.NonlinearSolution)
@test !SciMLBase.Tables.isrowtable(SciMLBase.LinearSolution)
@test !SciMLBase.Tables.isrowtable(SciMLBase.QuadratureSolution)
@test !SciMLBase.Tables.isrowtable(SciMLBase.OptimizationSolution)
# https://github.com/SciML/SciMLBase.jl/pull/813#issuecomment-2401803039
@test !Tables.isrowtable(ODESolution)
@test !Tables.isrowtable(RODESolution)
@test !Tables.isrowtable(DAESolution)
@test !Tables.isrowtable(SciMLBase.NonlinearSolution)
@test !Tables.isrowtable(SciMLBase.LinearSolution)
@test !Tables.isrowtable(SciMLBase.QuadratureSolution)
@test !Tables.isrowtable(SciMLBase.OptimizationSolution)

function rhs(u, p, t)
return -u
Expand Down

0 comments on commit a224914

Please sign in to comment.