|
10 | 10 | from numpy.polynomial.legendre import leggauss |
11 | 11 | from scipy.special import jn, jv, sph_harm |
12 | 12 |
|
13 | | -from aspire.utils import ensure |
14 | 13 | from aspire.utils.coor_trans import grid_2d, grid_3d |
15 | 14 |
|
16 | 15 | logger = logging.getLogger(__name__) |
@@ -158,8 +157,8 @@ def real_sph_harmonic(j, m, theta, phi): |
158 | 157 |
|
159 | 158 |
|
160 | 159 | def besselj_zeros(nu, k): |
161 | | - ensure(k >= 3, "k must be >= 3") |
162 | | - ensure(0 <= nu <= 1e7, "nu must be between 0 and 1e7") |
| 160 | + assert k >= 3, "k must be >= 3" |
| 161 | + assert 0 <= nu <= 1e7, "nu must be between 0 and 1e7" |
163 | 162 |
|
164 | 163 | z = np.zeros(k) |
165 | 164 |
|
@@ -198,10 +197,9 @@ def besselj_zeros(nu, k): |
198 | 197 | z[n : n + j] = besselj_newton(nu, z0) |
199 | 198 |
|
200 | 199 | # Check to see that the sequence of zeros makes sense |
201 | | - ensure( |
202 | | - check_besselj_zeros(nu, z[n - 2 : n + j]), |
203 | | - "Unable to properly estimate Bessel function zeros.", |
204 | | - ) |
| 200 | + assert check_besselj_zeros( |
| 201 | + nu, z[n - 2 : n + j] |
| 202 | + ), "Unable to properly estimate Bessel function zeros." |
205 | 203 |
|
206 | 204 | # Check how far off we are |
207 | 205 | err = (z[n : n + j] - z0) / np.diff(z[n - 1 : n + j]) |
@@ -236,10 +234,11 @@ def unique_coords_nd(N, ndim, shifted=False, normalized=True, dtype=np.float32): |
236 | 234 | :param normalized: normalize the grid or not. |
237 | 235 | :return: The unique polar coordinates in 2D or 3D |
238 | 236 | """ |
239 | | - ensure( |
240 | | - ndim in (2, 3), "Only two- or three-dimensional basis functions are supported." |
241 | | - ) |
242 | | - ensure(N > 0, "Number of grid points should be greater than 0.") |
| 237 | + assert ndim in ( |
| 238 | + 2, |
| 239 | + 3, |
| 240 | + ), "Only two- or three-dimensional basis functions are supported." |
| 241 | + assert N > 0, "Number of grid points should be greater than 0." |
243 | 242 |
|
244 | 243 | if ndim == 2: |
245 | 244 | grid = grid_2d( |
|
0 commit comments