[Scipy-svn] r7131 - trunk/scipy/stats

scipy-svn at scipy.org scipy-svn at scipy.org
Thu Feb 10 03:58:58 EST 2011


Author: oliphant
Date: 2011-02-10 02:58:58 -0600 (Thu, 10 Feb 2011)
New Revision: 7131

Modified:
   trunk/scipy/stats/distributions.py
Log:
Fix documentation error.  Fix location and scale arguments to moment method as well as a calculation with them.

Modified: trunk/scipy/stats/distributions.py
===================================================================
--- trunk/scipy/stats/distributions.py	2011-02-10 08:57:59 UTC (rev 7130)
+++ trunk/scipy/stats/distributions.py	2011-02-10 08:58:58 UTC (rev 7131)
@@ -217,7 +217,7 @@
 """
 _doc_interval = \
 """interval(alpha, %(shapes)s, loc=0, scale=1)
-    Endpoints of the range that contains alpha % of the distribution
+    Endpoints of the range that contains alpha %% of the distribution
 """
 _doc_allmethods = ''.join([docheaders['methods'], _doc_rvs, _doc_pdf,
                            _doc_logpdf, _doc_cdf, _doc_logcdf, _doc_sf, 
@@ -1663,7 +1663,8 @@
             scale parameter (default=1)
 
         """
-        loc, scale = map(kwds.get,['loc','scale'])
+        loc = kwds.get('loc', 0)
+        scale = kwds.get('scale', 1)
         if not (self._argcheck(*args) and (scale > 0)):
             return nan
         if (floor(n) != n):
@@ -1685,7 +1686,7 @@
             return scale**n * val
         else:
             result = 0
-            fac = scale / loc
+            fac = float(scale) / float(loc)
             for k in range(n):
                 valk = _moment_from_stats(k, mu, mu2, g1, g2, self._munp, args)
                 result += comb(n,k,exact=True)*(fac**k) * valk
@@ -5590,7 +5591,8 @@
             scale parameter (default=1)
 
         """
-        loc, scale = map(kwds.get,['loc','scale'])
+        loc = kwds.get('loc', 0)
+        scale = kwds.get('scale', 1)
         if not (self._argcheck(*args) and (scale > 0)):
             return nan
         if (floor(n) != n):
@@ -5612,7 +5614,7 @@
             return scale**n * val
         else:
             result = 0
-            fac = scale / loc
+            fac = float(scale) / float(loc)
             for k in range(n):
                 valk = _moment_from_stats(k, mu, mu2, g1, g2, self._munp, args)
                 result += comb(n,k,exact=True)*(fac**k) * valk




More information about the Scipy-svn mailing list