[Numpy-svn] r3539 - trunk/numpy/lib

numpy-svn@scip... numpy-svn@scip...
Mon Feb 5 14:58:35 CST 2007


Author: rkern
Date: 2007-02-05 14:58:32 -0600 (Mon, 05 Feb 2007)
New Revision: 3539

Modified:
   trunk/numpy/lib/function_base.py
Log:
Flesh out the docstring for histogram() to address the concerns of #445.

Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py	2007-02-05 00:24:42 UTC (rev 3538)
+++ trunk/numpy/lib/function_base.py	2007-02-05 20:58:32 UTC (rev 3539)
@@ -67,21 +67,31 @@
     return 1
 
 def histogram(a, bins=10, range=None, normed=False):
-    """histogram(sample, bins = 10, range = None, normed = False) -> H, ledges
+    """Compute the histogram from a set of data.
 
-    Return the distribution of a sample.
+    :Parameters:
+      - `a` : array
+        The data to histogram. n-D arrays will be flattened.
+      - `bins` : int or sequence of floats, optional
+        If an int, then the number of equal-width bins in the given range.
+        Otherwise, a sequence of the lower bound of each bin.
+      - `range` : (float, float), optional
+        The lower and upper range of the bins. If not provided, then (a.min(),
+        a.max()) is used. Values outside of this range are allocated to the
+        closest bin.
+      - `normed` : bool, optional
+        If False, the result array will contain the number of samples in each bin.
+        If True, the result array is the value of the probability *density*
+        function at the bin normalized such that the *integral* over the range
+        is 1. Note that the sum of all of the histogram values will not usually
+        be 1; it is not a probability *mass* function.
 
-    Parameters
-    ----------
-    bins: Number of bins
-    range: Lower and upper bin edges (default: [sample.min(), sample.max()]).
-        All values greater than range are stored in the last bin.
-    normed: If False (default), return the number of samples in each bin.
-        If True, return a frequency distribution.
-
-    Output
-    ------
-    histogram array, left bin edges array.
+    :Returns:
+      - `hist` : array (n,)
+        The values of the histogram. See `normed` for a description of the
+        possible semantics.
+      - `lower_edges` : float array (n,)
+        The lower edges of each bin.
     """
     a = asarray(a).ravel()
     if not iterable(bins):



More information about the Numpy-svn mailing list