From 85b84b8a1b00d02e7b9e7c6967d9b7523a8a4fee Mon Sep 17 00:00:00 2001 From: Nathanael Bosch Date: Sat, 23 Dec 2023 14:08:42 +0000 Subject: [PATCH] Add more systems (#5) * Add more systems There were still some systems missing that were defined in the style of ```python class BlinkingVortex(BlinkingRotlet): pass ``` This PR adds them * Test that the documentation works - mostly for codecov * Fix a typo * Add new systems to `visualize_all_systems.jl` * JuliaFormatter.jl * Add the new systems to the tests --- src/chaotic_attractors.jl | 133 ++++++++++++++++++++++++++++---- test/test_chaotic_attractors.jl | 10 +++ visualize_all_systems.jl | 7 ++ 3 files changed, 136 insertions(+), 14 deletions(-) diff --git a/src/chaotic_attractors.jl b/src/chaotic_attractors.jl index da1f779..e47cbd1 100644 --- a/src/chaotic_attractors.jl +++ b/src/chaotic_attractors.jl @@ -755,8 +755,23 @@ function LidDrivenCavityFlow() return prob end -# class BlinkingVortex(BlinkingRotlet): -# pass +function BlinkingVortex end +function originalcode(::typeof(BlinkingVortex)) + """ +class BlinkingVortex(BlinkingRotlet): + pass +""" +end +@doc make_docstring(BlinkingVortex) BlinkingVortex +function BlinkingVortex() + prob = BlinkingRotlet() + u0 = Float64.(ATTRACTOR_DATA["BlinkingVortex"]["initial_conditions"]) + p = format_parameters(ATTRACTOR_DATA["BlinkingVortex"]["parameters"]) + T = ATTRACTOR_DATA["BlinkingVortex"]["period"] * N + tspan = (0.0, T) + prob = remake(prob, u0 = u0, p = p, tspan = tspan) + return prob +end # class InteriorSquirmer(DynSys): @@ -2050,8 +2065,23 @@ function Arneodo() return prob end -# class Coullet(Arneodo): -# pass +function Coullet end +function originalcode(::typeof(Coullet)) + """ +class Coullet(Arneodo): + pass +""" +end +@doc make_docstring(Coullet) Coullet +function Coullet() + prob = Arneodo() + u0 = Float64.(ATTRACTOR_DATA["Coullet"]["initial_conditions"]) + p = format_parameters(ATTRACTOR_DATA["Coullet"]["parameters"]) + T = ATTRACTOR_DATA["Coullet"]["period"] * N + tspan = (0.0, T) + prob = remake(prob, u0 = u0, p = p, tspan = tspan) + return prob +end function Rucklidge end originalcode(::typeof(Rucklidge)) = """ @@ -2109,8 +2139,23 @@ function Sakarya() return prob end -# class LiuChen(Sakarya): -# pass +function LiuChen end +function originalcode(::typeof(LiuChen)) + """ +class LiuChen(Sakarya): + pass +""" +end +@doc make_docstring(LiuChen) LiuChen +function LiuChen() + prob = Sakarya() + u0 = Float64.(ATTRACTOR_DATA["LiuChen"]["initial_conditions"]) + p = format_parameters(ATTRACTOR_DATA["LiuChen"]["parameters"]) + T = ATTRACTOR_DATA["LiuChen"]["period"] * N + tspan = (0.0, T) + prob = remake(prob, u0 = u0, p = p, tspan = tspan) + return prob +end function RayleighBenard end originalcode(::typeof(RayleighBenard)) = """ @@ -2196,8 +2241,23 @@ function Bouali2() return prob end -# class Bouali(Bouali2): -# pass +function Bouali end +function originalcode(::typeof(Bouali)) + """ +class Bouali(Bouali2): + pass +""" +end +@doc make_docstring(Bouali) Bouali +function Bouali() + prob = Bouali2() + u0 = Float64.(ATTRACTOR_DATA["Bouali"]["initial_conditions"]) + p = format_parameters(ATTRACTOR_DATA["Bouali"]["parameters"]) + T = ATTRACTOR_DATA["Bouali"]["period"] * N + tspan = (0.0, T) + prob = remake(prob, u0 = u0, p = p, tspan = tspan) + return prob +end function LuChenCheng end originalcode(::typeof(LuChenCheng)) = """ @@ -2535,11 +2595,41 @@ function DequanLi() return prob end -# class PanXuZhou(DequanLi): -# pass +function PanXuZhou end +function originalcode(::typeof(PanXuZhou)) + """ +class PanXuZhou(DequanLi): + pass +""" +end +@doc make_docstring(PanXuZhou) PanXuZhou +function PanXuZhou() + prob = DequanLi() + u0 = Float64.(ATTRACTOR_DATA["PanXuZhou"]["initial_conditions"]) + p = format_parameters(ATTRACTOR_DATA["PanXuZhou"]["parameters"]) + T = ATTRACTOR_DATA["PanXuZhou"]["period"] * N + tspan = (0.0, T) + prob = remake(prob, u0 = u0, p = p, tspan = tspan) + return prob +end -# class Tsucs2(DequanLi): -# pass +function Tsucs2 end +function originalcode(::typeof(Tsucs2)) + """ +class Tsucs2(DequanLi): + pass +""" +end +@doc make_docstring(Tsucs2) Tsucs2 +function Tsucs2() + prob = DequanLi() + u0 = Float64.(ATTRACTOR_DATA["Tsucs2"]["initial_conditions"]) + p = format_parameters(ATTRACTOR_DATA["Tsucs2"]["parameters"]) + T = ATTRACTOR_DATA["Tsucs2"]["period"] * N + tspan = (0.0, T) + prob = remake(prob, u0 = u0, p = p, tspan = tspan) + return prob +end function ArnoldWeb end originalcode(::typeof(ArnoldWeb)) = """ @@ -3874,8 +3964,23 @@ function Torus() return prob end -# class CaTwoPlusQuasiperiodic(CaTwoPlus): -# pass +function CaTwoPlusQuasiperiodic end +function originalcode(::typeof(CaTwoPlusQuasiperiodic)) + """ +class CaTwoPlusQuasiperiodic(CaTwoPlus): + pass +""" +end +@doc make_docstring(CaTwoPlusQuasiperiodic) CaTwoPlusQuasiperiodic +function CaTwoPlusQuasiperiodic() + prob = CaTwoPlus() + u0 = Float64.(ATTRACTOR_DATA["CaTwoPlusQuasiperiodic"]["initial_conditions"]) + p = format_parameters(ATTRACTOR_DATA["CaTwoPlusQuasiperiodic"]["parameters"]) + T = ATTRACTOR_DATA["CaTwoPlusQuasiperiodic"]["period"] * N + tspan = (0.0, T) + prob = remake(prob, u0 = u0, p = p, tspan = tspan) + return prob +end function Hopfield end originalcode(::typeof(Hopfield)) = """ diff --git a/test/test_chaotic_attractors.jl b/test/test_chaotic_attractors.jl index d82cf7e..0d4cb5c 100644 --- a/test/test_chaotic_attractors.jl +++ b/test/test_chaotic_attractors.jl @@ -16,9 +16,12 @@ using SafeTestsets ChaoticDynamicalSystemLibrary.BickleyJet, ChaoticDynamicalSystemLibrary.Blasius, ChaoticDynamicalSystemLibrary.BlinkingRotlet, + ChaoticDynamicalSystemLibrary.BlinkingVortex, + ChaoticDynamicalSystemLibrary.Bouali, ChaoticDynamicalSystemLibrary.Bouali2, ChaoticDynamicalSystemLibrary.BurkeShaw, ChaoticDynamicalSystemLibrary.CaTwoPlus, + ChaoticDynamicalSystemLibrary.CaTwoPlusQuasiperiodic, ChaoticDynamicalSystemLibrary.CellCycle, ChaoticDynamicalSystemLibrary.CellularNeuralNetwork, ChaoticDynamicalSystemLibrary.Chen, @@ -27,6 +30,7 @@ using SafeTestsets ChaoticDynamicalSystemLibrary.CircadianRhythm, ChaoticDynamicalSystemLibrary.CoevolvingPredatorPrey, ChaoticDynamicalSystemLibrary.Colpitts, + ChaoticDynamicalSystemLibrary.Coullet, ChaoticDynamicalSystemLibrary.Dadras, ChaoticDynamicalSystemLibrary.DequanLi, ChaoticDynamicalSystemLibrary.DoubleGyre, @@ -70,6 +74,7 @@ using SafeTestsets ChaoticDynamicalSystemLibrary.LorenzBounded, ChaoticDynamicalSystemLibrary.LorenzCoupled, ChaoticDynamicalSystemLibrary.LorenzStenflo, + ChaoticDynamicalSystemLibrary.LiuChen, ChaoticDynamicalSystemLibrary.LuChen, ChaoticDynamicalSystemLibrary.LuChenCheng, ChaoticDynamicalSystemLibrary.MacArthur, @@ -79,6 +84,7 @@ using SafeTestsets ChaoticDynamicalSystemLibrary.NoseHoover, ChaoticDynamicalSystemLibrary.NuclearQuadrupole, ChaoticDynamicalSystemLibrary.OscillatingFlow, + ChaoticDynamicalSystemLibrary.PanXuZhou, ChaoticDynamicalSystemLibrary.PehlivanWei, ChaoticDynamicalSystemLibrary.Qi, ChaoticDynamicalSystemLibrary.QiChen, @@ -117,6 +123,7 @@ using SafeTestsets ChaoticDynamicalSystemLibrary.SwingingAtwood, ChaoticDynamicalSystemLibrary.Thomas, ChaoticDynamicalSystemLibrary.Torus, + ChaoticDynamicalSystemLibrary.Tsucs2, ChaoticDynamicalSystemLibrary.TurchinHanski, ChaoticDynamicalSystemLibrary.VallisElNino, ChaoticDynamicalSystemLibrary.WangSun, @@ -124,6 +131,9 @@ using SafeTestsets ChaoticDynamicalSystemLibrary.YuWang, ChaoticDynamicalSystemLibrary.YuWang2, ChaoticDynamicalSystemLibrary.ZhouChen) + @test ChaoticDynamicalSystemLibrary.originalcode(System) isa String + @test_nowarn ChaoticDynamicalSystemLibrary.make_docstring(System) + prob = @test_nowarn System() @test prob isa ODEProblem @test_nowarn solve(prob, Tsit5(), abstol = 1e-6, reltol = 1e-4) diff --git a/visualize_all_systems.jl b/visualize_all_systems.jl index b52a4fd..00bb312 100644 --- a/visualize_all_systems.jl +++ b/visualize_all_systems.jl @@ -11,9 +11,12 @@ ALL_SYSTEMS = (ChaoticDynamicalSystemLibrary.Aizawa, ChaoticDynamicalSystemLibrary.BickleyJet, ChaoticDynamicalSystemLibrary.Blasius, ChaoticDynamicalSystemLibrary.BlinkingRotlet, + ChaoticDynamicalSystemLibrary.BlinkingVortex, + ChaoticDynamicalSystemLibrary.Bouali, ChaoticDynamicalSystemLibrary.Bouali2, ChaoticDynamicalSystemLibrary.BurkeShaw, ChaoticDynamicalSystemLibrary.CaTwoPlus, + ChaoticDynamicalSystemLibrary.CaTwoPlusQuasiperiodic, ChaoticDynamicalSystemLibrary.CellCycle, ChaoticDynamicalSystemLibrary.CellularNeuralNetwork, ChaoticDynamicalSystemLibrary.Chen, @@ -22,6 +25,7 @@ ALL_SYSTEMS = (ChaoticDynamicalSystemLibrary.Aizawa, ChaoticDynamicalSystemLibrary.CircadianRhythm, ChaoticDynamicalSystemLibrary.CoevolvingPredatorPrey, ChaoticDynamicalSystemLibrary.Colpitts, + ChaoticDynamicalSystemLibrary.Coullet, ChaoticDynamicalSystemLibrary.Dadras, ChaoticDynamicalSystemLibrary.DequanLi, ChaoticDynamicalSystemLibrary.DoubleGyre, @@ -65,6 +69,7 @@ ALL_SYSTEMS = (ChaoticDynamicalSystemLibrary.Aizawa, ChaoticDynamicalSystemLibrary.LorenzBounded, ChaoticDynamicalSystemLibrary.LorenzCoupled, ChaoticDynamicalSystemLibrary.LorenzStenflo, + ChaoticDynamicalSystemLibrary.LiuChen, ChaoticDynamicalSystemLibrary.LuChen, ChaoticDynamicalSystemLibrary.LuChenCheng, ChaoticDynamicalSystemLibrary.MacArthur, @@ -74,6 +79,7 @@ ALL_SYSTEMS = (ChaoticDynamicalSystemLibrary.Aizawa, ChaoticDynamicalSystemLibrary.NoseHoover, ChaoticDynamicalSystemLibrary.NuclearQuadrupole, ChaoticDynamicalSystemLibrary.OscillatingFlow, + ChaoticDynamicalSystemLibrary.PanXuZhou, ChaoticDynamicalSystemLibrary.PehlivanWei, ChaoticDynamicalSystemLibrary.Qi, ChaoticDynamicalSystemLibrary.QiChen, @@ -112,6 +118,7 @@ ALL_SYSTEMS = (ChaoticDynamicalSystemLibrary.Aizawa, ChaoticDynamicalSystemLibrary.SwingingAtwood, ChaoticDynamicalSystemLibrary.Thomas, ChaoticDynamicalSystemLibrary.Torus, + ChaoticDynamicalSystemLibrary.Tsucs2, ChaoticDynamicalSystemLibrary.TurchinHanski, ChaoticDynamicalSystemLibrary.VallisElNino, ChaoticDynamicalSystemLibrary.WangSun,