-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made all simulation submodules public and added some docstrings.
- Loading branch information
1 parent
8eba075
commit 3f4d67a
Showing
8 changed files
with
79 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 10 additions & 1 deletion
11
src/lorenzpy/simulations/_discrete_maps.py → src/lorenzpy/simulations/discrete_maps.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
"""Discrete maps.""" | ||
import numpy as np | ||
|
||
from ._base import _BaseSimIterate | ||
from .base import _BaseSimIterate | ||
|
||
|
||
class Logistic(_BaseSimIterate): | ||
"""Simulation class for the Logistic map.""" | ||
|
||
def __init__(self, r: float = 4.0) -> None: | ||
"""Initialize the Logistic Map simulation object. | ||
Args: | ||
r: r parameter of the logistic map. | ||
""" | ||
self.r = r | ||
|
||
def iterate(self, x: np.ndarray) -> np.ndarray: | ||
"""Iterate the logistic map one step.""" | ||
return np.array( | ||
[ | ||
self.r * x[0] * (1 - x[0]), | ||
] | ||
) | ||
|
||
def get_default_starting_pnt(self) -> np.ndarray: | ||
"""Return default starting point of the Logistic map.""" | ||
return np.array([0.1]) |
11 changes: 10 additions & 1 deletion
11
src/lorenzpy/simulations/_driven_systems.py → src/lorenzpy/simulations/driven_systems.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
"""Driven Systems.""" | ||
import numpy as np | ||
|
||
from ._base import _BaseSimFlowDriven | ||
from .base import _BaseSimFlowDriven | ||
|
||
|
||
class SimplestDrivenChaotic(_BaseSimFlowDriven): | ||
"""Simulate the Simplest Driven Chaotic system from Sprott. | ||
Taken from (Sprott, Julien Clinton, and Julien C. Sprott. Chaos and time-series | ||
analysis. Vol. 69. Oxford: Oxford university press, 2003.) | ||
""" | ||
|
||
def __init__(self, omega: float = 1.88, dt: float = 0.1, solver="rk4") -> None: | ||
"""Initialize the SimplestDrivenChaotic simulation object.""" | ||
super().__init__(dt, solver) | ||
self.omega = omega | ||
|
||
def flow(self, x: np.ndarray) -> np.ndarray: | ||
"""Return the flow .""" | ||
return np.array([x[1], -(x[0] ** 3) + np.sin(self.omega * x[2]), 1]) | ||
|
||
def get_default_starting_pnt(self) -> np.ndarray: | ||
"""Return default starting point.""" | ||
return np.array([0.0, 0.0, 0.0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters