MCPcopy Create free account
hub / github.com/Apress/python-for-matlab-development / run_sim

Function run_sim

code/OO/collision_matrix.py:47–59  ·  view source on GitHub ↗
(N, n_iter)

Source from the content-addressed store, hash-verified

45 return sep < sum_r
46
47def run_sim(N, n_iter):
48 box_x, box_y = 10., 6.
49 r_min, r_max = 0.1, 0.3
50 print(f'n balls={N}')
51 for i in range(n_iter):
52 x = r_max + (box_x-2*r_max)*rand(N)
53 y = r_max + (box_y-2*r_max)*rand(N)
54 R = 0.1 + 0.8*rand(N)
55 T_s = time.time()
56 coll = collision_matrix(x, y, R)
57 n_coll = (np.sum(coll) - N)//2
58 print(f'n coll={n_coll} Hz = '
59 f'{1/(time.time()-T_s):.2f}')

Callers

nothing calls this directly

Calls 1

collision_matrixFunction · 0.85

Tested by

no test coverage detected