Analyze hundreds of chaotic systems.
pip install dysts
See the additional installation guide for more options.
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) # (1000, 3)Modify a model's parameter values and re-integrate
model = Lorenz(parameters={"beta": 0.7, "rho": 3, "sigma": 0.1}, initial_conditions=[0.1, 0.0, 5])
sol = model.make_trajectory(1000) # (1000, 3)Integrate new trajectories from all 222 chaotic systems with a custom granularity
from dysts.systems import make_trajectory_ensemble
all_out = make_trajectory_ensemble(100, resample=True, pts_per_period=75)Additional functionality and examples can be found in the demonstrations notebook.. The full API documentation can be found here.
A database of precomputed time series from each system is hosted on HuggingFace
- Code to generate novel skew-dynamical systems is in the
skewgenbranch - Code to generate benchmark forecasting and training experiments are included in a separate benchmarks repository
- Metadata for all chaotic systems are included in the database file
chaotic_attractors. These are sourced as default parameters for the implementations of differential equations found inthe flows module - There are also metadata for the discrete maps
The benchmarks reported in our publications are stored in a separate benchmarks repository. An overview of the contents of the directory can be found in BENCHMARKS.md within that repository, while individual task areas are summarized in corresponding Jupyter Notebooks within the top level of that directory.
To obtain the latest version, including new features and bug fixes, download and install the project directly from GitHub
pip install git+https://github.com/williamgilpin/dysts
To install the optional precomputed trajectories and benchmark results (a large, static dataset), install directly from GitHub
pip install git+https://github.com/williamgilpin/dysts_data
We currently use a simple unittest framework to test the code. To run the tests, use the following command:
python -m unittest discover tests
- Currently there are 222 continuous time models. 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. 201 of the continuous-time systems also include an analytic Jacobian, which is used by the implicit integrators and by the Lyapunov exponent calculations. 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
dtfield. 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. Theperiodfield contains the timescale associated with the dominant frequency in each system's power spectrum. When using themodel.make_trajectory()method with the optional settingresample=True, integration is performed at the defaultdt. The integrated trajectory is then resampled based on theperiod. The resulting trajectories will have consistent dominant timescales across models, despite having different integration timesteps.
For more information, or if using this code for published work, please consider citing the papers.
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
William Gilpin. "Model scale versus domain knowledge in statistical forecasting of chaotic systems" Physical Review Research 2023 https://arxiv.org/abs/2303.08011
We are very grateful for any suggestions or contributions. See CONTRIBUTING.md
- Two existing collections of named systems can be found on the webpages of Jürgen Meier and J. C. Sprott. The current version of
dystscontains all systems from both collections. - Several of the analysis routines (such as calculation of the correlation dimension) use the library nolds. If re-using code that depends on
nolds, please be sure to credit that library and heed its license. Lyapunov spectra (dysts.analysis.lyapunov_spectrum) are computed by integrating the variational equations alongside each trajectory and re-orthonormalizing the tangent vectors with QR decompositions (Shimada & Nagashima 1979; Benettin et al 1980). The stored spectra are averages over several runs of 1000 periods from separate points on each attractor, with standard errors from batch means; systems with discontinuous right hand sides use finite perturbations of clone trajectories instead, and systems without an analytic Jacobian use central finite differences.
