summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 2c7b78e5c..0ca570190 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -108,6 +108,12 @@ def histogram(a, bins=10, range=None, normed=False):
"""
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 @@ def histogram(a, bins=10, range=None, normed=False):
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