summaryrefslogtreecommitdiff
path: root/numpy/ma
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-05-06 01:40:48 +0100
committerEric Wieser <wieser.eric@gmail.com>2017-05-06 12:21:02 +0100
commit156af61c8d19024bb9a71436d645b019cf35670b (patch)
tree78783895abdc016226a832fcf816f2225fb22f79 /numpy/ma
parent858a4ffa3c614c746252abf60ee37eda43857b90 (diff)
downloadnumpy-156af61c8d19024bb9a71436d645b019cf35670b.tar.gz
MAINT: add __doc__ to minimum
Also, remove unecessary subclasses
Diffstat (limited to 'numpy/ma')
-rw-r--r--numpy/ma/core.py40
1 files changed, 8 insertions, 32 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index e1da2832e..bccb0bce1 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -6367,10 +6367,12 @@ class _extrema_operation(object):
`_minimum_operation`.
"""
-
- @property
- def __name__(self):
- return self.ufunc.__name__
+ def __init__(self, ufunc, compare, fill_value):
+ self.ufunc = ufunc
+ self.compare = compare
+ self.fill_value_func = fill_value
+ self.__doc__ = ufunc.__doc__
+ self.__name__ = ufunc.__name__
def __call__(self, a, b=None):
"Executes the call behavior."
@@ -6433,32 +6435,6 @@ class _extrema_operation(object):
result._mask = m
return result
-
-class _minimum_operation(_extrema_operation):
-
- "Object to calculate minima"
-
- def __init__(self):
- """minimum(a, b) or minimum(a)
-In one argument case, returns the scalar minimum.
- """
- self.ufunc = umath.minimum
- self.compare = less
- self.fill_value_func = minimum_fill_value
-
-
-class _maximum_operation(_extrema_operation):
-
- "Object to calculate maxima"
-
- def __init__(self):
- """maximum(a, b) or maximum(a)
- In one argument case returns the scalar maximum.
- """
- self.ufunc = umath.maximum
- self.compare = greater
- self.fill_value_func = maximum_fill_value
-
def min(obj, axis=None, out=None, fill_value=None, keepdims=np._NoValue):
kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims}
@@ -6554,9 +6530,9 @@ copy = _frommethod('copy')
diagonal = _frommethod('diagonal')
harden_mask = _frommethod('harden_mask')
ids = _frommethod('ids')
-maximum = _maximum_operation()
+maximum = _extrema_operation(umath.maximum, greater, maximum_fill_value)
mean = _frommethod('mean')
-minimum = _minimum_operation()
+minimum = _extrema_operation(umath.minimum, less, minimum_fill_value)
nonzero = _frommethod('nonzero')
prod = _frommethod('prod')
product = _frommethod('prod')