• Stars
    star
    391
  • Rank 109,357 (Top 3 %)
  • Language
    Jupyter Notebook
  • License
    Apache License 2.0
  • Created about 4 years ago
  • Updated 25 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

More than a hundred strange attractors

dysts

Analyze more than a hundred chaotic systems.

An embedding of all chaotic systems in the collection

Basic Usage

Import a model and run a simulation with default initial conditions and parameter values

from dysts.flows import Lorenz

model = Lorenz()
sol = model.make_trajectory(1000)
# plt.plot(sol[:, 0], sol[:, 1])

Modify a model's parameter values and re-integrate

model = Lorenz()
model.gamma = 1
model.ic = [0.1, 0.0, 5]
sol = model.make_trajectory(1000)
# plt.plot(sol[:, 0], sol[:, 1])

Load a precomputed trajectory for the model

eq = Lorenz()
sol = eq.load_trajectory(subsets="test", noise=False, granularity="fine")
# plt.plot(sol[:, 0], sol[:, 1])

Integrate new trajectories from all 135 chaotic systems with a custom granularity

from dysts.base import make_trajectory_ensemble

all_out = make_trajectory_ensemble(100, resample=True, pts_per_period=75)

Load a precomputed collection of time series from all 135 chaotic systems

from dysts.datasets import load_dataset

data = load_dataset(subsets="train", data_format="numpy", standardize=True)

Additional functionality and examples can be found in the demonstrations notebook.. The full API documentation can be found here.

Reference

For additional details, please see the preprint. If using this code for published work, please consider citing the paper.

William Gilpin. "Chaos as an interpretable benchmark for forecasting and data-driven modelling" Advances in Neural Information Processing Systems (NeurIPS) 2021 https://arxiv.org/abs/2110.05266

For the forecasting experiments, please refer to the preprint

William Gilpin. "Large-scale statistical forecasting models reassess the unpredictability of chaotic systems" 2023 https://arxiv.org/abs/2303.08011

We are very grateful for any suggestions or contributions. See CONTRIBUTING.md

Installation

Install from PyPI

pip install dysts

To obtain the latest version, including new features and bug fixes, download and install the project repository directly from GitHub

git clone https://github.com/williamgilpin/dysts
cd dysts
pip install -I . 

Test that everything is working

python -m unittest

Alternatively, to use this as a regular package without downloading the full repository, install directly from GitHub

pip install git+https://github.com/williamgilpin/dysts

The key dependencies are

  • Python 3+
  • numpy
  • scipy
  • pandas
  • sdeint (optional, but required for stochastic dynamics)
  • numba (optional, but speeds up generation of trajectories)

These additional optional dependencies are needed to reproduce some portions of this repository, such as benchmarking experiments and estimation of invariant properties of each dynamical system:

  • nolds (used for calculating the correlation dimension)
  • darts (used for forecasting benchmarks)
  • sktime (used for classification benchmarks)
  • tsfresh (used for statistical quantity extraction)
  • pytorch (used for neural network benchmarks)
  • sympy (used for equation analysis benchmarks)

Benchmarks

The benchmarks reported in our preprint can be found in benchmarks. An overview of the contents of the directory can be found in BENCHMARKS.md, while individual task areas are summarized in corresponding Jupyter Notebooks within the top level of the directory.

Contents

  • Code to generate benchmark forecasting and training experiments are included in benchmarks
  • Pre-computed time series with training and test partitions are included in data
  • The raw definitions metadata for all chaotic systems are included in the database file chaotic_attractors. The Python implementations of differential equations can be found in the flows module

Implementation Notes

  • Currently there are 131 continuous time models, including several delay diffential equations. There is also a separate module with 10 discrete maps, which is currently being expanded.
  • The right hand side of each dynamical equation is compiled using numba, wherever possible. Ensembles of trajectories are vectorized where needed.
  • Attractor names, default parameter values, references, and other metadata are stored in parseable JSON database files. Parameter values are based on standard or published values, and default initial conditions were generated by running each model until the moments of the autocorrelation function all become stationary.
  • The default integration step is stored in each continuous-time model's dt field. This integration timestep was chosen based on the highest significant frequency observed in the power spectrum, with significance being determined relative to random phase surrogates. The period field contains the timescale associated with the dominant frequency in each system's power spectrum. When using the model.make_trajectory() method with the optional setting resample=True, integration is performed at the default dt. The integrated trajectory is then resampled based on the period. The resulting trajectories will have have consistant dominant timescales across models, despite having different integration timesteps.

Acknowledgements

  • Two existing collections of named systems can be found on the webpages of JΓΌrgen Meier and J. C. Sprott. The current version of dysts contains all systems from both collections.
  • Several of the analysis routines (such as calculation of the correlation dimension) use the library nolds. If re-using the fractal dimension code that depends on nolds, please be sure to credit that library and heed its license. The Lyapunov exponent calculation is based on the QR factorization approach used by Wolf et al 1985 and Eckmann et al 1986, with implementation details adapted from conventions in the Julia library DynamicalSystems.jl

Ethics & Reporting

Dataset datasheets and metadata are reported using the dataset documentation guidelines described in Gebru et al 2018; please see our preprint for a full dataset datasheet and other information. We note that all datasets included here are mathematical in nature, and do not contain human or clinical observations. If any users become aware of unintended ethics or trademark issues that may arise due to the use of this data, we encourage reporting them by submitting an issue on this repository.

More Repositories

1

pypdb

A Python API for the RCSB Protein Data Bank (PDB)
Python
306
star
2

cphy

Class materials for computational physics course
Jupyter Notebook
139
star
3

fnn

Embed strange attractors using a regularizer for autoencoders
Jupyter Notebook
131
star
4

convoca

Predict and analyze cellular automata using convolutional neural networks
Python
79
star
5

portbalance

Determine optimal rebalancing of a passive stock portfolio.
Python
40
star
6

cfgen

Parse a text corpus and generate sentences in the same style using context-free grammar combined with a Markov chain.
Python
34
star
7

howto

How to do various tricky computer things
Python
13
star
8

shrec

Reconstructing shared causal drivers from noisy time series
Jupyter Notebook
10
star
9

flowtrace_python

Python implementation of time-resolved flow tracing.
Python
9
star
10

hspmc

Monte Carlo simulation of hard sphere packing using MATLAB
MATLAB
9
star
11

rk4

Numerically solve the Henon-Heiles problem and generate Poincare sections using a simple implementation of RK4 integration
Python
6
star
12

swimpy

Utilities for working with experimental fluid mechanics datasets
Python
5
star
13

diccor

A set of MATLAB routines for generating displacement vector fields from black and white time series of images.
MATLAB
5
star
14

fracdiff

A set of tools for simulation of fractional Brownian motion
Python
4
star
15

lagrange2d

A Mathematica package for Lagrangian analysis of fluid flows.
Mathematica
4
star
16

chaotic_ecosystem

Mathematica code for analysis of a chaotic ecosystem model
Mathematica
3
star
17

stdmap

Generation of phase space portraits illustrating the onset of chaos in the Chirikov standard map
Python
3
star
18

dysts_data

Data files for the main dysts repository
Jupyter Notebook
2
star
19

degas

Plotting utilities for matplotlib
Python
2
star
20

williamgilpin.github.io

HTML
2
star
21

alveoli

Oscillating alveoli model
Jupyter Notebook
2
star
22

flowtrace_imagej

ImageJ / Fiji implementation of time-resolved flow tracing.
2
star
23

netsim

Tools for analyzing Markov models using statistical physics and graph theory
Python
1
star
24

exrepo

An example Python repository
Python
1
star
25

kurep_paper

Code to create avalanches in a repulsive oscillator model.
Jupyter Notebook
1
star
26

flowtrace_matlab

MATLAB implementation of time-resolved flow tracing.
MATLAB
1
star
27

vergas

Simulation of a Lennard-Jones gas using Verlet integration. Calculation of autocorrelation and other descriptive statistics requiring dynamical information.
Python
1
star
28

illotka

Simulate the ill-conditioned Lotka-Volterra model
Jupyter Notebook
1
star