@@ -63,13 +63,12 @@ def test_triangulation_find_opposing_vertices_raises_if_simplex_is_invalid():
6363
6464
6565def test_circumsphere ():
66- from adaptive .learner .triangulation import circumsphere
66+ from adaptive .learner .triangulation import circumsphere , fast_norm
6767 from numpy import allclose
68+ from numpy .random import normal , uniform
6869
6970 def generate_random_sphere_points (dim , radius = 0 ):
7071 """ Refer to https://math.stackexchange.com/a/1585996 """
71- from numpy .random import normal , uniform
72- from adaptive .learner .triangulation import fast_norm
7372
7473 vec = [None ] * (dim + 1 )
7574 center = uniform (- 100 , 100 , dim )
@@ -82,15 +81,15 @@ def generate_random_sphere_points(dim, radius=0):
8281
8382 return radius , center , vec
8483
85- center_diff_err = "Calculated center [%s] differs from true center [%s] \n "
84+ center_diff_err = "Calculated center (%s) differs from true center (%s) \n "
8685 for dim in range (2 , 10 ):
8786 radius , center , points = generate_random_sphere_points (dim )
8887 circ_center , circ_radius = circumsphere (points )
8988 err_msg = ""
9089 if not allclose (circ_center , center ):
9190 err_msg += center_diff_err % (
92- "," .join ([str (x ) for x in circ_center ]),
93- "," .join ([str (x ) for x in center ]),
91+ ", " .join ([str (x ) for x in circ_center ]),
92+ ", " .join ([str (x ) for x in center ]),
9493 )
9594 if not allclose (radius , circ_radius ):
9695 err_msg += "Calculated radius {} differs from true radius {}" .format (
0 commit comments