Reference
LorenzPy package:
Python package to simulate and Measure chaotic time series.
Modules exported by this package:
simulations
: Simulate various discrete and continuous chaotic dynamical systems.measures
: Measures for the chaotic dynamical systems.
simulations module:
Simulate various continuous and discrete chaotic dynamical system.
Every dynamical system is represented as a class.
The available classes are: - Lorenz63 - MackeyGlass
The system's parameters are introduced in the class's constructor.
For example when creating a system object of the Lorenz63, the Lorenz parameters, sigma, rho, beta, and the timestep dt are parsed as:
sys_obj = Lorenz63(sigma=10, rho=10, beta=5, dt=1)
Each sys_obj contains a "simulate" function. To simulate 1000 time-steps of the Lorenz63 system call:
sys_obj.simulate(1000).
The general syntax to create a trajectory of a System is given as:
trajectory =
Examples:
>>> import lorenzpy.simulations as sims
>>> data = sims.Lorenz63().simulate(1000)
>>> data.shape
(1000, 3)
Chen
Bases: _BaseSimFlow
Simulation class for the Chen system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
__init__(a=35.0, b=3.0, c=28.0, dt=0.02, solver='rk4')
Initialize the Chen simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a |
float
|
a parameter of Chen equation. |
35.0
|
b |
float
|
b parameter of Chen equation. |
3.0
|
c |
float
|
c parameter of Chen equation. |
28.0
|
dt |
float
|
Time step to simulate. |
0.02
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. |
'rk4'
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
flow(x)
Return the flow of Chen equation.
Source code in src\lorenzpy\simulations\autonomous_flows.py
147 148 149 150 151 152 153 154 155 |
|
get_default_starting_pnt()
Return default starting point of Chen system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
157 158 159 |
|
ChuaCircuit
Bases: _BaseSimFlow
Simulation class for the ChuaCircuit system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
__init__(alpha=9.0, beta=100 / 7, a=8 / 7, b=5 / 7, dt=0.1, solver='rk4')
Initialize the ChuaCircuit simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
alpha |
float
|
alpha parameter of ChuaCircuit equation. |
9.0
|
beta |
float
|
beta parameter of ChuaCircuit equation. |
100 / 7
|
a |
float
|
a parameter of ChuaCircuit equation. |
8 / 7
|
b |
float
|
b parameter of ChuaCircuit equation. |
5 / 7
|
dt |
float
|
Time step to simulate. |
0.1
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. |
'rk4'
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
flow(x)
Return the flow of ChuaCircuit equation.
Source code in src\lorenzpy\simulations\autonomous_flows.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
get_default_starting_pnt()
Return default starting point of ChuaCircuit system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
206 207 208 |
|
ComplexButterfly
Bases: _BaseSimFlow
Simulation class for the ComplexButterfly system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
__init__(a=0.55, dt=0.1, solver='rk4')
Initialize the ComplexButterfly simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a |
float
|
a parameter of ComplexButterfly equation. |
0.55
|
dt |
float
|
Time step to simulate. |
0.1
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. |
'rk4'
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
flow(x)
Return the flow of ComplexButterfly equation.
Source code in src\lorenzpy\simulations\autonomous_flows.py
111 112 113 114 115 |
|
get_default_starting_pnt()
Return default starting point of ComplexButterfly system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
117 118 119 |
|
DoublePendulum
Bases: _BaseSimFlow
Simulation class for the dimensionless double pendulum with m1 = m2 and l1=l2.
The state space is given by [angle1, angle2, angular_vel, angular_vel2].
Source code in src\lorenzpy\simulations\autonomous_flows.py
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
|
__init__(dt=0.1, solver=create_scipy_ivp_solver('DOP853'))
Initialize the Doueble Pendulum simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dt |
float
|
Time step to simulate. |
0.1
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. Default is DOP853 scipy solver here. |
create_scipy_ivp_solver('DOP853')
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
|
flow(x)
Return the flow of double pendulum.
Source code in src\lorenzpy\simulations\autonomous_flows.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
|
get_default_starting_pnt()
Return default starting point of Double Pendulum.
Source code in src\lorenzpy\simulations\autonomous_flows.py
420 421 422 |
|
DoubleScroll
Bases: _BaseSimFlow
Simulation class for the DoubleScroll system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
__init__(a=0.8, dt=0.3, solver='rk4')
Initialize the DoubleScroll simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a |
float
|
a parameter of DoubleScroll equation. |
0.8
|
dt |
float
|
Time step to simulate. |
0.3
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. |
'rk4'
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
|
flow(x)
Return the flow of DoubleScroll equation.
Source code in src\lorenzpy\simulations\autonomous_flows.py
366 367 368 |
|
get_default_starting_pnt()
Return default starting point of DoubleScroll system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
370 371 372 |
|
Halvorsen
Bases: _BaseSimFlow
Simulation class for the Halvorsen system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
__init__(a=1.27, dt=0.05, solver='rk4')
Initialize the Halvorsen simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a |
float
|
a parameter of Halvorsen equation. |
1.27
|
dt |
float
|
Time step to simulate. |
0.05
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. |
'rk4'
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
flow(x)
Return the flow of Halvorsen equation.
Source code in src\lorenzpy\simulations\autonomous_flows.py
332 333 334 335 336 337 338 339 340 |
|
get_default_starting_pnt()
Return default starting point of Halvorsen system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
342 343 344 |
|
Henon
Bases: _BaseSimIterate
Simulate the 2-dimensional dissipative map: Henon map.
Source code in src\lorenzpy\simulations\discrete_maps.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
__init__(a=1.4, b=0.3)
Initialize the Logistic Map simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a |
float
|
a parameter of the Henon map. |
1.4
|
b |
float
|
b parameter of the Henon map. |
0.3
|
Source code in src\lorenzpy\simulations\discrete_maps.py
36 37 38 39 40 41 42 43 44 |
|
get_default_starting_pnt()
Return default starting point of the Henon map.
Source code in src\lorenzpy\simulations\discrete_maps.py
50 51 52 |
|
iterate(x)
Iterate the Henon map one step.
Source code in src\lorenzpy\simulations\discrete_maps.py
46 47 48 |
|
KuramotoSivashinsky
Bases: _BaseSimIterate
Simulate the n-dimensional Kuramoto-Sivashinsky PDE.
Note: dimension must be an even number.
PDE: y_t = -yy_x - (1+eps)y_xx - y_xxxx.
Reference for the numerical integration: "fourth order time stepping for stiff pde-kassam trefethen 2005" at https://people.maths.ox.ac.uk/trefethen/publication/PDF/2005_111.pdf
Python implementation at: https://github.com/E-Renshaw/kuramoto-sivashinsky
Literature values (doi:10.1017/S1446181119000105) for Lyapunov Exponents: - lyapunov exponents: (0.080, 0.056, 0.014, 0.003, -0.003 ...) They refer to: - Parameters: {"sys_length": 36.0, "eps": 0.0}
Source code in src\lorenzpy\simulations\others.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
__init__(sys_dim=50, sys_length=36.0, eps=0.0, dt=0.1)
Initialize the Kuramoto-Sivashinsky simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sys_dim |
int
|
The dimension of the system. |
50
|
sys_length |
float
|
The physical length of the system. |
36.0
|
eps |
float
|
A parameter in front of the y_xx term. |
0.0
|
dt |
float
|
Time step to simulate. |
0.1
|
Source code in src\lorenzpy\simulations\others.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
get_default_starting_pnt()
Return default starting point of KS system.
Source code in src\lorenzpy\simulations\others.py
118 119 120 121 122 123 124 125 126 127 128 |
|
iterate(x)
Calculate next timestep x(t+1) with given x(t).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ndarray
|
(x_0(i),x_1(i),..) coordinates. Needs to have shape (self.sys_dim,). |
required |
Returns:
Type | Description |
---|---|
ndarray
|
(x_0(i+1),x_1(i+1),..) corresponding to input x. |
Source code in src\lorenzpy\simulations\others.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
Logistic
Bases: _BaseSimIterate
Simulation class for the Logistic map.
Source code in src\lorenzpy\simulations\discrete_maps.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
__init__(r=4.0)
Initialize the Logistic Map simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
r |
float
|
r parameter of the logistic map. |
4.0
|
Source code in src\lorenzpy\simulations\discrete_maps.py
12 13 14 15 16 17 18 |
|
get_default_starting_pnt()
Return default starting point of the Logistic map.
Source code in src\lorenzpy\simulations\discrete_maps.py
28 29 30 |
|
iterate(x)
Iterate the logistic map one step.
Source code in src\lorenzpy\simulations\discrete_maps.py
20 21 22 23 24 25 26 |
|
Lorenz63
Bases: _BaseSimFlow
Simulation class for the Lorenz63 system.
This function is able to simulate the chaotic dynamical system originally introduced by Lorenz.
Source code in src\lorenzpy\simulations\autonomous_flows.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
__init__(sigma=10.0, rho=28.0, beta=8 / 3, dt=0.03, solver='rk4')
Initialize the Lorenz63 simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sigma |
float
|
Sigma parameter of Lorenz63 equation. |
10.0
|
rho |
float
|
Rho parameter of Lorenz63 equation. |
28.0
|
beta |
float
|
beta parameter of Lorenz63 equation. |
8 / 3
|
dt |
float
|
Time step to simulate. |
0.03
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. |
'rk4'
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
flow(x)
Return the flow of Lorenz63 equation.
Source code in src\lorenzpy\simulations\autonomous_flows.py
41 42 43 44 45 46 47 48 49 |
|
get_default_starting_pnt()
Return default starting point of Lorenz63 system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
51 52 53 |
|
Lorenz96
Bases: _BaseSimFlow
Simulate the n-dimensional Lorenz 96 model.
Source code in src\lorenzpy\simulations\autonomous_flows.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
|
__init__(sys_dim=30, force=8.0, dt=0.05, solver='rk4')
Initialize the Lorenz96 simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sys_dim |
int
|
The dimension of the Lorenz96 system. |
30
|
force |
float
|
The force value. |
8.0
|
dt |
float
|
Time step to simulate. |
0.05
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. |
'rk4'
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
|
flow(x)
Return the flow of Lorenz96 equation.
Source code in src\lorenzpy\simulations\autonomous_flows.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
|
get_default_starting_pnt()
Return default starting point of Lorenz96 system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
467 468 469 |
|
MackeyGlass
Bases: _BaseSim
Simulate the Mackey-Glass delay differential system.
TODO: Add literature values for Lyapunov etc. TODO: Hint the differences between this class and the other Sim classes (delay). TODO: Check if the structure is really good? TODO: Add Proper Tests. TODO: Decide whether to use the simple forward-euler or RK4-style update.
Note: As the Mackey-Glass system is a delay-differential equation, the class does not contain a simple iterate function.
Source code in src\lorenzpy\simulations\others.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|
__init__(a=0.2, b=0.1, c=10, tau=23.0, dt=0.1, solver='rk4')
Initialize the Mackey-Glass simulation object.
Source code in src\lorenzpy\simulations\others.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
flow_mg(x, x_past)
Calculate the flow of the Mackey-Glass equation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ndarray
|
The immediate value of the system. Needs to have shape (1,). |
required |
x_past |
ndarray
|
The delayed value of the system. Needs to have shape (1,). |
required |
Returns:
Type | Description |
---|---|
ndarray
|
The flow corresponding to x and x_past. |
Source code in src\lorenzpy\simulations\others.py
168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
get_default_starting_pnt()
Return default starting point of MG system.
Source code in src\lorenzpy\simulations\others.py
164 165 166 |
|
iterate_mg(x, x_past)
Calculate the next time step in the Mackey-Glass equation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ndarray
|
The immediate value of the system. Needs to have shape (1,). |
required |
x_past |
ndarray
|
The delayed value of the system. Needs to have shape (1,). |
required |
Returns:
Type | Description |
---|---|
ndarray
|
The next value given the immediate and delayed values. |
Source code in src\lorenzpy\simulations\others.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
|
simulate(time_steps, starting_point=None, transient=0)
Simulate the Mackey-Glass trajectory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time_steps |
int
|
Number of time steps t to simulate. |
required |
starting_point |
ndarray | None
|
Starting point of the trajectory shape (sys_dim,). If None, take the default starting point. |
None
|
transient |
int
|
Washout before storing the trajectory. |
0
|
Returns:
Type | Description |
---|---|
ndarray
|
Trajectory of shape (t, sys_dim). |
Source code in src\lorenzpy\simulations\others.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|
Roessler
Bases: _BaseSimFlow
Simulation class for the Roessler system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
__init__(a=0.2, b=0.2, c=5.7, dt=0.1, solver='rk4')
Initialize the Roessler simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a |
float
|
a parameter of Roessler equation. |
0.2
|
b |
float
|
b parameter of Roessler equation. |
0.2
|
c |
float
|
c parameter of Roessler equation. |
5.7
|
dt |
float
|
Time step to simulate. |
0.1
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. |
'rk4'
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
flow(x)
Return the flow of Roessler equation.
Source code in src\lorenzpy\simulations\autonomous_flows.py
81 82 83 84 85 |
|
get_default_starting_pnt()
Return default starting point of Roessler system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
87 88 89 |
|
Rucklidge
Bases: _BaseSimFlow
Simulation class for the Rucklidge system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
__init__(kappa=2.0, lam=6.7, dt=0.1, solver='rk4')
Initialize the Rucklidge simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kappa |
float
|
kappa parameter of Rucklidge equation. |
2.0
|
lam |
float
|
lambda parameter of Rucklidge equation. |
6.7
|
dt |
float
|
Time step to simulate. |
0.1
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. |
'rk4'
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
|
flow(x)
Return the flow of Rucklidge equation.
Source code in src\lorenzpy\simulations\autonomous_flows.py
298 299 300 301 302 303 304 305 306 |
|
get_default_starting_pnt()
Return default starting point of Rucklidge system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
308 309 310 |
|
SimplestDrivenChaotic
Bases: _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.)
Source code in src\lorenzpy\simulations\driven_systems.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
__init__(omega=1.88, dt=0.1, solver='rk4')
Initialize the SimplestDrivenChaotic simulation object.
Source code in src\lorenzpy\simulations\driven_systems.py
16 17 18 19 |
|
flow(x)
Return the flow .
Source code in src\lorenzpy\simulations\driven_systems.py
21 22 23 |
|
get_default_starting_pnt()
Return default starting point.
Source code in src\lorenzpy\simulations\driven_systems.py
25 26 27 |
|
Thomas
Bases: _BaseSimFlow
Simulation class for the Thomas system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
__init__(b=0.18, dt=0.3, solver='rk4')
Initialize the Thomas simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
b |
float
|
b parameter of Thomas equation. |
0.18
|
dt |
float
|
Time step to simulate. |
0.3
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. |
'rk4'
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
|
flow(x)
Return the flow of Thomas equation.
Source code in src\lorenzpy\simulations\autonomous_flows.py
230 231 232 233 234 235 236 237 238 |
|
get_default_starting_pnt()
Return default starting point of Thomas system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
240 241 242 |
|
WindmiAttractor
Bases: _BaseSimFlow
Simulation class for the WindmiAttractor system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
|
__init__(a=0.7, b=2.5, dt=0.2, solver='rk4')
Initialize the WindmiAttractor simulation object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a |
float
|
a parameter of WindmiAttractor equation. |
0.7
|
b |
float
|
b parameter of WindmiAttractor equation. |
2.5
|
dt |
float
|
Time step to simulate. |
0.2
|
solver |
str | str | Callable[[Callable, float, ndarray], ndarray]
|
The solver. |
'rk4'
|
Source code in src\lorenzpy\simulations\autonomous_flows.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
|
flow(x)
Return the flow of WindmiAttractor equation.
Source code in src\lorenzpy\simulations\autonomous_flows.py
267 268 269 |
|
get_default_starting_pnt()
Return default starting point of WindmiAttractor system.
Source code in src\lorenzpy\simulations\autonomous_flows.py
271 272 273 |
|
The solvers used to solve the flow equation.
create_scipy_ivp_solver(method='RK45', **additional_solve_ivp_args)
Create a scipy solver for initializing flow systems.
This function creates a scipy solver that can be used to initialize flow simulation classes. It wraps the scipy.integrate.solve_ivp function.
The scipy solvers often internally integrate more than 1 time step in the
range 0 to dt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method |
str
|
The integration method to use, e.g., 'RK45', 'RK23', 'DOP853', 'Radau', 'BDF', or 'LSODA'. See the documentation for scipy.integrate.solve_ivp for more information. |
'RK45'
|
**additional_solve_ivp_args |
Additional arguments passed to
scipy.integrate.solve_ivp as |
{}
|
Returns:
Type | Description |
---|---|
Callable[[Callable, float, ndarray], ndarray]
|
Callable[[Callable[[np.ndarray], np.ndarray], float, np.ndarray], np.ndarray]: |
Callable[[Callable, float, ndarray], ndarray]
|
A solver function that takes three arguments: |
Callable[[Callable, float, ndarray], ndarray]
|
|
Callable[[Callable, float, ndarray], ndarray]
|
|
Callable[[Callable, float, ndarray], ndarray]
|
|
Callable[[Callable, float, ndarray], ndarray]
|
The solver returns the integrated state at the end of the time step. |
Source code in src\lorenzpy\simulations\solvers.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
forward_euler(f, dt, x)
Simulate one step for ODEs of the form dx/dt = f(x(t)) using the forward euler.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f |
Callable[[ndarray], ndarray]
|
function used to calculate the time derivative at point x. |
required |
dt |
float
|
time step size. |
required |
x |
ndarray
|
d-dim position at time t. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
d-dim position at time t+dt. |
Source code in src\lorenzpy\simulations\solvers.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
runge_kutta_4(f, dt, x)
Simulate one step for ODEs of the form dx/dt = f(x(t)) using Runge-Kutta.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f |
Callable[[ndarray], ndarray]
|
function used to calculate the time derivative at point x. |
required |
dt |
float
|
time step size. |
required |
x |
ndarray
|
d-dim position at time t. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
d-dim position at time t+dt. |
Source code in src\lorenzpy\simulations\solvers.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
timestep_iterator(f, time_steps, starting_point)
Iterate an iterator-function f: x(i+1) = f(x(i)) multiple times.
Source code in src\lorenzpy\simulations\solvers.py
105 106 107 108 109 110 111 112 113 114 115 |
|
measures module:
Measures for chaotic dynamical systems.
largest_lyapunov_exponent(iterator_func, starting_point, deviation_scale=1e-10, steps=int(1000.0), part_time_steps=15, steps_skip=50, dt=1.0, initial_pert_direction=None, return_convergence=False)
Numerically calculate the largest lyapunov exponent given an iterator function.
See: Sprott, Julien Clinton, and Julien C. Sprott. Chaos and time-series analysis. Vol. 69. Oxford: Oxford university press, 2003.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iterator_func |
Callable[[ndarray], ndarray]
|
Function to iterate the system to the next time step: x(i+1) = F(x(i)) |
required |
starting_point |
ndarray
|
The starting_point of the main trajectory. |
required |
deviation_scale |
float
|
The L2-norm of the initial perturbation. |
1e-10
|
steps |
int
|
Number of renormalization steps. |
int(1000.0)
|
part_time_steps |
int
|
Time steps between renormalization steps. |
15
|
steps_skip |
int
|
Number of renormalization steps to perform, before tracking the log divergence. Avoid transients by using steps_skip. |
50
|
dt |
float
|
Size of time step. |
1.0
|
initial_pert_direction |
ndarray | None
|
|
None
|
return_convergence |
bool
|
If True, return the convergence of the largest LE; a numpy array of the shape (N, ). |
False
|
Returns:
Type | Description |
---|---|
float | ndarray
|
The largest Lyapunov Exponent. If return_convergence is True: The convergence |
float | ndarray
|
(np.ndarray), else just the float value, which is the last value in the |
float | ndarray
|
convergence. |
Source code in src\lorenzpy\measures.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
lyapunov_exponent_spectrum(iterator_func, starting_point, deviation_scale=1e-10, steps=int(1000.0), part_time_steps=15, steps_skip=50, dt=1.0, m=None, initial_pert_directions=None, return_convergence=False)
Calculate the spectrum of m largest lyapunov exponent given an iterator function.
A mixture of: - The algorithm for the largest lyapunov exponent: Sprott, Julien Clinton, and Julien C. Sprott. Chaos and time-series analysis. Vol. 69. Oxford: Oxford university press, 2003. - The algorithm for the spectrum given in 1902.09651 "LYAPUNOV EXPONENTS of the KURAMOTO-SIVASHINSKY PDE".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iterator_func |
Callable[[ndarray], ndarray]
|
Function to iterate the system to the next time step: x(i+1) = F(x(i)) |
required |
starting_point |
ndarray
|
The starting_point of the main trajectory. |
required |
deviation_scale |
float
|
The L2-norm of the initial perturbation. |
1e-10
|
steps |
int
|
Number of renormalization steps. |
int(1000.0)
|
part_time_steps |
int
|
Time steps between renormalization steps. |
15
|
steps_skip |
int
|
Number of renormalization steps to perform, before tracking the log divergence. Avoid transients by using steps_skip. |
50
|
dt |
float
|
Size of time step. |
1.0
|
m |
int | None
|
Number of Lyapunov exponents to compute. If None: take all (m = x_dim). |
None
|
initial_pert_directions |
ndarray | None
|
|
None
|
return_convergence |
bool
|
If True, return the convergence of the largest LE; a numpy array of the shape (N, m). |
False
|
Returns:
Name | Type | Description |
---|---|---|
ndarray
|
The Lyapunov exponent spectrum of largest m values. If return_convergence is |
|
True |
ndarray
|
The convergence (2D N x m np.ndarray), else a (1D m-size np.ndarray), |
ndarray
|
which holds the last values in the convergence. |
Source code in src\lorenzpy\measures.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|