Skip to main content

A package for dynamical systems analysis

Project description

dynlab

Dynlab is a python package to make dynamical systems analysis faster and easier, by providing practitioners prebuilt modules for calculating common diagnostics. Dynlab currently offers several easy to use diagnostics for analyzing your dynamical systems including an FTLE calculator FLTE, an attraction and repulsion rate calculator AttractionRate, and a trajectory repulsion rate calculator TrajectoryRepulsionRate. Dynlab also offers users a variety of prewritten flows to experiment and play around with, including the double gyre double_gyre, the Duffing oscillator duffing_oscillator, the pendulum with damping and forcing pendulum, the Van Der Pol oscillator van_der_pol_oscillator, the Lotka-Voltera flow lotka_volterra, the Lorenz system lorenz, and many more. Note that all the flows are written in such a way that they can easily be passed to an ode integrator and as such even the autonomous flows will still require a time parameter to be passed to them.

Currently supported Lagrangian diagnostics are:
Finite-Time Lyapunov Exponent: FTLE
Lagrangian Coherent Structures: LCS

Currently supported Eulerian diagnostics are:
Attraction Rate: AttractionRate
Repulsion Rate: RepulsionRate
infinitesimal Lyapunov ExponentS: iLES
Trajectory Repulsion Rate: TrajectoryRepulsionRate
Trajectory Repulsion Ratio: TrajectoryRepulsionRatio

This package is readily available on pypi and can be easily installed with the command pip install dynlab. Note that dynlab is written with python 3.11 and you may need to update your python installation to take advantage of it.

Example

import matplotlib.pyplot as plt
from dynlab.diagnostics import FTLE
from dynlab.flows import double_gyre
x = np.linspace(0, 2, 101)
y = np.linspace(0, 1, 101)
ftle = FTLE(num_threads=1).compute(x, y, double_gyre, (10, 0), edge_order=2, rtol=1e-8, atol=1e-8)
plt.pcolormesh(x, y, ftle, shading='gouraud')

alt text

import matplotlib.pyplot as plt
from dynlab.diagnostics import LCS
from dynlab.flows import double_gyre
x = np.linspace(0, 2, 201)
y = np.linspace(0, 1, 101)
lcs = LCS()
attracting_lcs = lcs.compute(x, y, f=double_gyre, t=(10, 0), percentile=80)
for line in attracting_lcs:
    plt.plot(line[:, 0],line[:, 1], 'b')

alt text

import matplotlib.pyplot as plt
from dynlab.diagnostics import iLES
from dynlab.flows import double_gyre
x = np.linspace(0, 2, 201)
y = np.linspace(0, 1, 101)
attracting_iles = iLES().compute(x, y, f=double_gyre, t=0, kind='attracting', force_eigenvectors=True)
repelling_iles = iLES().compute(x, y, f=double_gyre, t=0, kind='repelling', force_eigenvectors=True)

xx, yy = np.meshgrid(x[::10],y[::10])
u, v = double_gyre(0, (xx, yy))
plt.quiver(xx,yy,u,v)
for line in attracting_iles:
    plt.plot(line[:, 0],line[:, 1], 'b', linewidth=3)
for line in repelling_iles:
    plt.plot(line[:, 0],line[:, 1], 'r', linewidth=3)

alt text

import matplotlib.pyplot as plt
from dynlab.diagnostics import AttractionRate
from dynlab.flows import double_gyre
x = np.linspace(0, 20000, 101)
y = np.linspace(-4000, 4000, 101)
u, v = bickley_jet(0, np.meshgrid(x, y))
attraction_rate = AttractionRate().compute(x, y, u=u, v=v, edge_order=2)
# note that lower values of the attraction rate field equate to higher levels of attraction
# so we'll plot the negative of the attraction rate field to highlight areas of greatest attraction.
plt.pcolormesh(x, y, -attraction_rate, shading='gouraud')

alt text

import matplotlib.pyplot as plt
from dynlab.diagnostics import Rhodot
from dynlab.flows import bead_on_a_rotating_hoop
x = np.linspace(-1, 1, 401)*3
y = np.linspace(-1, 1, 401)*2.5
rhodot, nudot = TrajectoryRepulsionRate().compute(x, y, f=bead_on_a_rotating_hoop, t=0, edge_order=2)
plt.pcolormesh(x, y, rhodot, shading='gouraud')

alt text

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dynlab-0.1.0.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dynlab-0.1.0-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file dynlab-0.1.0.tar.gz.

File metadata

  • Download URL: dynlab-0.1.0.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for dynlab-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d7310ec408dc0ab9c6e5234d122472fbed041b4951215783db61bc1af31bfccb
MD5 d5815c716fd7ade0cbf3700e4b91a528
BLAKE2b-256 579ac2532af4a69c3c85bfff537d48b28923aff8247a8a475aaae17b17f63806

See more details on using hashes here.

File details

Details for the file dynlab-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dynlab-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for dynlab-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 972c0e897e5dbcf6db3002370aaaaca155bddcdbb987c1997fcbd1cbe80ed9a9
MD5 243d0b93e2bd9a3e7161b453e5322851
BLAKE2b-256 6095144bd5d0724d5a132acd73bf801cb85033f6bb013c6400f9e5446c069904

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page