GithubHelp home page GithubHelp logo

fergus-oh / fractalpy Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 771.28 MB

Python package for high performance fractal image and video generation.

Home Page: https://pypi.org/project/fractalpy/

License: MIT License

Python 100.00%
fractal-rendering fractals julia-sets mandelbrot-fractal plotting python jit numba

fractalpy's Introduction

FractalPy

pypi tag python_version licence code quality build checks codecov docs

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.

To install the stable release, run

$ pip install fractalpy

To install the latest version, run

$ pip install git+https://github.com/Fergus-OH/FractalPy.git

To install an editable installation, clone the repository, checkout the develop branch, and install the contents with pip. This can be done with the following commands

$ git clone --branch develop https://github.com/Fergus-OH/FractalPy.git
$ cd FractalPy
$ pip install -e .

Usage

To get started with FractalPy, type the following in a terminal to show documentation for the command line interface application

$ fractalpy --help

FractalPy can be also be used directly in a notebook or python script by importing the fractalpy package

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.

Documentation

Documentation is available on readthedocs.io, with a pdf format available here.

fractalpy's People

Contributors

fergus-oh avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.