|
15 | 15 | http://www.math.univ-toulouse.fr/~cheritat/GalII/galery.html
|
16 | 16 | and
|
17 | 17 | https://ddd.uab.cat/pub/pubmat/02141493v43n1/02141493v43n1p27.pdf
|
| 18 | +
|
| 19 | +Remark: Some overflow runtime warnings are suppressed. This is because of the |
| 20 | + way the iterateion loop is implemented, using numpy's efficient computations. |
| 21 | + Overflows and infinites are replaced after each step by a large number. |
18 | 22 | """
|
19 | 23 |
|
| 24 | +import warnings |
20 | 25 | from typing import Any, Callable
|
21 | 26 |
|
22 | 27 | import numpy
|
@@ -87,7 +92,7 @@ def iterate_function(
|
87 | 92 | array([ 0, 1, 256])
|
88 | 93 | """
|
89 | 94 |
|
90 |
| - z_n = z_0.astype('complex64') |
| 95 | + z_n = z_0.astype("complex64") |
91 | 96 | for i in range(nb_iterations):
|
92 | 97 | z_n = eval_function(function_params, z_n)
|
93 | 98 | if infinity is not None:
|
@@ -117,10 +122,30 @@ def show_results(
|
117 | 122 | pyplot.show()
|
118 | 123 |
|
119 | 124 |
|
| 125 | +def ignore_overflow_warnings(): |
| 126 | + # Fine grained filtering will make sure that we know what we are doing |
| 127 | + warnings.filterwarnings( |
| 128 | + "ignore", category=RuntimeWarning, message="overflow encountered in multiply" |
| 129 | + ) |
| 130 | + warnings.filterwarnings( |
| 131 | + "ignore", |
| 132 | + category=RuntimeWarning, |
| 133 | + message="invalid value encountered in multiply", |
| 134 | + ) |
| 135 | + warnings.filterwarnings( |
| 136 | + "ignore", category=RuntimeWarning, message="overflow encountered in absolute" |
| 137 | + ) |
| 138 | + warnings.filterwarnings( |
| 139 | + "ignore", category=RuntimeWarning, message="overflow encountered in exp" |
| 140 | + ) |
| 141 | + |
| 142 | + |
120 | 143 | if __name__ == "__main__":
|
121 | 144 |
|
122 | 145 | z_0 = prepare_grid(window_size, nb_pixels)
|
123 | 146 |
|
| 147 | + ignore_overflow_warnings() # See file header for explanations |
| 148 | + |
124 | 149 | nb_iterations = 24
|
125 | 150 | escape_radius = 2 * abs(c_cauliflower) + 1
|
126 | 151 | z_final = iterate_function(
|
|
0 commit comments