Skip to content

Commit 8d261aa

Browse files
committed
ruff issues on test done
1 parent 49448a7 commit 8d261aa

4 files changed

Lines changed: 54 additions & 19 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ sumpy/_git_rev.py
2323

2424
*.vts
2525
test/hirish_plotting
26+
test/test_eigenvalues.ipynb
2627
.vscode/settings.json

sumpy/recurrence_qbx.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"""
3535

3636
import math
37-
from collections.abc import Sequence
37+
from typing import TYPE_CHECKING
3838

3939
import numpy as np
4040
import sympy as sp
@@ -47,6 +47,10 @@
4747
)
4848

4949

50+
if TYPE_CHECKING:
51+
from collections.abc import Sequence
52+
53+
5054
# ================ Transform/Rotate =================
5155
def _produce_orthogonal_basis(normals: np.ndarray) -> Sequence[np.ndarray]:
5256
ndim, ncenters = normals.shape

test/test_recurrence.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _qbx_lp_general(knl, sources, targets, centers, radius,
9696
return result_qbx
9797

9898

99-
def _create_ellipse(n_p, mode_nr = 10, quad_convg_rate=100, a=2):
99+
def _create_ellipse(n_p, mode_nr=10, quad_convg_rate=100, a=2):
100100
t = np.linspace(0, 2 * np.pi, n_p, endpoint=False)
101101

102102
phi = sp.symbols("phi")
@@ -322,24 +322,39 @@ def _construct_laplace_axis_2d(orders, resolutions):
322322
def plot():
323323
import matplotlib.pyplot as plt
324324
orders = [5, 7, 9, 11]
325-
colors = ['b', 'g', 'r', 'c']
325+
colors = ["b", "g", "r", "c"]
326326
resolutions = [2000, 300, 4000]
327327
err_mat, err_mat1 = _construct_laplace_axis_2d(orders, resolutions)
328328

329-
fig, ax1 = plt.subplots(1, 1, sharey=True, figsize=(6, 6))
329+
_fig, ax1 = plt.subplots(1, 1, sharey=True, figsize=(6, 6))
330330

331331
ax1.set_yscale("log")
332332
for i in range(len(orders)):
333-
ax1.scatter(9.68845/np.array(resolutions), np.array(err_mat[i]), marker='+', label="$u = u_{qbxrec}$ ("+"$p_{QBX}$="+str(orders[i])+ ")", c=colors[i], s=50)
334-
ax1.scatter(9.68845/np.array(resolutions), np.array(err_mat1[i]), marker='x', label="$u = u_{qbx}$ ("+"$p_{QBX}$="+str(orders[i]) + ")", c=colors[i], s=50)
333+
ax1.scatter(
334+
9.68845/np.array(resolutions), np.array(err_mat[i]),
335+
marker="+",
336+
label="$u = u_{qbxrec}$ ("
337+
+ "$p_{QBX}$=" + str(orders[i]) + ")",
338+
c=colors[i], s=50)
339+
ax1.scatter(
340+
9.68845/np.array(resolutions), np.array(err_mat1[i]),
341+
marker="x",
342+
label="$u = u_{qbx}$ ("
343+
+ "$p_{QBX}$=" + str(orders[i]) + ")",
344+
c=colors[i], s=50)
335345

336346
ax1.set_xlabel("Mesh Resolution ($h$)", fontsize=14)
337-
ax1.set_ylabel("Relative Error ($L_{\infty}$)", fontsize=14)
347+
ax1.set_ylabel(r"Relative Error ($L_{\infty}$)", fontsize=14)
338348
ax1.set_title("$(u-u_{true})/u_{true}$", fontsize=16)
339349
ax1.legend()
340350

341-
plt.suptitle("Laplace 2D: Ellipse SLP Boundary Evaluation Error ($m=100$, $p_{offaxis}=8$)", fontsize=16)
342-
plt.savefig("../../S_on_surface_convergence.pgf", bbox_inches='tight', pad_inches=0)
351+
plt.suptitle(
352+
"Laplace 2D: Ellipse SLP Boundary Evaluation Error"
353+
" ($m=100$, $p_{offaxis}=8$)", fontsize=16)
354+
plt.savefig(
355+
"../../S_on_surface_convergence.pgf",
356+
bbox_inches="tight", pad_inches=0)
343357
plt.show()
344358

345-
plot()
359+
360+
plot()

test/test_recurrence_qbx.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _qbx_lp_general(knl, sources, targets, centers, radius,
9696
return result_qbx
9797

9898

99-
def _create_ellipse(n_p, mode_nr = 10, quad_convg_rate=100, a=2):
99+
def _create_ellipse(n_p, mode_nr=10, quad_convg_rate=100, a=2):
100100
t = np.linspace(0, 2 * np.pi, n_p, endpoint=False)
101101

102102
phi = sp.symbols("phi")
@@ -322,24 +322,39 @@ def _construct_laplace_axis_2d(orders, resolutions):
322322
def plot():
323323
import matplotlib.pyplot as plt
324324
orders = [5, 7, 9, 11]
325-
colors = ['b', 'g', 'r', 'c']
325+
colors = ["b", "g", "r", "c"]
326326
resolutions = [2000, 300, 4000]
327327
err_mat, err_mat1 = _construct_laplace_axis_2d(orders, resolutions)
328328

329-
fig, ax1 = plt.subplots(1, 1, sharey=True, figsize=(6, 6))
329+
_fig, ax1 = plt.subplots(1, 1, sharey=True, figsize=(6, 6))
330330

331331
ax1.set_yscale("log")
332332
for i in range(len(orders)):
333-
ax1.scatter(9.68845/np.array(resolutions), np.array(err_mat[i]), marker='+', label="$u = u_{qbxrec}$ ("+"$p_{QBX}$="+str(orders[i])+ ")", c=colors[i], s=50)
334-
ax1.scatter(9.68845/np.array(resolutions), np.array(err_mat1[i]), marker='x', label="$u = u_{qbx}$ ("+"$p_{QBX}$="+str(orders[i]) + ")", c=colors[i], s=50)
333+
ax1.scatter(
334+
9.68845/np.array(resolutions), np.array(err_mat[i]),
335+
marker="+",
336+
label="$u = u_{qbxrec}$ ("
337+
+ "$p_{QBX}$=" + str(orders[i]) + ")",
338+
c=colors[i], s=50)
339+
ax1.scatter(
340+
9.68845/np.array(resolutions), np.array(err_mat1[i]),
341+
marker="x",
342+
label="$u = u_{qbx}$ ("
343+
+ "$p_{QBX}$=" + str(orders[i]) + ")",
344+
c=colors[i], s=50)
335345

336346
ax1.set_xlabel("Mesh Resolution ($h$)", fontsize=14)
337-
ax1.set_ylabel("Relative Error ($L_{\infty}$)", fontsize=14)
347+
ax1.set_ylabel(r"Relative Error ($L_{\infty}$)", fontsize=14)
338348
ax1.set_title("$(u-u_{true})/u_{true}$", fontsize=16)
339349
ax1.legend()
340350

341-
plt.suptitle("Laplace 2D: Ellipse SLP Boundary Evaluation Error ($m=100$, $p_{offaxis}=8$)", fontsize=16)
342-
plt.savefig("../../S_on_surface_convergence.pgf", bbox_inches='tight', pad_inches=0)
351+
plt.suptitle(
352+
"Laplace 2D: Ellipse SLP Boundary Evaluation Error"
353+
" ($m=100$, $p_{offaxis}=8$)", fontsize=16)
354+
plt.savefig(
355+
"../../S_on_surface_convergence.pgf",
356+
bbox_inches="tight", pad_inches=0)
343357
plt.show()
344358

345-
plot()
359+
360+
plot()

0 commit comments

Comments
 (0)