• API
• FAQ
• Tools
• Archive
daily pastebin goal
63%
SHARE
TWEET

# Untitled

a guest Feb 20th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. n = 360
2. m = 8
3.
4. def get_xy(phase_offset, w1, w2, o1=None, o2=None):
5.     if o1 is None:
6.         o1 = np.zeros(m)
7.     if o2 is None:
8.         o2 = np.zeros(m)
9.     a = []
10.
11.     offsets = arange(1, m + 1)
12.
13.     for phi in linspace(0, 2 * pi, n):
14.         p1 = (phi + o1) * offsets
15.         p2 = (phi + o2) * offsets
16.         l = (dot(np.cos(p1), w1) + dot(np.sin(p2), w2)) * 0.09 + 3
17.         x = cos(phi + phase_offset) * l
18.         y = sin(phi + phase_offset) * l
19.         a.append([x, y])
20.
21.     return array(a)
22.
23. ec = []
24. w1 = np.random.normal(0, 2, size=m)
25. w2 = np.random.normal(0, 2, size=m)
26.
27. o1 = np.random.normal(0, 2 * pi, size=m)
28. o2 = np.random.normal(0, 2 * pi, size=m)
29. for i in range(30):
30.     w1 = w1 * 0.999 + np.random.normal(0, 0.03, size=m)
31.     w2 = w2 * 0.999 + np.random.normal(0, 0.03, size=m)
32.     o1 += np.random.normal(3, 2) * 0.005
33.     o2 += np.random.normal(3, 2) * 0.005
34.
35.     ec.append(get_xy(-i * 0.02, w1, w2, o1, o2))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top