cutcutcodec.core.generation.video.fractal.mandelbrot

Allow to generate a fractal annimation.

Classes

GeneratorVideoMandelbrot(bounds[, iterations])

Generation of an annimated mandelbrot fractal.

Details

class cutcutcodec.core.generation.video.fractal.mandelbrot.GeneratorVideoMandelbrot(bounds: dict[str, Basic | Real | str], iterations: Basic | Real | str = 256)[source]

Generation of an annimated mandelbrot fractal.

Attributes

boundstuple[sympy.core.expr.Expr, …]

The four i_min, i_max, j_min and j_max bounds expressions of t (readonly).

iterationssympy.core.expr.Expr

The maximum number of iterations function based on t (readonly).

Examples

>>> from cutcutcodec.core.generation.video.fractal.mandelbrot import GeneratorVideoMandelbrot
>>> (stream,) = GeneratorVideoMandelbrot(
...     bounds={"i_min": -1.12, "i_max": 1.12, "j_min": -2.0, "j_max": 0.47},
...     iterations=256,
... ).out_streams
>>> stream.snapshot(0, (10, 8))[..., 0]
tensor([[0.0000, 0.0039, 0.0078, 0.0078, 0.0078, 0.0156, 0.0078, 0.0039],
        [0.0000, 0.0039, 0.0078, 0.0078, 0.0117, 0.0625, 0.0156, 0.0078],
        [0.0000, 0.0078, 0.0078, 0.0117, 0.1445, 1.0000, 1.0000, 0.0156],
        [0.0000, 0.0117, 0.0273, 0.0234, 1.0000, 1.0000, 1.0000, 0.0273],
        [0.0000, 0.0156, 0.0391, 1.0000, 1.0000, 1.0000, 1.0000, 0.0156],
        [0.0000, 0.0156, 0.0391, 1.0000, 1.0000, 1.0000, 1.0000, 0.0156],
        [0.0000, 0.0117, 0.0273, 0.0234, 1.0000, 1.0000, 1.0000, 0.0273],
        [0.0000, 0.0078, 0.0078, 0.0117, 0.1445, 1.0000, 1.0000, 0.0156],
        [0.0000, 0.0039, 0.0078, 0.0078, 0.0117, 0.0625, 0.0156, 0.0078],
        [0.0000, 0.0039, 0.0078, 0.0078, 0.0078, 0.0156, 0.0078, 0.0039]])
>>>

Initialise and create the class.

Parameters

boundsdict[str, str or sympy.Basic]

The 4 bounds expressions of the complex plan limit of pixels. The admitted keys are defined in cutcutcodec.core.generation.video.fractal.geometry.SYMBOLS. If an expression is used, only the symbol t is available.

iterationsstr or sympy.Basic

The expression of the maximum iterations number. If a function is used, only the symbol t is available. The final value is the integer part of the result. It has to be > 0.