[Numpy-svn] r3168 - in trunk/numpy/lib: . tests

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Sep 15 17:58:49 CDT 2006


Author: oliphant
Date: 2006-09-15 17:58:26 -0500 (Fri, 15 Sep 2006)
New Revision: 3168

Modified:
   trunk/numpy/lib/function_base.py
   trunk/numpy/lib/tests/test_function_base.py
Log:
Rename to histogramdd as original author said.

Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py	2006-09-15 22:40:54 UTC (rev 3167)
+++ trunk/numpy/lib/function_base.py	2006-09-15 22:58:26 UTC (rev 3168)
@@ -4,7 +4,7 @@
            'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp',
            'unique', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax',
            'nanargmin', 'nanmin', 'vectorize', 'asarray_chkfinite', 'average',
-           'histogram', 'histogramnd', 'bincount', 'digitize', 'cov',
+           'histogram', 'histogramdd', 'bincount', 'digitize', 'cov',
            'corrcoef', 'msort', 'median', 'sinc', 'hamming', 'hanning',
            'bartlett', 'blackman', 'kaiser', 'trapz', 'i0', 'add_newdoc',
            'add_docstring', 'meshgrid', 'delete', 'insert', 'append'
@@ -103,14 +103,14 @@
     else:
         return n, bins
 
-def histogramnd(sample, bins=10, range=None, normed=False):
-    """histogramnd(sample, bins = 10, range = None, normed = False) -> H, edges
+def histogramdd(sample, bins=10, range=None, normed=False):
+    """histogramdd(sample, bins = 10, range = None, normed = False) -> H, edges
     
-    Return the N-dimensional histogram computed from sample.
+    Return the D-dimensional histogram computed from sample.
     
     Parameters
     ----------
-    sample: A sequence of N arrays, or an KxN array. 
+    sample: A sequence of D arrays, or an NxD array. 
     bins:   A sequence of edge arrays, or a sequence of the number of bins. 
             If a scalar is given, it is assumed to be the number of bins
             for all dimensions. 
@@ -126,7 +126,7 @@
     
     Example:
     x = random.randn(100,3)
-    H, edges = histogramnd(x, bins = (5, 6, 7))
+    H, edges = histogramdd(x, bins = (5, 6, 7))
     
     See also: histogram
     """

Modified: trunk/numpy/lib/tests/test_function_base.py
===================================================================
--- trunk/numpy/lib/tests/test_function_base.py	2006-09-15 22:40:54 UTC (rev 3167)
+++ trunk/numpy/lib/tests/test_function_base.py	2006-09-15 22:58:26 UTC (rev 3168)
@@ -353,24 +353,24 @@
         (a,b)=histogram(linspace(0,10,100))
         assert(all(a==10))
 
-class test_histogramnd(NumpyTestCase):
+class test_histogramdd(NumpyTestCase):
     def check_simple(self):
         x = array([[-.5, .5, 1.5], [-.5, 1.5, 2.5], [-.5, 2.5, .5], \
         [.5, .5, 1.5], [.5, 1.5, 2.5], [.5, 2.5, 2.5]])
-        H, edges = histogramnd(x, (2,3,3), range = [[-1,1], [0,3], [0,3]])
+        H, edges = histogramdd(x, (2,3,3), range = [[-1,1], [0,3], [0,3]])
         answer = asarray([[[0,1,0], [0,0,1], [1,0,0]], [[0,1,0], [0,0,1], [0,0,1]]])
         assert(all(H == answer))
         # Check normalization
         ed = [[-2,0,2], [0,1,2,3], [0,1,2,3]]
-        H, edges = histogramnd(x, bins = ed, normed = True)
+        H, edges = histogramdd(x, bins = ed, normed = True)
         assert(all(H == answer/12.))
         # Check that H has the correct shape.
-        H, edges = histogramnd(x, (2,3,4), range = [[-1,1], [0,3], [0,4]], normed=True)
+        H, edges = histogramdd(x, (2,3,4), range = [[-1,1], [0,3], [0,4]], normed=True)
         answer = asarray([[[0,1,0,0], [0,0,1,0], [1,0,0,0]], [[0,1,0,0], [0,0,1,0], [0,0,1,0]]])
         assert_array_almost_equal(H, answer/6., 4)
         # Check that a sequence of arrays is accepted and H has the correct shape.
         z = [squeeze(y) for y in split(x,3,axis=1)]
-        H, edges = histogramnd(z, bins=(4,3,2),range=[[-2,2], [0,3], [0,2]])
+        H, edges = histogramdd(z, bins=(4,3,2),range=[[-2,2], [0,3], [0,2]])
         answer = asarray([[[0,0],[0,0],[0,0]], 
                           [[0,1], [0,0], [1,0]], 
                           [[0,1], [0,0],[0,0]], 



More information about the Numpy-svn mailing list