Fractals/Fractalshades

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Fractalshades by Geoffroy Billotey

instalation[edit | edit source]

pip install pip setuptools --upgrade
pip install fractalshades

Where ?

zalman:~$ pip list -v
Package                 Version         Location                                    Installer
----------------------- --------------- ------------------------------------------- ---------
apturl                  0.5.2           /usr/lib/python3/dist-packages
bcrypt                  3.2.0           /usr/lib/python3/dist-packages
blinker                 1.4             /usr/lib/python3/dist-packages
Brlapi                  0.8.3           /usr/lib/python3/dist-packages
certifi                 2020.6.20       /usr/lib/python3/dist-packages
chardet                 4.0.0           /usr/lib/python3/dist-packages
chrome-gnome-shell      0.0.0           /usr/lib/python3/dist-packages
click                   8.0.3           /usr/lib/python3/dist-packages
colorama                0.4.4           /usr/lib/python3/dist-packages
command-not-found       0.3             /usr/lib/python3/dist-packages
cryptography            3.4.8           /usr/lib/python3/dist-packages
cupshelpers             1.0             /usr/lib/python3/dist-packages
dbus-python             1.2.18          /usr/lib/python3/dist-packages
defer                   1.0.6           /usr/lib/python3/dist-packages
Deprecated              1.2.13          /usr/lib/python3/dist-packages
distro                  1.7.0           /usr/lib/python3/dist-packages
distro-info             1.1build1       /usr/lib/python3/dist-packages
duplicity               0.8.21          /usr/lib/python3/dist-packages
fasteners               0.14.1          /usr/lib/python3/dist-packages
fractalshades           0.5.6           /home/a/.local/lib/python3.10/site-packages pip


For interactive exploration, a GUI is implemented under PyQt6.

Projections[edit | edit source]

A Projection defines a mapping acting on the screen-pixels before iteration.


Projections

exponential[edit | edit source]

An exponential projection will map : as follows:

where:


The `xy_ratio` of the zoom will be adjusted (during run time) to ensure that: extends from to

 def adjust_to_zoom(self, fractal):
        # We need to adjust the fractal xy_ratio in order to match hmax - hmin
        # target: dh = 2. * np.pi * xy_ratio 
        if self.premul_1j:
            xy_ratio = (np.pi * 2.) / self.dh
            nx = int(fractal.nx * xy_ratio + 0.5)
        else:
            xy_ratio = self.dh / (np.pi * 2.)
            nx = fractal.nx
    
        fractal.xy_ratio = self.xy_ratio = xy_ratio
        fractal.zoom_kwargs["xy_ratio"] = xy_ratio
        fractal.nx = nx
        fractal.zoom_kwargs["nx"] = nx

        logger.info(
            "Adjusted parameters for Expmap projection:\n"
            f"zoom parameter nx: {fractal.nx}\n"
            f"zoom parameter xy_ratio: {fractal.xy_ratio}"
        )
        self.make_impl()


This class can be used with arbitrary-precision deep zooms.

Parameters

  • hmin: str or float or mpmath.mpf
  • scaling at the lower end of the x-axis
  • hmax: str or float or mpmath.mpf
  • scaling at the higher end of the x-axis
  • rotates_df: bool. If ``True``, the derivative will be scaled but also rotated according to the mapping. Otherwise, only the scaling will be taken into account. A rule of thumb is this value shall be set to ``True`` for a standalone picture, and to ``False`` if used as input for a movie making tool


It is defined in class

class Expmap(Projection):
  def __init__(self, hmin, hmax, rotates_df=True, orientation="horizontal"):

Examples

projection = fs.projection.Expmap(-1.3, np.log(1.e7) + 0.3)

so

  • hmin = -1.3
  • hmax = log(1.e7) + 0.3 = 10000000.3


A simple pass-through Frame, extracting the raw my_db data is:

fractalshades.db.Frame(
    x=0., y=0., dx=1.0,
    nx=my_db.zoom_kwargs["nx"],
    xy_ratio=my_db.zoom_kwargs["xy_ratio"]
)

References[edit | edit source]