[Numpy-svn] r4256 - trunk/numpy/lib
numpy-svn at scipy.org
numpy-svn at scipy.org
Fri Oct 19 00:34:02 EDT 2007
Author: jarrod.millman
Date: 2007-10-18 23:33:58 -0500 (Thu, 18 Oct 2007)
New Revision: 4256
Modified:
trunk/numpy/lib/function_base.py
Log:
raise error if histogram is called with a decending range to bin into (see #586)
Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py 2007-10-19 04:14:17 UTC (rev 4255)
+++ trunk/numpy/lib/function_base.py 2007-10-19 04:33:58 UTC (rev 4256)
@@ -108,6 +108,12 @@
"""
a = asarray(a).ravel()
+
+ if (range is not None):
+ mn, mx = range
+ if (mn > mx):
+ raise AttributeError, 'max must be larger than min in range parameter.'
+
if not iterable(bins):
if range is None:
range = (a.min(), a.max())
@@ -116,6 +122,9 @@
mn -= 0.5
mx += 0.5
bins = linspace(mn, mx, bins, endpoint=False)
+ else:
+ if(any(bins[1:]-bins[:-1] < 0)):
+ raise AttributeError, 'bins must increase monotonically.'
# best block size probably depends on processor cache size
block = 65536
More information about the Numpy-svn
mailing list