Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ENH: add angle() function to ma

  • Loading branch information...
commit 4c356098a81c019eb141e444a09f6ea2a14166a2 1 parent 0c1c499
@efiring efiring authored teoliphant committed
Showing with 5 additions and 1 deletion.
  1. +3 −1 numpy/ma/core.py
  2. +2 −0  numpy/ma/tests/test_core.py
View
4 numpy/ma/core.py
@@ -27,7 +27,7 @@
__all__ = ['MAError', 'MaskError', 'MaskType', 'MaskedArray',
'bool_',
'abs', 'absolute', 'add', 'all', 'allclose', 'allequal', 'alltrue',
- 'amax', 'amin', 'anom', 'anomalies', 'any', 'arange',
+ 'amax', 'amin', 'angle', 'anom', 'anomalies', 'any', 'arange',
'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctan2',
'arctanh', 'argmax', 'argmin', 'argsort', 'around',
'array', 'asarray', 'asanyarray',
@@ -74,6 +74,7 @@
from numpy import array as narray
import numpy.core.umath as umath
+from numpy.lib.function_base import angle
import numpy.core.numerictypes as ntypes
from numpy.compat import getargspec, formatargspec
from numpy import expand_dims as n_expand_dims
@@ -1117,6 +1118,7 @@ def __str__ (self):
cosh = _MaskedUnaryOperation(umath.cosh)
tanh = _MaskedUnaryOperation(umath.tanh)
abs = absolute = _MaskedUnaryOperation(umath.absolute)
+angle = _MaskedUnaryOperation(angle) # from numpy.lib.function_base
fabs = _MaskedUnaryOperation(umath.fabs)
negative = _MaskedUnaryOperation(umath.negative)
floor = _MaskedUnaryOperation(umath.floor)
View
2  numpy/ma/tests/test_core.py
@@ -811,6 +811,8 @@ def test_basic_ufuncs (self):
assert_equal(np.arctan(z), arctan(zm))
assert_equal(np.arctan2(x, y), arctan2(xm, ym))
assert_equal(np.absolute(x), absolute(xm))
+ assert_equal(np.angle(x + 1j*y), angle(xm + 1j*ym))
+ assert_equal(np.angle(x + 1j*y, deg=True), angle(xm + 1j*ym, deg=True))
assert_equal(np.equal(x, y), equal(xm, ym))
assert_equal(np.not_equal(x, y), not_equal(xm, ym))
assert_equal(np.less(x, y), less(xm, ym))

0 comments on commit 4c35609

Please sign in to comment.
Something went wrong with that request. Please try again.