Skip to content

Commit 409bdce

Browse files
committed
fix style
1 parent 0a37c3f commit 409bdce

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

adaptive/learner/triangulation.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525

2626
def fast_norm(v):
27-
""" Manually take the vector norm for len 2, 3 vectors. Defaults to a square root of the dot product
28-
for larger vectors.
27+
"""Take the vector norm for len 2, 3 vectors.
28+
Defaults to a square root of the dot product for larger vectors.
2929
3030
Note that for large vectors, it is possible for integer overflow to occur.
3131
For instance:
@@ -34,7 +34,6 @@ def fast_norm(v):
3434
3535
"""
3636
len_v = len(v)
37-
# notice this method can be even more optimised
3837
if len_v == 2:
3938
return sqrt(v[0] * v[0] + v[1] * v[1])
4039
if len_v == 3:
@@ -104,7 +103,7 @@ def fast_2d_circumcircle(points):
104103

105104

106105
def fast_3d_circumcircle(points):
107-
"""Compute the center and radius of the circumscribed shpere of a simplex.
106+
"""Compute the center and radius of the circumscribed sphere of a simplex.
108107
109108
Parameters
110109
----------

adaptive/tests/unit/test_triangulation.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_circumsphere():
6868
from numpy.random import normal, uniform
6969

7070
def generate_random_sphere_points(dim, radius=0):
71-
""" Refer to https://math.stackexchange.com/a/1585996 """
71+
"""https://math.stackexchange.com/a/1585996"""
7272

7373
vec = [None] * (dim + 1)
7474
center = uniform(-100, 100, dim)
@@ -81,19 +81,15 @@ def generate_random_sphere_points(dim, radius=0):
8181

8282
return radius, center, vec
8383

84-
center_diff_err = "Calculated center (%s) differs from true center (%s)\n"
8584
for dim in range(2, 10):
8685
radius, center, points = generate_random_sphere_points(dim)
8786
circ_center, circ_radius = circumsphere(points)
8887
err_msg = ""
8988
if not allclose(circ_center, center):
90-
err_msg += center_diff_err % (
91-
", ".join([str(x) for x in circ_center]),
92-
", ".join([str(x) for x in center]),
93-
)
89+
err_msg += f"Calculated center ({circ_center}) differs from true center ({center})\n"
9490
if not allclose(radius, circ_radius):
95-
err_msg += "Calculated radius {} differs from true radius {}".format(
96-
circ_radius, radius,
91+
err_msg += (
92+
f"Calculated radius {circ_radius} differs from true radius {radius}\n"
9793
)
9894
if err_msg:
9995
raise AssertionError(err_msg)

0 commit comments

Comments
 (0)