diff options
author | pierregm <pierregm@localhost> | 2008-08-12 21:12:14 +0000 |
---|---|---|
committer | pierregm <pierregm@localhost> | 2008-08-12 21:12:14 +0000 |
commit | 31b18be11e48894738aa58620ac2d2307c8b4932 (patch) | |
tree | 6fd9381d71e7df2c0403dc437d587e4f732ef0a7 /numpy/ma/core.py | |
parent | 96a6fcc6218e2487662706ad646194c8c22b8cc6 (diff) | |
download | numpy-31b18be11e48894738aa58620ac2d2307c8b4932.tar.gz |
* masked_where : force a consistency check on the shapes of the inputs
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r-- | numpy/ma/core.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 0b5372fa3..a31cbef1b 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -884,6 +884,11 @@ def masked_where(condition, a, copy=True): """ cond = make_mask(condition) a = np.array(a, copy=copy, subok=True) + + (cshape, ashape) = (cond.shape, a.shape) + if cshape and cshape != ashape: + raise IndexError("Inconsistant shape between the condition and the input"\ + " (got %s and %s)" % (cshape, ashape)) if hasattr(a, '_mask'): cond = mask_or(cond, a._mask) cls = type(a) |