Skip to main content

A high performance framework for fractal image and video generation

Project description

FractalPy

pypi tag python_version licence checks codecov

Consider the recurrence relation $z_{n+1} = z_n^2 + c$ where $c$ is a complex number. The Mandelbrot set is a fractal, defined by the set of complex numbers $c$ for which this recurrence relation, with initial value $z_0 = 0$, does not diverge. Another interesting type of set, which are related to the Mandelbrot set, are Julia sets and are defined for a specific complex number $c$. To keep things brief, we will just establish the definition of a filled-in Julia set and do so in the following way: The filled-in Julia set of a complex number $c$ is the set of initial values $z_0$ for which the previously mentioned recurrence relation does not diverge. Not every filled-in Julia set is a fractal, but for almost all complex numbers $c$, they are. This project contains an implementation to generate images and videos relating to the Mandelbrot set and Julia sets.

Installation

Before installing the FractalPy package, it is recommended to create and activate a virtual environment with python 3.10. This can be done with conda by running the following commands in a terminal

$ conda create --name fractal python==3.10
$ conda activate fractal

Now the package and it's dependencies can be installed in the virtual environment, fractal, using pip

$ pip install fractalpy

For an editable installation from the source, first clone the repository and install with the following

$ conda activate fractal
$ pip install -e .

Usage

There are two ways of using FractalPy. The package can be imported to a python script with

import fractalpy as frac

# Plot the Mandelbrot set
frac.Mandelbrot().plot()

# Plot the Julia set
frac.Julia().plot()

The package also offers a command line interface that can be immediately accessed in the terminal with

fractalpy --help

For example, we can create a gif of zooming into the mandelbrot set with the following command:

fractalpy mandelbrot zoom

If FFmpeg is installed and accessible via the $PATH environment variable, then FractalPy can also generate videos, for example

fractalpy mandelbrot zoom --extension mp4

FractalPy makes use of multiprocessing to generate multiple frames simultaneously and also performs the computationally expensive calculations in parallel with jit, making it an extremely fast.

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

fractalpy-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

fractalpy-0.1.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file fractalpy-0.1.0.tar.gz.

File metadata

  • Download URL: fractalpy-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Darwin/22.1.0

File hashes

Hashes for fractalpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eea79d5cc327a93b58f4ac8f200bbfd8bce30544e4872540b4a90a4ae229a3ac
MD5 7415614143f71ccff4d5dc3fefec2015
BLAKE2b-256 870d1cf34f81af4db870ffd39fef938e051be955d70aa52431c355dd25fd69a2

See more details on using hashes here.

File details

Details for the file fractalpy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fractalpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Darwin/22.1.0

File hashes

Hashes for fractalpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6a763803d90d4a92b82f8c4b5b9d8932e10f814c7b38d158eacf95985169d55
MD5 7a0e5dab9db08b2b634c0247d60865ca
BLAKE2b-256 cb9a69dadfb5a5571f63aa2ca14eb95581a061f419062e12c1fc861302199c6d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page