An API to animate the Simon fractal
Project description
Attractor Tools
Attractor-tools is a Python module for animating the Simon fractal using efficient rendering. It provides a clean API to generate frames, assinging colormaps, and export visualizations as videos.
✨ Features
- Animate the Simon fractal with customizable parameters
- NumPy, Numba and Multiprocessing for performance
📦 Installation
Clone the repo and install in editable mode for development:
git clone https://github.com/beasty79/attractor_api.git
cd attractor
pip install -e .
Example usage
from attractor import sinspace, Performance_Renderer, ColorMap
def main():
# array with values from lower to upper using a sinewave (p=1)
# a, b are the initial values of the system used in the attractor
# To animate this effectively, at least one of these parameters should change each frame
a = sinspace(0.32, 0.38, 100)
# Main rendering class
# Use this when rendering a video with multiple frames.
# For single-frame rendering, this class is overkill — use 'render_frame(...)' instead.
renderer = Performance_Renderer(
a=a,
b=1.5,
colormap=ColorMap("viridis"),
frames=len(a),
fps=10
)
# Important: 'a' is an array of values, one per frame (a[i] used for frame i)
# So we need to mark it as non-static to allow per-frame variation
renderer.set_static("a", False)
# Set how many processes/threads to use (via multiprocessing.Pool)
# Use None for unlimited; here we use 4 threads with a chunk size of 4
renderer.start_render_process("./your_filename.mp4", threads=4, chunksize=4)
if __name__ == "__main__":
# see all colormaps available
print(ColorMap.colormaps())
main()
Attractor Visualization API
Overview
This package provides tools for generating and rendering dynamic attractor visualizations using customizable color maps and performance-optimized rendering techniques.
API
-
render_frame Core function to compute attractor frame data.
-
Performance_Renderer High-performance renderer supporting multi-threaded frame generation and video output.
Utility Functions
-
ColorMap Utility class to create and manage color maps with optional inversion.
-
sinspace / cosspace Generate smooth sine- or cosine-shaped value sequences over a specified range.
-
bpmspace Create time-based sequences synced to beats per minute (BPM) for rhythmic animations.
-
map_area Batch process and render attractor animations over a grid of parameters.
-
apply_colormap Apply a color map to attractor data to produce a colored image.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file attractor_tools-0.2.0.tar.gz.
File metadata
- Download URL: attractor_tools-0.2.0.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78a7d7d218ca24f972ceb1650bd9c71003a6db73a2f3b9ae9344ae37298d136e
|
|
| MD5 |
6130000598da2835b571ee304297a427
|
|
| BLAKE2b-256 |
59b71cb15e8a2d0340033c57044ea85490a95c96a133a5a18e0c30c5b427d6f0
|
File details
Details for the file attractor_tools-0.2.0-py3-none-any.whl.
File metadata
- Download URL: attractor_tools-0.2.0-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96f9a6a6c9c68b1204a5218591e719e03a0bae0ba15932cffe7d52b9e4932ab1
|
|
| MD5 |
3a8a4ee05d6d3a4f32960d4b01cf2888
|
|
| BLAKE2b-256 |
7b941769e669688f87ea8ad4c81d5ded27cf0a7270b86ef172b966d98b643b6e
|