1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
img_res_x = 2000
img_res_y = 2000
xmin = -np.pi
xmax = np.pi
ymin = -np.pi
ymax = np.pi
escape = 10000
iterations = 255
c_x = 0
c_y = 0
image = np.empty([img_res_y, img_res_x], np.float32)
for pix_y, y in enumerate(np.linspace(ymin, ymax, img_res_y)):
for pix_x, x in enumerate(np.linspace(xmin, xmax, img_res_x)):
on_x = x
on_y = y
for i in range(iterations):
next_x = (on_x/np.sin(on_y))
on_y = (on_y/np.sin(on_x))
on_x = next_x
if on_x**2 + on_y**2 > escape:
break
image[pix_y][pix_x] = i
#print(pix_y)
plt.style.use('dark_background')
# fuck this shit
fig = plt.figure(frameon=False)
fig.set_size_inches(img_res_x/fig.dpi, img_res_y/fig.dpi)
#fig.set_size_inches(width/height, 1, forward=False)
print(fig.dpi)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
cmap = plt.cm.viridis
cmap.set_bad((0,0,0))
cmap.set_over((0,0,0))
cmap.set_under((0,0,0))
ax.imshow(image, norm="log", aspect="auto", cmap=cmap)
fig.savefig("animation/cpu.png")
#plt.show()
|