Skip to content

Commit

Permalink
Stop using deprecated interp2d function
Browse files Browse the repository at this point in the history
  • Loading branch information
rmjarvis committed Jul 17, 2023
1 parent 9c60812 commit ff3e145
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def f(x_):
def test_table2d():
"""Check LookupTable2D functionality.
"""
from scipy.interpolate import interp2d
from scipy.interpolate import RectBivariateSpline

def f(x_, y_):
return np.sin(x_) * np.cos(y_) + x_
Expand Down Expand Up @@ -437,8 +437,8 @@ def f(x_, y_):
for x0 in newx]
for y0 in newy]))

scitab2d = interp2d(x, y, z)
np.testing.assert_array_almost_equal(ref, scitab2d(newx, newy))
scitab2d = RectBivariateSpline(x, y, z.T, kx=1, ky=1)
np.testing.assert_array_almost_equal(ref, scitab2d(newx, newy).T)

# Try using linear GSInterp
tab2d2 = galsim.LookupTable2D(x, y, z, interpolant=galsim.Linear())
Expand Down Expand Up @@ -466,8 +466,8 @@ def f(x_, y_):
np.testing.assert_array_almost_equal(ref, np.array([[tab2d(x0, y0)
for x0 in newx]
for y0 in newy]))
scitab2d = interp2d(x, y, z)
np.testing.assert_array_almost_equal(ref, scitab2d(newx, newy))
scitab2d = RectBivariateSpline(x, y, z.T, kx=1, ky=1)
np.testing.assert_array_almost_equal(ref, scitab2d(newx, newy).T)

# Using a galsim.Interpolant should raise an exception if x/y are not equal spaced.
with assert_raises(galsim.GalSimIncompatibleValuesError):
Expand Down

0 comments on commit ff3e145

Please sign in to comment.