[Scipy-svn] r3197 - trunk/Lib/stats

scipy-svn at scipy.org scipy-svn at scipy.org
Thu Jul 26 10:24:56 EDT 2007


Author: cdavid
Date: 2007-07-26 09:24:51 -0500 (Thu, 26 Jul 2007)
New Revision: 3197

Modified:
   trunk/Lib/stats/stats.py
Log:
add docstrings for nanmean, nanstd and nanmedian.

Modified: trunk/Lib/stats/stats.py
===================================================================
--- trunk/Lib/stats/stats.py	2007-07-26 13:47:33 UTC (rev 3196)
+++ trunk/Lib/stats/stats.py	2007-07-26 14:24:51 UTC (rev 3197)
@@ -243,7 +243,16 @@
 
 def nanmean(x, axis=0):
     """Compute the mean over the given axis ignoring nans.
-    """
+
+    :Parameters:
+        x : ndarray
+            input array
+        axis : int
+            axis along which the mean is computed.
+
+    :Results:
+        m : float
+            the mean."""
     x, axis = _chk_asarray(x,axis)
     x = x.copy()
     Norig = x.shape[axis]
@@ -254,7 +263,19 @@
 
 def nanstd(x, axis=0, bias=False):
     """Compute the standard deviation over the given axis ignoring nans
-    """
+
+    :Parameters:
+        x : ndarray
+            input array
+        axis : int
+            axis along which the standard deviation is computed.
+        bias : boolean
+            If true, the biased (normalized by N) definition is used. If false, 
+            the unbiased is used (the default).
+
+    :Results:
+        s : float
+            the standard deviation."""
     x, axis = _chk_asarray(x,axis)
     x = x.copy()
     Norig = x.shape[axis]
@@ -284,6 +305,15 @@
     return np.sqrt(m2c)
 
 def _nanmedian(arr1d):  # This only works on 1d arrays
+    """Private function for rank a arrays. Compute the median ignoring Nan.
+
+    :Parameters:
+        arr1d : rank 1 ndarray
+            input array
+
+    :Results:
+        m : float
+            the median."""
     cond = 1-np.isnan(arr1d)
     x = np.sort(np.compress(cond,arr1d,axis=-1))
     if x.size == 0:
@@ -292,7 +322,16 @@
 
 def nanmedian(x, axis=0):
     """ Compute the median along the given axis ignoring nan values
-    """
+
+    :Parameters:
+        x : ndarray
+            input array
+        axis : int
+            axis along which the median is computed.
+
+    :Results:
+        m : float
+            the median."""
     x, axis = _chk_asarray(x,axis)
     x = x.copy()
     return np.apply_along_axis(_nanmedian,axis,x)




More information about the Scipy-svn mailing list