Skip to content

Commit

Permalink
Add more systems (#5)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nathanaelbosch authored Dec 23, 2023
1 parent 95be70d commit 85b84b8
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 14 deletions.
133 changes: 119 additions & 14 deletions src/chaotic_attractors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down Expand Up @@ -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)) = """
Expand Down Expand Up @@ -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)) = """
Expand Down Expand Up @@ -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)) = """
Expand Down Expand Up @@ -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)) = """
Expand Down Expand Up @@ -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)) = """
Expand Down
10 changes: 10 additions & 0 deletions test/test_chaotic_attractors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -27,6 +30,7 @@ using SafeTestsets
ChaoticDynamicalSystemLibrary.CircadianRhythm,
ChaoticDynamicalSystemLibrary.CoevolvingPredatorPrey,
ChaoticDynamicalSystemLibrary.Colpitts,
ChaoticDynamicalSystemLibrary.Coullet,
ChaoticDynamicalSystemLibrary.Dadras,
ChaoticDynamicalSystemLibrary.DequanLi,
ChaoticDynamicalSystemLibrary.DoubleGyre,
Expand Down Expand Up @@ -70,6 +74,7 @@ using SafeTestsets
ChaoticDynamicalSystemLibrary.LorenzBounded,
ChaoticDynamicalSystemLibrary.LorenzCoupled,
ChaoticDynamicalSystemLibrary.LorenzStenflo,
ChaoticDynamicalSystemLibrary.LiuChen,
ChaoticDynamicalSystemLibrary.LuChen,
ChaoticDynamicalSystemLibrary.LuChenCheng,
ChaoticDynamicalSystemLibrary.MacArthur,
Expand All @@ -79,6 +84,7 @@ using SafeTestsets
ChaoticDynamicalSystemLibrary.NoseHoover,
ChaoticDynamicalSystemLibrary.NuclearQuadrupole,
ChaoticDynamicalSystemLibrary.OscillatingFlow,
ChaoticDynamicalSystemLibrary.PanXuZhou,
ChaoticDynamicalSystemLibrary.PehlivanWei,
ChaoticDynamicalSystemLibrary.Qi,
ChaoticDynamicalSystemLibrary.QiChen,
Expand Down Expand Up @@ -117,13 +123,17 @@ using SafeTestsets
ChaoticDynamicalSystemLibrary.SwingingAtwood,
ChaoticDynamicalSystemLibrary.Thomas,
ChaoticDynamicalSystemLibrary.Torus,
ChaoticDynamicalSystemLibrary.Tsucs2,
ChaoticDynamicalSystemLibrary.TurchinHanski,
ChaoticDynamicalSystemLibrary.VallisElNino,
ChaoticDynamicalSystemLibrary.WangSun,
ChaoticDynamicalSystemLibrary.WindmiReduced,
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)
Expand Down
7 changes: 7 additions & 0 deletions visualize_all_systems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -22,6 +25,7 @@ ALL_SYSTEMS = (ChaoticDynamicalSystemLibrary.Aizawa,
ChaoticDynamicalSystemLibrary.CircadianRhythm,
ChaoticDynamicalSystemLibrary.CoevolvingPredatorPrey,
ChaoticDynamicalSystemLibrary.Colpitts,
ChaoticDynamicalSystemLibrary.Coullet,
ChaoticDynamicalSystemLibrary.Dadras,
ChaoticDynamicalSystemLibrary.DequanLi,
ChaoticDynamicalSystemLibrary.DoubleGyre,
Expand Down Expand Up @@ -65,6 +69,7 @@ ALL_SYSTEMS = (ChaoticDynamicalSystemLibrary.Aizawa,
ChaoticDynamicalSystemLibrary.LorenzBounded,
ChaoticDynamicalSystemLibrary.LorenzCoupled,
ChaoticDynamicalSystemLibrary.LorenzStenflo,
ChaoticDynamicalSystemLibrary.LiuChen,
ChaoticDynamicalSystemLibrary.LuChen,
ChaoticDynamicalSystemLibrary.LuChenCheng,
ChaoticDynamicalSystemLibrary.MacArthur,
Expand All @@ -74,6 +79,7 @@ ALL_SYSTEMS = (ChaoticDynamicalSystemLibrary.Aizawa,
ChaoticDynamicalSystemLibrary.NoseHoover,
ChaoticDynamicalSystemLibrary.NuclearQuadrupole,
ChaoticDynamicalSystemLibrary.OscillatingFlow,
ChaoticDynamicalSystemLibrary.PanXuZhou,
ChaoticDynamicalSystemLibrary.PehlivanWei,
ChaoticDynamicalSystemLibrary.Qi,
ChaoticDynamicalSystemLibrary.QiChen,
Expand Down Expand Up @@ -112,6 +118,7 @@ ALL_SYSTEMS = (ChaoticDynamicalSystemLibrary.Aizawa,
ChaoticDynamicalSystemLibrary.SwingingAtwood,
ChaoticDynamicalSystemLibrary.Thomas,
ChaoticDynamicalSystemLibrary.Torus,
ChaoticDynamicalSystemLibrary.Tsucs2,
ChaoticDynamicalSystemLibrary.TurchinHanski,
ChaoticDynamicalSystemLibrary.VallisElNino,
ChaoticDynamicalSystemLibrary.WangSun,
Expand Down

2 comments on commit 85b84b8

@nathanaelbosch
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/97672

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" 85b84b8a1b00d02e7b9e7c6967d9b7523a8a4fee
git push origin v0.1.0

Please sign in to comment.