[Scipy-svn] r7094 - in trunk/scipy/stats: . tests

scipy-svn at scipy.org scipy-svn at scipy.org
Fri Jan 28 18:06:33 EST 2011


Author: rkern
Date: 2011-01-28 17:06:33 -0600 (Fri, 28 Jan 2011)
New Revision: 7094

Modified:
   trunk/scipy/stats/distributions.py
   trunk/scipy/stats/tests/test_distributions.py
Log:
BUG: Correct the argument check for Tukey-Lambda. Any real lambda is acceptable now.

Modified: trunk/scipy/stats/distributions.py
===================================================================
--- trunk/scipy/stats/distributions.py	2011-01-28 22:56:05 UTC (rev 7093)
+++ trunk/scipy/stats/distributions.py	2011-01-28 23:06:33 UTC (rev 7094)
@@ -4358,6 +4358,9 @@
 
 # FIXME: RVS does not work.
 class tukeylambda_gen(rv_continuous):
+    def _argcheck(self, lam):
+        # lam in RR.
+        return np.ones(np.shape(lam), dtype=bool)
     def _pdf(self, x, lam):
         Fx = arr(special.tklmbda(x,lam))
         Px = Fx**(lam-1.0) + (arr(1-Fx))**(lam-1.0)

Modified: trunk/scipy/stats/tests/test_distributions.py
===================================================================
--- trunk/scipy/stats/tests/test_distributions.py	2011-01-28 22:56:05 UTC (rev 7093)
+++ trunk/scipy/stats/tests/test_distributions.py	2011-01-28 23:06:33 UTC (rev 7094)
@@ -671,10 +671,12 @@
     """
     x = np.linspace(-5.0, 5.0, 101)
     for lam in [0.0, -1.0, -2.0, np.array([[-1.0], [0.0], [-2.0]])]:
-        p = stats.tukeylambda._pdf(x, lam)
+        p = stats.tukeylambda.pdf(x, lam)
         assert_((p != 0.0).all())
+        assert_(~np.isnan(p).all())
     lam = np.array([[-1.0], [0.0], [2.0]])
-    p = stats.tukeylambda._pdf(x, lam)
+    p = stats.tukeylambda.pdf(x, lam)
+    assert_(~np.isnan(p).all())
     assert_((p[0] != 0.0).all())
     assert_((p[1] != 0.0).all())
     assert_((p[2] != 0.0).any())




More information about the Scipy-svn mailing list