Databases

This section describes the classes used to open and use a database as saved by fractalshades.Fractal_plotter.save_db.

class fractalshades.db.Db(path)[source]
__init__(path)[source]

Wrapper around the memory-mapped numpy-array stored at path.

Parameters:
path: str

The path for the data. This memory-mapped array is usually created through a fractalshades.Fractal_plotter.save_db call. Two format are available (*.db and *.post db, refer to the doc for this function for details)

plot(frame=None)[source]
Parameters:
frame: `fractalshades.db.Frame`, Optional

Defines the area to plot. If not provided, the full db will be plotted.

Returns:
img: PIL.Image

The plotted image

Notes

Plotting settings are set by fractalshades.db.Db.set_plotter method, they are used only for *.db format (as opposed to a *.postdb image array format)

set_plotter(plotter, postname)[source]

Define the plotting properties - Needed only if a *.db is provided not (as opposed to a *.postdb image array format)

Parameters:
plotter: `fractalshades.Fractal_plotter`

A plotter to be used as template

postname: str

The string indentifier of the layer used for plotting

class fractalshades.db.Frame(x, y, dx, nx, xy_ratio, t=None, plotting_modifier=None)[source]
__init__(x, y, dx, nx, xy_ratio, t=None, plotting_modifier=None)[source]

A frame is used to describe a specific data window and for interpolating inside a db.

Parameters:
x: float

center x-coord of the window (in screen coordinates)

y: float

center y-coord of the window (in screen coordinates)

dx: float

width of the window (in screen coordinates)

nx: int

number of pixel for the interpolated frame

xy_ratio: float

width / height ratio of the interpolated frame

t: Optionnal float

time [s] of this frame in the movie

plotting_modifier: Optionnal callable

a plotting_modifier associated with this Frame

Notes

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"]
)
class fractalshades.db.Exp_db(path_expmap, path_final)[source]
__init__(path_expmap, path_final)[source]

Wrapper around the raw array data stored at path_expmap and path_final.

Parameters:
path_expmap: str

The path for the expmap database. Note that only *.postdb format is currently supported hence the expmap array is of shape (nt, nh, nchannels) and stores rgb data. It is usually saved by a call to fractalshades.Fractal_plotter.save_db using a fractalshades.projection.Expmap projection. Note that the orientation parameter of this projection shall be “vertical”.

path_final: str

The path for the final raw data. Note that only *.postdb format is currently supported hence the expmap array is of shape (ny, nx, nchannels) and stores rgb data. It is usually saved by a fractalshades.Fractal_plotter.save_db call (with a standard fractalshades.projection.Cartesian projection). It shall be square (nx == ny) and only *.postdb format is currently supported.

plot(frame)[source]
Parameters:
frame: `fractalshades.db.Exp_frame`

Defines the area to plot.

Returns:
img: PIL.Image

The plotted image

Notes

Plotting settings are defined by set_plotter method.

class fractalshades.db.Exp_frame(h, nx, xy_ratio, t=None, plotting_modifier=None, pts=None)[source]
__init__(h, nx, xy_ratio, t=None, plotting_modifier=None, pts=None)[source]

This class is used to describe a specific data window for interpolation inside a fractalshades.db.Exp_db.

Parameters:
h: float >= 0.

zoom level. A zoom level of 0. denotes that dx = dx0 fully zoomed-in frame - for h > 0, dx = dx0 * np.exp(h)

nx: int

number of pixels for the interpolated frame

xy_ratio: float

width / height ratio of the interpolated frame

t: Optionnal float

time [s] of this frame in the movie

plotting_modifier: Optional callable

a plotting_modifier associated with this frame

pts: Optional, 4-uplet of arrays

The x, y, h, t grid as returned by make_exp_grid - if not provided it will be recomputed - but more efficient to share between frames