def test_timeout_from_dt(): D = 400 v = 1 a = 0.1 r = sphere_vol_to_r(v) pores = fibonacci_spheres(1, r) t = escape(D, v, a, pores, max_steps=5, dt=1e-6) assert int(t) == 0
def test_escape_cube(): D = 400 v = 1 a = 0.1 r = sphere_vol_to_r(v) pores = random_points_on_cube_surface(1, r) t = escape(D, v, a, pores, shape='cube', dt=1e-6) assert t
def test_escape(): D = 400 v = 1 a = 0.1 r = sphere_vol_to_r(v) pores = fibonacci_spheres(1, r) t = escape(D, v, a, pores, dt=1e-6) assert t
def test_timeout_from_dt(): D = 400 v = 1 a = 0.1 r = sphere_vol_to_r(v) pores = points_on_cube_surface(1, r) t = escape(D, v, a, pores, shape='cube', max_steps=(1e3), dt=1) assert int(t) == 0
def test_avg_escape_sphere_time(): N = 10 D = 400 v = 1 a = 0.1 r = sphere_vol_to_r(v) pores = fibonacci_spheres(1, r) ts = np.mean([escape(D, v, a, pores, dt=1e-6) for _ in range(N)]) assert 0.001 < ts < 1
def test_avg_escape_sphere_time(): N = 50 D = 400 v = 1 a = 0.1 r = sphere_vol_to_r(v) pores = points_on_cube_surface(1, r) ts = np.mean([escape(D, v, a, pores, shape='cube') for _ in range(N)]) assert 0.01 < ts < 0.1
def test_sphere_vol_to_r(): npt.assert_almost_equal(sphere_vol_to_r(1), 0.62035, decimal=5)
def test_fibo_spheres_inside(): assert in_sphere(fibonacci_spheres(P, V)[0], sphere_vol_to_r(V + eps))
def test_fibo_spheres_outside(): assert in_sphere(fibonacci_spheres(P, V)[0], sphere_vol_to_r(V - eps)) == False