Skip to main content

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
  • Automate Parameters using interpolation between a set of points

Example:

alt text

📦 Installation

pip install attractor-tools

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()

Automations

def keyframe_example():
    # generic animation option (20 frames)
    opts = Option.from_time(
        seconds=4,
        fps=5
    )

    # KeyframeInterpolator is similar to linspace, sinspace, sqaurespace, ...
    # The difference you can define a set of point: point(value, frame)
    # between this points linspace is used to interpolate between those
    interpolation = KeyframeInterpolator(opts, 0.32, 0.32)
    interpolation.add_keyframe(Point(frame=5, value=0.4))
    interpolation.add_keyframe(Point(frame=10, value=0.4))
    interpolation.add_keyframe(Point(frame=15, value=0.32))

    a = interpolation.to_array()

    renderer = Performance_Renderer(
        opts=opts,
        a=a,
        b=1.5,
        iterations=3_000_000
    )
    renderer.set_static("a", False)
    renderer.show_demo(nth_frame=1)

Generic mp4

def generic_example():
    opts = Option.from_time(
        seconds=4,
        fps=5
    )

    renderer = Performance_Renderer(
        opts=opts,
        a=0.35,
        b=1.5,
        iterations=3_000_000
    )  
    # Set generic flag to save image in grayscale
    renderer.start_render_process("demo.mp4", save_as_generic=True)

    # after rendering you can apply a colormap (still takes some time)
    # make sure to use the same fps and frames as the rendering
    color_generic("demo.mp4", ColorMap("viridis"), opts.fps, frames=opts.frames)

Metadata

Release files for attractor-tools 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for attractor-tools 0.3.0
File Size Uploaded Provenance Actions
attractor_tools-0.3.0.tar.gz 25.5 kB Without provenance Details for attractor_tools-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for attractor-tools 0.3.0
File Interpreter ABI Platform Actions
attractor_tools-0.3.0-py3-none-any.whl Python 3 none any Details for attractor_tools-0.3.0-py3-none-any.whl

Total release size: 54.8 kB

Release files / attractor_tools-0.3.0.tar.gz

Download URL attractor_tools-0.3.0.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f43eca2ea75b92ff9f2546f40a15f262b2359b16695563954c473130105d5e8a
BLAKE2b-256 checksum
How to use checksums
ec0d4340699e92b5bc4f8a3195a4110b9b5215205dad97a0d5c490367f2bc32d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / attractor_tools-0.3.0-py3-none-any.whl

Download URL attractor_tools-0.3.0-py3-none-any.whl
Size 29.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b1d18a6ceb6d880d2481155c170a04833ff154939443721e613d14badc11943
BLAKE2b-256 checksum
How to use checksums
53148f58fdbcf2544c147d19ab91cf6ae714d760d3fc28d37966bb027aa45737
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for attractor-tools 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page