# 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:
```bash
git clone https://github.com/beasty79/attractor_api.git
cd attractor
pip install -e .
```
## Example usage
```python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/beasty79/attractor_api",
"name": "attractor-tools",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "video, attractor, rendering, simon, multiprocessing",
"author": "Silas Schimpeler",
"author_email": "\"Silas .S\" <silasfelix2005@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/b8/05/d87099a97a06df3a839c981d03be5fe508be41a4eefa5ed6dee2db10c9c8/attractor_tools-0.1.2.tar.gz",
"platform": null,
"description": "# Attractor Tools\r\n\r\n**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.\r\n\r\n---\r\n\r\n## \u2728 Features\r\n- Animate the Simon fractal with customizable parameters\r\n- NumPy, Numba and Multiprocessing for performance\r\n\r\n---\r\n\r\n## \ud83d\udce6 Installation\r\nClone the repo and install in editable mode for development:\r\n\r\n```bash\r\ngit clone https://github.com/beasty79/attractor_api.git\r\ncd attractor\r\npip install -e .\r\n```\r\n\r\n## Example usage\r\n```python\r\nfrom attractor import sinspace, Performance_Renderer, ColorMap\r\n\r\ndef main():\r\n # array with values from lower to upper using a sinewave (p=1)\r\n # a, b are the initial values of the system used in the attractor\r\n # To animate this effectively, at least one of these parameters should change each frame\r\n a = sinspace(0.32, 0.38, 100)\r\n\r\n # Main rendering class\r\n # Use this when rendering a video with multiple frames.\r\n # For single-frame rendering, this class is overkill \u2014 use 'render_frame(...)' instead.\r\n renderer = Performance_Renderer(\r\n a=a,\r\n b=1.5,\r\n colormap=ColorMap(\"viridis\"),\r\n frames=len(a),\r\n fps=10\r\n )\r\n\r\n # Important: 'a' is an array of values, one per frame (a[i] used for frame i)\r\n # So we need to mark it as non-static to allow per-frame variation\r\n renderer.set_static(\"a\", False)\r\n\r\n # Set how many processes/threads to use (via multiprocessing.Pool)\r\n # Use None for unlimited; here we use 4 threads with a chunk size of 4\r\n renderer.start_render_process(\"./your_filename.mp4\", threads=4, chunksize=4)\r\n\r\nif __name__ == \"__main__\":\r\n # see all colormaps available\r\n print(ColorMap.colormaps())\r\n main()\r\n```\r\n\r\n# Attractor Visualization API\r\n\r\n## Overview\r\n\r\nThis package provides tools for generating and rendering dynamic attractor visualizations using customizable color maps and performance-optimized rendering techniques.\r\n\r\n\r\n## API\r\n- **render_frame**\r\n Core function to compute attractor frame data.\r\n\r\n- **Performance_Renderer**\r\n High-performance renderer supporting multi-threaded frame generation and video output.\r\n\r\n## Utility Functions\r\n\r\n- **ColorMap**\r\n Utility class to create and manage color maps with optional inversion.\r\n\r\n- **sinspace / cosspace**\r\n Generate smooth sine- or cosine-shaped value sequences over a specified range.\r\n\r\n- **bpmspace**\r\n Create time-based sequences synced to beats per minute (BPM) for rhythmic animations.\r\n\r\n- **map_area**\r\n Batch process and render attractor animations over a grid of parameters.\r\n\r\n- **apply_colormap**\r\n Apply a color map to attractor data to produce a colored image.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An API to animate the Simon fractal",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/beasty79/attractor_api"
},
"split_keywords": [
"video",
" attractor",
" rendering",
" simon",
" multiprocessing"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "128b68c6551826b39c1a6898150df4bfd4a9b6088fa700d1a97f8ce5e1490150",
"md5": "00ab03918391bcb4d5d6711105fb8caf",
"sha256": "30ce3c736aaf9cc336f2b9104e7a62a3d101cf3909add2a43b3266dc628ea61f"
},
"downloads": -1,
"filename": "attractor_tools-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "00ab03918391bcb4d5d6711105fb8caf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 10330,
"upload_time": "2025-08-03T20:20:33",
"upload_time_iso_8601": "2025-08-03T20:20:33.949260Z",
"url": "https://files.pythonhosted.org/packages/12/8b/68c6551826b39c1a6898150df4bfd4a9b6088fa700d1a97f8ce5e1490150/attractor_tools-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b805d87099a97a06df3a839c981d03be5fe508be41a4eefa5ed6dee2db10c9c8",
"md5": "a18aa99ac381968bd4df92d7870ea5ce",
"sha256": "7160c165045631a80b545509690aa1a644c5f32dd9efe28487cdc14e10b128d5"
},
"downloads": -1,
"filename": "attractor_tools-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "a18aa99ac381968bd4df92d7870ea5ce",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 10591,
"upload_time": "2025-08-03T20:20:34",
"upload_time_iso_8601": "2025-08-03T20:20:34.728173Z",
"url": "https://files.pythonhosted.org/packages/b8/05/d87099a97a06df3a839c981d03be5fe508be41a4eefa5ed6dee2db10c9c8/attractor_tools-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-03 20:20:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "beasty79",
"github_project": "attractor_api",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "attractor-tools"
}