Getting Started¤
Installation¤
The simplest way to install attractors
is via pip:
For users who prefer modern Python packaging tools, you can also install using uv:
System Requirements¤
- Python 3.11 or higher
- Primarily the package uses 3 main dependencies:
numpy
for numerical computationnumba
for accelerated computationmatplotlib
for visualization
Note
A system must be able to compile numba
for the package to work. If any issues arise, look at the numba installation docs.
Quick Start¤
Here's a minimal example to visualize the Rossler attractor:
import matplotlib.pyplot as plt
from attractors import SolverRegistry, StaticPlotter, SystemRegistry, ThemeManager, integrate_system
# Get system and solver from registry
system = SystemRegistry.get("rossler") # Using default parameters
solver = SolverRegistry.get("rk4") # 4th order Runge-Kutta
# Generate trajectory
trajectory, time = integrate_system(system, solver, steps=1000000, dt=0.001)
# Create visualization
theme = ThemeManager.random()
plotter = StaticPlotter(system, theme)
plotter.visualize(trajectory, line_kwargs={"linewidth": 1})
plt.savefig("output.png", dpi=600)
This script will generate a visualization of the Rossler attractor using the default parameters. Once run, you should see a plot of the attractor saved in an image file as follows:
Rossler attractor
voila! You've just created your first attractor visualization! But what did we just do? For that, I recommend you to start with the user guide to understand the underlying concepts, and design principles of the package, and from there, you can not only create custom visualizations of the various systems we have with the existing solvers and themes but also create your own systems, solvers, and themes to extend the package!