[Scipy-svn] r4612 - branches/stats_models/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Thu Aug 7 21:29:18 EDT 2008
Author: tom.waite
Date: 2008-08-07 20:29:16 -0500 (Thu, 07 Aug 2008)
New Revision: 4612
Modified:
branches/stats_models/tests/test_bspline.py
Log:
weave to c-ext
Modified: branches/stats_models/tests/test_bspline.py
===================================================================
--- branches/stats_models/tests/test_bspline.py 2008-08-07 23:42:44 UTC (rev 4611)
+++ branches/stats_models/tests/test_bspline.py 2008-08-08 01:29:16 UTC (rev 4612)
@@ -2,26 +2,39 @@
Test functions for models.bspline
"""
-import numpy as N
+import numpy as np
from numpy.testing import *
+import scipy.stats.models._bspline as bsp
-import scipy.stats.models as S
-try:
- import scipy.stats.models.bspline as B
-except ImportError:
- B = None
-
-
class TestBSpline(TestCase):
def test1(self):
- if B:
- b = B.BSpline(N.linspace(0,10,11), x=N.linspace(0,10,101))
- old = b._basisx.shape
- b.x = N.linspace(0,10,51)
- new = b._basisx.shape
- self.assertEqual((old[0], 51), new)
+ b = bsp.BSpline(np.linspace(0,10,11), x=np.linspace(0,10,101))
+ old = b._basisx.shape
+ b.x = np.linspace(0,10,51)
+ new = b._basisx.shape
+ self.assertEqual((old[0], 51), new)
+ def test2(self):
+ b = bsp.BSpline(np.linspace(0,1,11))
+ x = np.array([0.4, 0.5])
+ v = b.basis(x, lower=0, upper=13)
+ t = np.array([[ 0. , 0. ],
+ [ 0. , 0. ],
+ [ 0. , 0. ],
+ [ 0. , 0. ],
+ [ 0.16666667, 0. ],
+ [ 0.66666667, 0.16666667],
+ [ 0.16666667, 0.66666667],
+ [ 0. , 0.16666667],
+ [ 0. , 0. ],
+ [ 0. , 0. ],
+ [ 0. , 0. ],
+ [ 0. , 0. ],
+ [ 0. , 0. ]])
+ assert_array_almost_equal(v, t, decimal=6)
+
+
if __name__ == "__main__":
run_module_suite()
More information about the Scipy-svn
mailing list