[Scipy-svn] r5114 - trunk/scipy/stats/tests

scipy-svn@scip... scipy-svn@scip...
Fri Nov 14 22:03:46 CST 2008


Author: josef
Date: 2008-11-14 22:03:44 -0600 (Fri, 14 Nov 2008)
New Revision: 5114

Modified:
   trunk/scipy/stats/tests/test_continuous_basic.py
Log:
small improvements to tests for continuous rv

Modified: trunk/scipy/stats/tests/test_continuous_basic.py
===================================================================
--- trunk/scipy/stats/tests/test_continuous_basic.py	2008-11-15 03:50:40 UTC (rev 5113)
+++ trunk/scipy/stats/tests/test_continuous_basic.py	2008-11-15 04:03:44 UTC (rev 5114)
@@ -22,7 +22,7 @@
     ['anglit', ()],
     ['arcsine', ()],
     ['beta', (2.3098496451481823, 0.62687954300963677)],
-    ['betaprime', (100, 86)],
+    ['betaprime', (5, 6)],   # avoid unbound error in entropy with (100, 86)],
     ['bradford', (0.29891359763170633,)],
     ['burr', (0.94839838075366045, 4.3820284068855795)],
     ['cauchy', ()],
@@ -50,7 +50,7 @@
     ['gengamma', (4.4162385429431925, 3.1193091679242761)],
     ['genhalflogistic', (0.77274727809929322,)],
     ['genlogistic', (0.41192440799679475,)],
-    ['genpareto', (4.4566867037959144,)],
+    ['genpareto', (0.1,)],   # use case with finite moments
     ['gilbrat', ()],
     ['gompertz', (0.94743713075105251,)],
     ['gumbel_l', ()],
@@ -135,14 +135,14 @@
     m,v = distfn.stats(*arg)
     m1  = distfn.moment(1,*arg)
     m2  = distfn.moment(2,*arg)
-    if m < np.inf:
+    if not np.isinf(m):
         npt.assert_almost_equal(m1, m, decimal=10, err_msg= msg + \
                             ' - 1st moment')
     else:
         assert np.isinf(m1) or np.isnan(m1), \
                msg + ' - 1st moment -infinite, m1=%s' % str(m1)
         #np.isnan(m1) temporary special treatment for loggamma
-    if v < np.inf:
+    if not np.isinf(v):
         npt.assert_almost_equal(m2-m1*m1, v, decimal=10, err_msg= msg + \
                             ' - 2ndt moment')
     else:
@@ -161,16 +161,15 @@
     check_sample_meanvar, ss, s, msg + 'sample kurtosis test'
 
 def check_sample_meanvar(sm,m,msg):
-
-    if m < np.inf:
+    if not np.isinf(m):
         npt.assert_almost_equal(sm, m, decimal=DECIMAL, err_msg= msg + \
                                 ' - finite moment')
     else:
         assert sm > 10000, 'infinite moment, sm = ' + str(sm)
 
 def check_cdf_ppf(distfn,arg,msg):
-    npt.assert_almost_equal(distfn.cdf(distfn.ppf([0.1,0.5,0.9], *arg), *arg),
-                            [0.1,0.5,0.9], decimal=DECIMAL, err_msg= msg + \
+    npt.assert_almost_equal(distfn.cdf(distfn.ppf([0.001,0.5,0.990], *arg), *arg),
+                            [0.001,0.5,0.999], decimal=DECIMAL, err_msg= msg + \
                             ' - cdf-ppf roundtrip')
 
 def check_sf_isf(distfn,arg,msg):



More information about the Scipy-svn mailing list