Skip to content

Commit

Permalink
Test that all the defined systems work and are solvable (#3)
Browse files Browse the repository at this point in the history
* Test that all the defined systems work and are solvable

* Fix a whole bunch of issues

* Better tests, and some bugfixes

* Add SimpleUnPack compat

* Add convenience script to visualize all systems

* Fix more systems!

* Run JuliaFormatter.jl

* Fix Julia1.6 tests by explicitly reshaping in MacArthur
  • Loading branch information
nathanaelbosch authored Dec 23, 2023
1 parent 3d93204 commit 95be70d
Show file tree
Hide file tree
Showing 7 changed files with 891 additions and 516 deletions.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SimpleUnPack = "ce78b400-467f-4804-87d8-8f486da07d0a"

[compat]
julia = "1.6"
ComponentArrays = "0.15"
JSON = "0.21"
LinearAlgebra = "1"
Markdown = "1"
SciMLBase = "1,2"
SimpleUnPack = "1"
Test = "1"
julia = "1.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
26 changes: 18 additions & 8 deletions src/ChaoticDynamicalSystemLibrary.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
module ChaoticDynamicalSystemLibrary

using Base: nothing_sentinel
using JSON, Markdown
using LinearAlgebra
using SciMLBase
using ComponentArrays
using SimpleUnPack

function dict_with_string_keys_to_symbol_keys(d::Dict)
new_d = Dict()
for (k, v) in d
new_d[Symbol(k)] = v
vecvec2mat(vv) = hcat(vv...)' # transpose is because of the way the data is stored in the JSON file

function format_parameters(params::Dict)
if isempty(params)
return nothing
end

intermediate_dict = Dict()
for (k, v) in params
val = if (v isa Vector) && (v[1] isa Vector)
vecvec2mat(v)
else
v
end
intermediate_dict[Symbol(k)] = val
end
return new_d
end

function dict_to_componentarray(d::Dict)
return ComponentArray(dict_with_string_keys_to_symbol_keys(d))
return ComponentArray(intermediate_dict)
end

function make_docstring(f)
Expand Down
Loading

0 comments on commit 95be70d

Please sign in to comment.