Postprocessing fields
To make the link between the raw calculation data and the colored layers, generic postprocessing are availables. This section describes them.
- class fractalshades.postproc.Postproc_batch(fractal, calc_name)[source]
- __init__(fractal, calc_name)[source]
Container for several postprocessing objects (instances of
Postproc
) which share the same Fractal & calculation (calc_name)It is usefull to have such container to avoid re-calculation of data that can be shared between several post-processing objects.
- Parameters:
- fractalfractalshades.Fractal instance
The shared fractal object
- calc_namestr
The string identifier for the shared calculation
- add_postproc(postname, postproc)[source]
Add successive postprocessing and ensure they share identical fractal & calc_name
- Parameters:
- postnamestr
The string identifier that will be associated with this post-processing object
- postproc
Postproc
instance The post-processing object to be added
Notes
Warning
A Postproc can only be added to one batch.
- class fractalshades.postproc.Raw_pp(key, func=None)[source]
- __init__(key, func=None)[source]
A raw postproc provide direct access to the res data stored (memmap) during calculation. (Similar to what does
Fractal_array
but here within aPostproc_batch
)- Parameters:
- key: str
The raw data key. Should be one of the complex_codes, int_codes, termination_codes for this calculation.
- func: None | callable | a str of variable x (e.g. “np.sin(x)”)
will be applied as a pre-processing step to the raw data if not
None
- class fractalshades.postproc.Continuous_iter_pp(kind=None, d=None, a_d=None, M=None, epsilon_cv=None, floor_iter=0)[source]
- __init__(kind=None, d=None, a_d=None, M=None, epsilon_cv=None, floor_iter=0)[source]
Return a continuous iteration number: this is the iteration count at bailout, plus a fractionnal part to allow smooth coloring. Implementation based on potential, for details see:
On Smooth Fractal Coloring Techniques, Jussi Härkönenen, Abo University, 2007
- Parameters:
- kindstr “infinity” | “convergent” | “transcendent”
the classification of potential function.
- dNone | int
degree of polynome d >= 2 if kind = “infinity”
- a_dNone | float
coeff of higher order monome if kind = “infinity”
- MNone | float
High number corresponding to the criteria for stopping iteration if kind = “infinity”
- epsilon_cvNone | float
Small number corresponding to the criteria for stopping iteration if kind = “convergent”
- floor_iterint
If not 0, a shift will be applied and floor_iter become the 0th iteration. Used to avoids loss of precision (banding) for very large iteration numbers, usually above several milions. For reference, the largest integer that cannot be accurately represented with a float32 is > 16 M), banding will start to be noticeable before.
Notes
Note
Usually it is not needed to set any parameter ; if a parameter
param
is not provided, it will defaut to the attribute of the fractal with namepotential_<param>
, which should be the recommended value.
- class fractalshades.postproc.Fieldlines_pp(n_iter=5, swirl=0.0, endpoint_k=1.0)[source]
- __init__(n_iter=5, swirl=0.0, endpoint_k=1.0)[source]
Return a continuous orbit-averaged angular value, allowing to reveal fieldlines. Implementation based on [1]. The averaging orbit starts at the computed
zn_orbit
field if it exists, otherwise at the exitzn
value, and is truncated aftern_iter
iterations.Fieldlines approximate the external rays which are very important in the study of the Mandelbrot set and more generally in holomorphic dynamics.
- Parameters:
- n_iterint > 0
the number of orbit points used for the averageing
- swirlfloat between -1. and 1.
adds a random dephasing effect between each successive orbit point
- endpoint_kfloat > 0.
A geometric serie is used for scaling individual orbit points, this parameters is the ratio between the last and the first scaling (For an arithmetic mean over the truncated orbit, use 1.)
Notes
Note
The Continuous iteration number shall have been calculated before in the same
Postproc_batch
- class fractalshades.postproc.DEM_pp(px_snap=None)[source]
- __init__(px_snap=None)[source]
Return a distance estimation of the pixel to the fractal set.
- Parameters:
- `px_snap`: None | float
If not None, pixels at a distance from the fractal lower than
px_snap
(expressed in image pixel) will be snapped to 0.
Notes
Note
The Continuous iteration number shall have been calculated before in the same
Postproc_batch
- class fractalshades.postproc.DEM_normal_pp(kind='potential')[source]
- __init__(kind='potential')[source]
Return the 2 components of the distance estimation method derivative (normal map). This postproc is normally used in combination with a
fractalshades.colors.layers.Normal_map_layer
- Parameters:
- `kind`: str “potential” | “Milnor” | “convergent”
if “potential” (default) DEM is base on the potential. For Mandelbrot power 2, “Milnor” option is also available which gives slightly different results (sharper edges). Use “convergent” for convergent fractals…
Notes
Note
The Continuous iteration number shall have been calculated before in the same
Postproc_batch
If kind=”Milnor”, the following raw complex fields must be available from the calculation: “zn”, “dzndc”, “d2zndc2”
- class fractalshades.postproc.Attr_pp(scale_by_order=False)[source]
- __init__(scale_by_order=False)[source]
Return the cycle attractivity
- Parameters:
- scale_by_orderbool
If True return the attractivity divided by ccyle order (this allows more realistic 3d-view exports)
Notes
Note
The following complex fields must be available from a previously run calculation:
“attractivity”
“order” (optionnal)
- class fractalshades.postproc.Attr_normal_pp[source]
- __init__()[source]
Return the 2 components of the cycle attractivity derivative (normal map). This postproc is normally used in combination with a
fractalshades.colors.layers.Normal_map_layer
Notes
Note
The following complex fields must be available from a previously run calculation:
“attractivity”
“order” (optionnal)
- class fractalshades.postproc.Fractal_array(fractal, calc_name, key, func=None, inv=False)[source]
- __init__(fractal, calc_name, key, func=None, inv=False)[source]
Class which provide a direct access to the res data stored (memory mapping) during calculation.
One application, it can be passed as a subset parameter to most calculation models, e.g. :
fractalshades.models.Mandelbrot.base_calc
- Parameters:
- fractal
fractalshades.Fractal
derived class The reference fracal object
- calc_namestr
The calculation name
- key
The raw data key. Should be one of the complex_codes, int_codes, termination_codes for this calculation.
- func: None | callable | a str of variable x (e.g. “np.sin(x)”)
will be applied as a pre-processing step to the raw data if not
None
- use of str form is recommended
- fractal