Skip to content

Commit

Permalink
TST: silence floating point test noise in interpolate.
Browse files Browse the repository at this point in the history
(backport of r7035)
  • Loading branch information
rgommers committed Jan 16, 2011
1 parent b97cb55 commit 8d549a2
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions scipy/interpolate/tests/test_rbf.py
Expand Up @@ -2,6 +2,7 @@
# Created by John Travers, Robert Hetland, 2007
""" Test functions for rbf module """

import numpy as np
from numpy.testing import assert_, assert_array_almost_equal, assert_almost_equal
from numpy import linspace, sin, random, exp, allclose
from scipy.interpolate.rbf import Rbf
Expand Down Expand Up @@ -40,10 +41,14 @@ def check_rbf3d_interpolation(function):
assert_array_almost_equal(di, d)

def test_rbf_interpolation():
for function in FUNCTIONS:
yield check_rbf1d_interpolation, function
yield check_rbf2d_interpolation, function
yield check_rbf3d_interpolation, function
olderr = np.seterr(all="ignore")
try:
for function in FUNCTIONS:
yield check_rbf1d_interpolation, function
yield check_rbf2d_interpolation, function
yield check_rbf3d_interpolation, function
finally:
np.seterr(**olderr)

def check_rbf1d_regularity(function, atol):
"""Check that the Rbf function approximates a smooth function well away
Expand Down Expand Up @@ -71,8 +76,12 @@ def test_rbf_regularity():
'thin-plate': 0.1,
'linear': 0.2
}
for function in FUNCTIONS:
yield check_rbf1d_regularity, function, tolerances.get(function, 1e-2)
olderr = np.seterr(all="ignore")
try:
for function in FUNCTIONS:
yield check_rbf1d_regularity, function, tolerances.get(function, 1e-2)
finally:
np.seterr(**olderr)

def test_default_construction():
"""Check that the Rbf class can be constructed with the default
Expand Down

0 comments on commit 8d549a2

Please sign in to comment.