An attractor is a function
We define an attractor function which depends on parameter constants. And we define a trajectory function, which calls the attractor function for a fixed number of iterations and uses the output of each iteration as input for the next iteration. The attractor function we use is the Clifford Attractor
A great thing about attractor functions is that you can get many different fractals depending on the parameters of your function. We decided to try out some parameter sets to see what we can create. And we had all our code in a jupyter notebook. While notebooks are great for combining code, results and documentation they are not as easy to run as a simple python file.
However that does not mean we can't do it. A while ago we learned that Netflix is using jupyter notebooks quite a lot. Apparently they have an entire system built around notebooks that are being containerized and scheduled to run. They have an inspiring blog post about it.
One of the packages they're using is papermill.It allows us to parameterize a notebook by simply tagging cells with parameter definitions. Then we can run the notebook from either a command line or from python and store results in different notebooks.
$ papermill fractal.ipynb output.ipynb -p c 1.2 -p d -1.2 -p e 0.4 -p f -0.4
Input Notebook: fractal.ipynb
Output Notebook: output.ipynb
100%|████████████████████████████████████████████████████████████████████| 15/15 [00:11<00:00, 1.22s/it]
The notebook we used is on our github.

Keine Kommentare:
Kommentar veröffentlichen