コード例 #1
0
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
コード例 #2
0
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
コード例 #3
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
コード例 #4
0
def test_fibo_spheres_inside():

    assert in_sphere(fibonacci_spheres(P, V)[0], sphere_vol_to_r(V + eps))
コード例 #5
0
def test_fibo_spheres_outside():
    assert in_sphere(fibonacci_spheres(P, V)[0],
                     sphere_vol_to_r(V - eps)) == False
コード例 #6
0
def test_points_in_sphere():
    assert in_sphere(fibonacci_spheres(1, 100)[0], 1) == False