summaryrefslogtreecommitdiff
path: root/numpy/oldnumeric/ma.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/oldnumeric/ma.py')
-rw-r--r--numpy/oldnumeric/ma.py52
1 files changed, 26 insertions, 26 deletions
diff --git a/numpy/oldnumeric/ma.py b/numpy/oldnumeric/ma.py
index 1284c6019..d30f673a8 100644
--- a/numpy/oldnumeric/ma.py
+++ b/numpy/oldnumeric/ma.py
@@ -122,7 +122,7 @@ def minimum_fill_value (obj):
if x in typecodes['UnsignedInteger']:
return sys.maxint
else:
- raise TypeError, 'Unsuitable type for calculating minimum.'
+ raise TypeError('Unsuitable type for calculating minimum.')
def maximum_fill_value (obj):
"Function to calculate default fill value suitable for taking maxima."
@@ -139,7 +139,7 @@ def maximum_fill_value (obj):
if x in typecodes['UnsignedInteger']:
return 0
else:
- raise TypeError, 'Unsuitable type for calculating maximum.'
+ raise TypeError('Unsuitable type for calculating maximum.')
def set_fill_value (a, fill_value):
"Set fill value of a if it is a masked array."
@@ -598,7 +598,7 @@ class MaskedArray (object):
self._data = fromnumeric.resize(self._data, self._mask.shape)
self._data.shape = self._mask.shape
else:
- raise MAError, "Mask and data not compatible."
+ raise MAError("Mask and data not compatible.")
elif nm == 1 and shape(self._mask) != shape(self._data):
self.unshare_mask()
self._mask.shape = self._data.shape
@@ -786,14 +786,14 @@ array(data = %(data)s,
"Convert self to float."
self.unmask()
if self._mask is not nomask:
- raise MAError, 'Cannot convert masked element to a Python float.'
+ raise MAError('Cannot convert masked element to a Python float.')
return float(self.data.item())
def __int__(self):
"Convert self to int."
self.unmask()
if self._mask is not nomask:
- raise MAError, 'Cannot convert masked element to a Python int.'
+ raise MAError('Cannot convert masked element to a Python int.')
return int(self.data.item())
def __getitem__(self, i):
@@ -827,7 +827,7 @@ array(data = %(data)s,
"Set item described by index. If value is masked, mask those locations."
d = self._data
if self is masked:
- raise MAError, 'Cannot alter masked elements.'
+ raise MAError('Cannot alter masked elements.')
if value is masked:
if self._mask is nomask:
self._mask = make_mask_none(d.shape)
@@ -973,14 +973,14 @@ array(data = %(data)s,
if t1 in typecodes['Integer']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
elif t in typecodes['Float']:
if t1 in typecodes['Integer']:
f = f.astype(t)
elif t1 in typecodes['Float']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
elif t in typecodes['Complex']:
if t1 in typecodes['Integer']:
f = f.astype(t)
@@ -989,9 +989,9 @@ array(data = %(data)s,
elif t1 in typecodes['Complex']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
if self._mask is nomask:
self._data += f
@@ -1016,14 +1016,14 @@ array(data = %(data)s,
if t1 in typecodes['Integer']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
elif t in typecodes['Float']:
if t1 in typecodes['Integer']:
f = f.astype(t)
elif t1 in typecodes['Float']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
elif t in typecodes['Complex']:
if t1 in typecodes['Integer']:
f = f.astype(t)
@@ -1032,9 +1032,9 @@ array(data = %(data)s,
elif t1 in typecodes['Complex']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
if self._mask is nomask:
self._data *= f
@@ -1059,14 +1059,14 @@ array(data = %(data)s,
if t1 in typecodes['Integer']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
elif t in typecodes['Float']:
if t1 in typecodes['Integer']:
f = f.astype(t)
elif t1 in typecodes['Float']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
elif t in typecodes['Complex']:
if t1 in typecodes['Integer']:
f = f.astype(t)
@@ -1075,9 +1075,9 @@ array(data = %(data)s,
elif t1 in typecodes['Complex']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
if self._mask is nomask:
self._data -= f
@@ -1104,14 +1104,14 @@ array(data = %(data)s,
if t1 in typecodes['Integer']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
elif t in typecodes['Float']:
if t1 in typecodes['Integer']:
f = f.astype(t)
elif t1 in typecodes['Float']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
elif t in typecodes['Complex']:
if t1 in typecodes['Integer']:
f = f.astype(t)
@@ -1120,9 +1120,9 @@ array(data = %(data)s,
elif t1 in typecodes['Complex']:
f = f.astype(t)
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
else:
- raise TypeError, 'Incorrect type for in-place operation.'
+ raise TypeError('Incorrect type for in-place operation.')
mo = getmask(other)
result = divide(self, masked_array(f, mask=mo))
self._data = result.data
@@ -1567,7 +1567,7 @@ def count (a, axis = None):
def power (a, b, third=None):
"a**b"
if third is not None:
- raise MAError, "3-argument power not supported."
+ raise MAError("3-argument power not supported.")
ma = getmask(a)
mb = getmask(b)
m = mask_or(ma, mb)
@@ -1665,7 +1665,7 @@ def new_average (a, axis=None, weights=None, returned = 0):
d = add.reduce(w, axis)
del w, r
else:
- raise ValueError, 'average: weights wrong shape.'
+ raise ValueError('average: weights wrong shape.')
else:
if weights is None:
n = add.reduce(a, axis)
@@ -1688,7 +1688,7 @@ def new_average (a, axis=None, weights=None, returned = 0):
n = add.reduce(a*w, axis)
d = add.reduce(w, axis)
else:
- raise ValueError, 'average: weights wrong shape.'
+ raise ValueError('average: weights wrong shape.')
del w
#print n, d, repr(mask), repr(weights)
if n is masked or d is masked: return masked
@@ -2135,7 +2135,7 @@ from types import MethodType
def _m(f):
return MethodType(f, None, array)
def not_implemented(*args, **kwds):
- raise NotImplementedError, "not yet implemented for numpy.ma arrays"
+ raise NotImplementedError("not yet implemented for numpy.ma arrays")
array.all = _m(alltrue)
array.any = _m(sometrue)
array.argmax = _m(argmax)