Skip to content

Commit 63bde1f

Browse files
committed
Make latitude quadrature points depend on box size
In FFBasis3D, this was proportional to `ell_max`, which doesn't make sense. We also loosen tolerances for hardcoded FFB3D tests since these depended on the incorrect reference data and are sensitive to the above change. Eventually, these will be replaced by logical tests (see #568).
1 parent 717e19d commit 63bde1f

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/aspire/basis/ffb_3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ def _precomp(self):
5555
in radical and phi dimensions.
5656
"""
5757
n_r = int(np.ceil(4 * self.rcut * self.kcut))
58-
n_theta = int(2 * self.sz[0])
59-
n_phi = int(self.ell_max + 1)
58+
n_theta = int(2 * self.nres)
59+
n_phi = int(2 * self.nres + 1)
6060

6161
r, wt_r = lgwt(n_r, 0.0, self.kcut, dtype=self.dtype)
6262
z, wt_z = lgwt(n_phi, -1, 1, dtype=self.dtype)

tests/test_FFBbasis3D.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import numpy as np
55

66
from aspire.basis import FFBBasis3D
7-
from aspire.utils import utest_tolerance
87

98
DATA_DIR = os.path.join(os.path.dirname(__file__), "saved_test_data")
109

@@ -474,15 +473,15 @@ def testFFBBasis3DEvaluate(self):
474473
os.path.join(DATA_DIR, "ffbbasis3d_xcoeff_out_8_8_8.npy")
475474
).T # RCOPT
476475

477-
self.assertTrue(np.allclose(result, ref, atol=utest_tolerance(self.dtype)))
476+
self.assertTrue(np.allclose(result, ref, atol=1e-2))
478477

479478
def testFFBBasis3DEvaluate_t(self):
480479
x = np.load(os.path.join(DATA_DIR, "ffbbasis3d_xcoeff_in_8_8_8.npy")).T # RCOPT
481480
result = self.basis.evaluate_t(x)
482481

483482
ref = np.load(os.path.join(DATA_DIR, "ffbbasis3d_vcoeff_out_8_8_8.npy"))[..., 0]
484483

485-
self.assertTrue(np.allclose(result, ref, atol=utest_tolerance(self.dtype)))
484+
self.assertTrue(np.allclose(result, ref, atol=1e-2))
486485

487486
def testFFBBasis3DExpand(self):
488487
x = np.load(os.path.join(DATA_DIR, "ffbbasis3d_xcoeff_in_8_8_8.npy")).T # RCOPT
@@ -492,4 +491,4 @@ def testFFBBasis3DExpand(self):
492491
..., 0
493492
]
494493

495-
self.assertTrue(np.allclose(result, ref, atol=utest_tolerance(self.dtype)))
494+
self.assertTrue(np.allclose(result, ref, atol=1e-2))

0 commit comments

Comments
 (0)