Skip to content

Commit 5170937

Browse files
author
zxy.monado
committed
fix(pyabacus): call static base wrappers directly
1 parent f29968d commit 5170937

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

python/pyabacus/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ To contribute to the `pyabacus` project, follow these steps:
375375

376376
@staticmethod
377377
def sphbes_zeros(l: int, n: int, zeros: NDArray[np.float64]) -> None:
378-
super().sphbes_zeros(l, n, zeros)
378+
_Sphbes.sphbes_zeros(l, n, zeros)
379379
```
380380

381381
## Conclusion

python/pyabacus/src/pyabacus/ModuleBase/_module_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def dsphbesj(self, *args, **kwargs):
4848

4949
@staticmethod
5050
def sphbes_zeros(l: int, n: int, zeros: NDArray[np.float64]) -> None:
51-
super().sphbes_zeros(l, n, zeros)
51+
_Sphbes.sphbes_zeros(l, n, zeros)
5252

5353
class Integral(_Integral):
5454
def __init__(self) -> None:
@@ -81,7 +81,7 @@ def Simpson_Integral_0toall(
8181
rab: NDArray[np.float64],
8282
asum: NDArray[np.float64]
8383
) -> None:
84-
super().Simpson_Integral_0toall(mesh, func, rab, asum)
84+
_Integral.Simpson_Integral_0toall(mesh, func, rab, asum)
8585

8686
@staticmethod
8787
def Simpson_Integral_alltoinf(
@@ -90,7 +90,7 @@ def Simpson_Integral_alltoinf(
9090
rab: NDArray[np.float64],
9191
asum: NDArray[np.float64]
9292
) -> None:
93-
super().Simpson_Integral_alltoinf(mesh, func, rab, asum)
93+
_Integral.Simpson_Integral_alltoinf(mesh, func, rab, asum)
9494

9595
@overload
9696
@staticmethod

python/pyabacus/tests/test_base_math.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,23 @@ def test_sphbes():
1313
assert s.sphbesj(0, 0.0) == 1.0
1414
assert s.sphbesj(1, np.array([0.0]), 1, 1, np.zeros(1)) == None
1515

16+
def test_static_array_wrappers():
17+
zeros = np.zeros(2)
18+
base.Sphbes.sphbes_zeros(0, 2, zeros)
19+
np.testing.assert_allclose(zeros, [np.pi, 2 * np.pi])
20+
21+
mesh = 3
22+
func = np.ones(mesh)
23+
rab = np.ones(mesh)
24+
integral_from_zero = np.zeros(mesh)
25+
integral_to_infinity = np.zeros(mesh)
26+
27+
base.Integral.Simpson_Integral_0toall(mesh, func, rab, integral_from_zero)
28+
base.Integral.Simpson_Integral_alltoinf(mesh, func, rab, integral_to_infinity)
29+
30+
np.testing.assert_allclose(integral_from_zero, [0.0, 1.0, 2.0])
31+
np.testing.assert_allclose(integral_to_infinity, [2.0, 1.0, 0.0])
32+
1633
def test_sbt():
1734
sbt = base.SphericalBesselTransformer()
1835

0 commit comments

Comments
 (0)