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

scipy-svn@scip... scipy-svn@scip...
Mon Jan 7 22:13:02 CST 2008


Author: dhuard
Date: 2008-01-07 22:12:38 -0600 (Mon, 07 Jan 2008)
New Revision: 3797

Modified:
   trunk/scipy/stats/distributions.py
Log:
Fixed ticket 422 related to the generic computation of moments.

Modified: trunk/scipy/stats/distributions.py
===================================================================
--- trunk/scipy/stats/distributions.py	2008-01-08 01:26:20 UTC (rev 3796)
+++ trunk/scipy/stats/distributions.py	2008-01-08 04:12:38 UTC (rev 3797)
@@ -303,15 +303,17 @@
         self.vecentropy = sgf(self._entropy,otypes='d')
         self.veccdf = sgf(self._cdf_single_call,otypes='d')
         self.expandarr = 1
-        if momtype == 0:
-            self.generic_moment = sgf(self._mom0_sc,otypes='d')
-        else:
-            self.generic_moment = sgf(self._mom1_sc,otypes='d')
         cdf_signature = inspect.getargspec(self._cdf.im_func)
         numargs1 = len(cdf_signature[0]) - 2
         pdf_signature = inspect.getargspec(self._pdf.im_func)
         numargs2 = len(pdf_signature[0]) - 2
         self.numargs = max(numargs1, numargs2)
+        if momtype == 0:
+            self.generic_moment = sgf(self._mom0_sc,otypes='d')
+        else:
+            self.generic_moment = sgf(self._mom1_sc,otypes='d')
+        self.generic_moment.nin = self.numargs+1 # Because of the *args argument
+        # of _mom0_sc, vectorize cannot count the number of arguments correctly.
 
         if longname is None:
             if name[0] in ['aeiouAEIOU']: hstr = "An "



More information about the Scipy-svn mailing list