[Numpy-svn] r4583 - in branches/maskedarray/numpy/ma: . tests

numpy-svn at scipy.org numpy-svn at scipy.org
Sat Dec 15 06:29:52 EST 2007


Author: stefan
Date: 2007-12-15 05:29:33 -0600 (Sat, 15 Dec 2007)
New Revision: 4583

Modified:
   branches/maskedarray/numpy/ma/core.py
   branches/maskedarray/numpy/ma/tests/test_old_ma.py
Log:
Reformat docstrings for 80 columns.


Modified: branches/maskedarray/numpy/ma/core.py
===================================================================
--- branches/maskedarray/numpy/ma/core.py	2007-12-15 02:53:30 UTC (rev 4582)
+++ branches/maskedarray/numpy/ma/core.py	2007-12-15 11:29:33 UTC (rev 4583)
@@ -121,7 +121,8 @@
     min_filler.update([(numpy.float128, numpy.inf)])
 
 def default_fill_value(obj):
-    """Calculates the default fill value for the argument object.
+    """Calculate the default fill value for the argument object.
+
     """
     if hasattr(obj,'dtype'):
         defval = default_filler[obj.dtype.kind]
@@ -140,7 +141,10 @@
     return defval
 
 def minimum_fill_value(obj):
-    "Calculates the default fill value suitable for taking the minimum of ``obj``."
+    """Calculate the default fill value suitable for taking the
+    minimum of ``obj``.
+
+    """
     if hasattr(obj, 'dtype'):
         objtype = obj.dtype
         filler = min_filler[objtype]
@@ -159,7 +163,10 @@
         raise TypeError, 'Unsuitable type for calculating minimum.'
 
 def maximum_fill_value(obj):
-    "Calculates the default fill value suitable for taking the maximum of ``obj``."
+    """Calculate the default fill value suitable for taking the maximum
+    of ``obj``.
+
+    """
     if hasattr(obj, 'dtype'):
         objtype = obj.dtype
         filler = max_filler[objtype]
@@ -178,19 +185,21 @@
         raise TypeError, 'Unsuitable type for calculating minimum.'
 
 def set_fill_value(a, fill_value):
-    """Sets the filling value of a, if a is a masked array.
-Otherwise, does nothing.
+    """Set the filling value of a, if a is a masked array.  Otherwise,
+    do nothing.
 
-*Returns*:
-    None
+    *Returns*:
+        None
+
     """
     if isinstance(a, MaskedArray):
         a.set_fill_value(fill_value)
     return
 
 def get_fill_value(a):
-    """Returns the filling value of a, if any.
-Otherwise, returns the default filling value for that type.
+    """Return the filling value of a, if any.  Otherwise, returns the
+    default filling value for that type.
+
     """
     if isinstance(a, MaskedArray):
         result = a.fill_value
@@ -199,8 +208,10 @@
     return result
 
 def common_fill_value(a, b):
-    """Returns the common filling value of a and b, if any.
-    If a and b have different filling values, returns None."""
+    """Return the common filling value of a and b, if any.
+    If a and b have different filling values, returns None.
+
+    """
     t1 = get_fill_value(a)
     t2 = get_fill_value(b)
     if t1 == t2:
@@ -209,18 +220,19 @@
 
 #####--------------------------------------------------------------------------
 def filled(a, value = None):
-    """Returns a as an array with masked data replaced by value.
-If value is None, get_fill_value(a) is used instead.
-If a is already a ndarray, a itself is returned.
+    """Return a as an array with masked data replaced by value.  If
+    value is None, get_fill_value(a) is used instead.  If a is already
+    a ndarray, a itself is returned.
 
-*Parameters*:
-    a : {var}
-        An input object.
-    value : {var}, optional
-        Filling value. If not given, the output of get_fill_value(a) is used instead.
+    *Parameters*:
+        a : {var}
+            An input object.
+        value : {var}, optional
+            Filling value. If not given, the output of
+            get_fill_value(a) is used instead.
 
-*Returns*:
-    A ndarray.
+    *Returns*:
+        A ndarray.
 
     """
     if hasattr(a, 'filled'):
@@ -234,8 +246,10 @@
 
 #####--------------------------------------------------------------------------
 def get_masked_subclass(*arrays):
-    """Returns the youngest subclass of MaskedArray from a list of (masked) arrays.
-In case of siblings, the first takes over."""
+    """Return the youngest subclass of MaskedArray from a list of
+    (masked) arrays.  In case of siblings, the first takes over.
+
+    """
     if len(arrays) == 1:
         arr = arrays[0]
         if isinstance(arr, MaskedArray):
@@ -254,14 +268,15 @@
 
 #####--------------------------------------------------------------------------
 def get_data(a, subok=True):
-    """Returns the _data part of a (if any), or a as a ndarray.
+    """Return the _data part of a (if any), or a as a ndarray.
 
-*Parameters* :
-    a : {ndarray}
-        A ndarray or a subclass of.
-    subok : {boolean}
-        Whether to force the output to a 'pure' ndarray (False) or to return a subclass
-        of ndarray if approriate (True).
+    *Parameters* :
+        a : {ndarray}
+            A ndarray or a subclass of.
+        subok : {boolean}
+            Whether to force the output to a 'pure' ndarray (False) or
+            to return a subclass of ndarray if approriate (True).
+
     """
     data = getattr(a, '_data', numpy.array(a, subok=subok))
     if not subok:
@@ -270,21 +285,23 @@
 getdata = get_data
 
 def fix_invalid(a, copy=True, fill_value=None):
-    """Returns (a copy of) a where invalid data (nan/inf) are masked and replaced
-by fill_value.
-Note that a copy is performed by default (just in case...).
-    
-*Parameters*:
-    a : {ndarray}
-        A (subclass of) ndarray.
-    copy : {boolean}
-        Whether to use a copy of a (True) or to fix a in place (False).
-    fill_value : {var}, optional
-        Value used for fixing invalid data.
-        If not given, the output of get_fill_value(a) is used instead.
+    """Return (a copy of) a where invalid data (nan/inf) are masked
+    and replaced by fill_value.
 
-*Returns* :
-    MaskedArray object
+    Note that a copy is performed by default (just in case...).
+
+    *Parameters*:
+        a : {ndarray}
+            A (subclass of) ndarray.
+        copy : {boolean}
+            Whether to use a copy of a (True) or to fix a in place (False).
+        fill_value : {var}, optional
+            Value used for fixing invalid data.
+            If not given, the output of get_fill_value(a) is used instead.
+
+    *Returns* :
+        MaskedArray object
+
     """
     a = masked_array(a, copy=copy, subok=True)
     invalid = (numpy.isnan(a._data) | numpy.isinf(a._data))
@@ -303,8 +320,12 @@
 ufunc_fills = {}
 
 class _DomainCheckInterval:
-    """Defines a valid interval, so that :
-``domain_check_interval(a,b)(x) = true`` where ``x < a`` or ``x > b``."""
+    """Define a valid interval, so that :
+
+    ``domain_check_interval(a,b)(x) = true`` where
+    ``x < a`` or ``x > b``.
+
+    """
     def __init__(self, a, b):
         "domain_check_interval(a,b)(x) = true where x < a or y > b"
         if (a > b):
@@ -313,13 +334,16 @@
         self.b = b
 
     def __call__ (self, x):
-        "Executes the call behavior."
+        "Execute the call behavior."
         return umath.logical_or(umath.greater (x, self.b),
                                 umath.less(x, self.a))
 #............................
 class _DomainTan:
-    """Defines a valid interval for the `tan` function, so that:
-``domain_tan(eps) = True`` where ``abs(cos(x)) < eps``"""
+    """Define a valid interval for the `tan` function, so that:
+
+    ``domain_tan(eps) = True`` where ``abs(cos(x)) < eps``
+
+    """
     def __init__(self, eps):
         "domain_tan(eps) = true where abs(cos(x)) < eps)"
         self.eps = eps
@@ -328,7 +352,7 @@
         return umath.less(umath.absolute(umath.cos(x)), self.eps)
 #............................
 class _DomainSafeDivide:
-    """Defines a domain for safe division."""
+    """Define a domain for safe division."""
     def __init__ (self, tolerance=divide_tolerance):
         self.tolerance = tolerance
     def __call__ (self, a, b):
@@ -356,12 +380,14 @@
 
 #..............................................................................
 class _MaskedUnaryOperation:
-    """Defines masked version of unary operations, where invalid values are pre-masked.
+    """Defines masked version of unary operations, where invalid
+    values are pre-masked.
 
-:IVariables:
-    f : function.
-    fill : Default filling value *[0]*.
-    domain : Default domain *[None]*.
+    *Parameters*:
+        f : function.
+        fill : Default filling value *[0]*.
+        domain : Default domain *[None]*.
+
     """
     def __init__ (self, mufunc, fill=0, domain=None):
         """ _MaskedUnaryOperation(aufunc, fill=0, domain=None)
@@ -378,7 +404,7 @@
         ufunc_fills[mufunc] = fill
     #
     def __call__ (self, a, *args, **kwargs):
-        "Executes the call behavior."
+        "Execute the call behavior."
         m = getmask(a)
         d1 = get_data(a)
         if self.domain is not None:
@@ -406,14 +432,15 @@
 
 #..............................................................................
 class _MaskedBinaryOperation:
-    """Defines masked version of binary operations,
-where invalid values are pre-masked.
+    """Define masked version of binary operations, where invalid
+    values are pre-masked.
 
-:IVariables:
-    f : function.
-    fillx : Default filling value for the first argument *[0]*.
-    filly : Default filling value for the second argument *[0]*.
-    domain : Default domain *[None]*.
+    *Parameters*:
+        f : function.
+        fillx : Default filling value for the first argument *[0]*.
+        filly : Default filling value for the second argument *[0]*.
+        domain : Default domain *[None]*.
+
     """
     def __init__ (self, mbfunc, fillx=0, filly=0):
         """abfunc(fillx, filly) must be defined.
@@ -441,7 +468,7 @@
         return result
     #
     def reduce (self, target, axis=0, dtype=None):
-        """Reduces `target` along the given `axis`."""
+        """Reduce `target` along the given `axis`."""
         if isinstance(target, MaskedArray):
             tclass = type(target)
         else:
@@ -468,7 +495,9 @@
         return tr
 
     def outer (self, a, b):
-        "Returns the function applied to the outer product of a and b."
+        """Return the function applied to the outer product of a and b.
+
+        """
         ma = getmask(a)
         mb = getmask(b)
         if ma is nomask and mb is nomask:
@@ -487,7 +516,10 @@
         return d
 
     def accumulate (self, target, axis=0):
-        """Accumulates `target` along `axis` after filling with y fill value."""
+        """Accumulate `target` along `axis` after filling with y fill
+        value.
+
+        """
         if isinstance(target, MaskedArray):
             tclass = type(target)
         else:
@@ -500,15 +532,16 @@
 
 #..............................................................................
 class _DomainedBinaryOperation:
-    """Defines binary operations that have a domain, like divide.
+    """Define binary operations that have a domain, like divide.
 
-They have no reduce, outer or accumulate.
+    They have no reduce, outer or accumulate.
 
-:IVariables:
-    f : function.
-    domain : Default domain.
-    fillx : Default filling value for the first argument *[0]*.
-    filly : Default filling value for the second argument *[0]*.
+    *Parameters*:
+        f : function.
+        domain : Default domain.
+        fillx : Default filling value for the first argument *[0]*.
+        filly : Default filling value for the second argument *[0]*.
+
     """
     def __init__ (self, dbfunc, domain, fillx=0, filly=0):
         """abfunc(fillx, filly) must be defined.
@@ -623,14 +656,19 @@
 #---- --- Mask creation functions ---
 #####--------------------------------------------------------------------------
 def get_mask(a):
-    """Returns the mask of a, if any, or nomask.
-To get a full array of booleans of the same shape as a, use getmaskarray.
+    """Return the mask of a, if any, or nomask.
+
+    To get a full array of booleans of the same shape as a, use
+    getmaskarray.
+
     """
     return getattr(a, '_mask', nomask)
 getmask = get_mask
 
 def getmaskarray(a):
-    """Returns the mask of a, if any, or a boolean array of the shape of a, full of False.
+    """Return the mask of a, if any, or a boolean array of the shape
+    of a, full of False.
+
     """
     m = getmask(a)
     if m is nomask:
@@ -638,8 +676,10 @@
     return m
 
 def is_mask(m):
-    """Returns True if m is a legal mask.
-Does not check contents, only type.
+    """Return True if m is a legal mask.
+
+    Does not check contents, only type.
+
     """
     try:
         return m.dtype.type is MaskType
@@ -647,17 +687,19 @@
         return False
 #
 def make_mask(m, copy=False, shrink=True, flag=None):
-    """Returns m as a mask, creating a copy if necessary or requested.
-The function can accept any sequence of integers or nomask.
-Does not check that contents must be 0s and 1s.
+    """Return m as a mask, creating a copy if necessary or requested.
 
-*Parameters*:
-    m : {ndarray}
-        Potential mask.
-    copy : {boolean}
-        Whether to return a copy of m (True) or m itself (False).
-    shrink : {boolean}
-        Whether to shrink m to nomask if all its values are False.
+    The function can accept any sequence of integers or nomask.  Does
+    not check that contents must be 0s and 1s.
+
+    *Parameters*:
+        m : {ndarray}
+            Potential mask.
+        copy : {boolean}
+            Whether to return a copy of m (True) or m itself (False).
+        shrink : {boolean}
+            Whether to shrink m to nomask if all its values are False.
+
     """
     if flag is not None:
         warnings.warn("The flag 'flag' is now called 'shrink'!",
@@ -683,29 +725,33 @@
         return result
 
 def make_mask_none(s):
-    """Returns a mask of shape s, filled with False.
+    """Return a mask of shape s, filled with False.
 
-*Parameters*:
-    s : {tuple}
-        A tuple indicating the shape of the final mask.
+    *Parameters*:
+        s : {tuple}
+            A tuple indicating the shape of the final mask.
+
     """
     result = numeric.zeros(s, dtype=MaskType)
     return result
 
 def mask_or (m1, m2, copy=False, shrink=True):
-    """Returns the combination of two masks m1 and m2.
-The masks are combined with the *logical_or* operator, treating nomask as False.
-The result may equal m1 or m2 if the other is nomask.
+    """Return the combination of two masks m1 and m2.
 
-*Parameters*:
-    m1 : {ndarray}
-        First mask.
-    m2 : {ndarray}
-        Second mask
-    copy : {boolean}
-        Whether to return a copy.
-    shrink : {boolean}
-        Whether to shrink m to nomask if all its values are False.
+    The masks are combined with the *logical_or* operator, treating
+    nomask as False.  The result may equal m1 or m2 if the other is
+    nomask.
+
+    *Parameters*:
+        m1 : {ndarray}
+            First mask.
+        m2 : {ndarray}
+            Second mask
+        copy : {boolean}
+            Whether to return a copy.
+        shrink : {boolean}
+            Whether to shrink m to nomask if all its values are False.
+
      """
     if m1 is nomask:
         return make_mask(m2, copy=copy, shrink=shrink)
@@ -719,16 +765,18 @@
 #--- --- Masking functions ---
 #####--------------------------------------------------------------------------
 def masked_where(condition, a, copy=True):
-    """Returns a as an array masked where condition is true.
-Masked values of a or condition are kept.
+    """Return a as an array masked where condition is true.
 
-*Parameters*:
-    condition : {ndarray}
-        Masking condition.
-    a : {ndarray}
-        Array to mask.
-    copy : {boolean}
-        Whether to return a copy of a (True) or modify a in place.
+    Masked values of a or condition are kept.
+
+    *Parameters*:
+        condition : {ndarray}
+            Masking condition.
+        a : {ndarray}
+            Array to mask.
+        copy : {boolean}
+            Whether to return a copy of a (True) or modify a in place.
+
     """
     cond = filled(condition,1)
     a = narray(a, copy=copy, subok=True)
@@ -763,8 +811,9 @@
 
 #
 def masked_equal(x, value, copy=True):
-    """Shortcut to masked_where, with condition = (x == value).
-For floating point, consider `masked_values(x, value)` instead.
+    """Shortcut to masked_where, with condition = (x == value).  For
+    floating point, consider `masked_values(x, value)` instead.
+
     """
     return masked_where((x == value), x, copy=copy)
 #    d = filled(x, 0)
@@ -773,12 +822,13 @@
 #    return array(d, mask=m, copy=copy)
 
 def masked_inside(x, v1, v2, copy=True):
-    """Shortcut to masked_where, where condition is True for x inside the interval
-[v1,v2] (v1 <= x <= v2).
-The boundaries v1 and v2 can be given in either order.
+    """Shortcut to masked_where, where condition is True for x inside
+    the interval [v1,v2] (v1 <= x <= v2).  The boundaries v1 and v2
+    can be given in either order.
 
-*Note*:
-    The array x is prefilled with its filling value.
+    *Note*:
+        The array x is prefilled with its filling value.
+
     """
     if v2 < v1:
         (v1, v2) = (v2, v1)
@@ -787,12 +837,13 @@
     return masked_where(condition, x, copy=copy)
 
 def masked_outside(x, v1, v2, copy=True):
-    """Shortcut to masked_where, where condition is True for x outside the interval
-[v1,v2] (x < v1)|(x > v2).
-The boundaries v1 and v2 can be given in either order.
+    """Shortcut to masked_where, where condition is True for x outside
+    the interval [v1,v2] (x < v1)|(x > v2).  The boundaries v1 and v2
+    can be given in either order.
 
-*Note*:
-    The array x is prefilled with its filling value.
+    *Note*:
+        The array x is prefilled with its filling value.
+
     """
     if v2 < v1:
         (v1, v2) = (v2, v1)
@@ -802,13 +853,14 @@
 
 #
 def masked_object(x, value, copy=True):
-    """Masks the array x where the data are exactly equal to value.
+    """Mask the array x where the data are exactly equal to value.
 
-This function is suitable only for object arrays: for floating point, please use
-``masked_values`` instead.
+    This function is suitable only for object arrays: for floating
+    point, please use ``masked_values`` instead.
 
-*Notes*:
-    The mask is set to `nomask` if posible.
+    *Notes*:
+        The mask is set to `nomask` if posible.
+
     """
     if isMaskedArray(x):
         condition = umath.equal(x._data, value)
@@ -820,22 +872,26 @@
     return masked_array(x, mask=mask, copy=copy, fill_value=value)
 
 def masked_values(x, value, rtol=1.e-5, atol=1.e-8, copy=True):
-    """Masks the array x where the data are approximately equal to value
-(abs(x - value) <= atol+rtol*abs(value)).
-Suitable only for floating points. For integers, please use ``masked_equal``.
-The mask is set to nomask if posible.
+    """Mask the array x where the data are approximately equal in
+    value, i.e.
 
-*Parameters*:
-    x : {ndarray}
-        Array to fill.
-    value : {float}
-        Masking value.
-    rtol : {float}
-        Tolerance parameter.
-    atol : {float}, *[1e-8]*
-        Tolerance parameter.
-    copy : {boolean}
-        Whether to return a copy of x.
+    (abs(x - value) <= atol+rtol*abs(value))
+
+    Suitable only for floating points. For integers, please use
+    ``masked_equal``.  The mask is set to nomask if posible.
+
+    *Parameters*:
+        x : {ndarray}
+            Array to fill.
+        value : {float}
+            Masking value.
+        rtol : {float}
+            Tolerance parameter.
+        atol : {float}, *[1e-8]*
+            Tolerance parameter.
+        copy : {boolean}
+            Whether to return a copy of x.
+
     """
     abs = umath.absolute
     xnew = filled(x, value)
@@ -849,8 +905,10 @@
     return masked_array(xnew, mask=mask, copy=copy, fill_value=value)
 
 def masked_invalid(a, copy=True):
-    """Masks the array for invalid values (nans or infs).
-    Any preexisting mask is conserved."""
+    """Mask the array for invalid values (nans or infs).  Any
+    preexisting mask is conserved.
+
+    """
     a = narray(a, copy=copy, subok=True)
     condition = (numpy.isnan(a) | numpy.isinf(a))
     if hasattr(a, '_mask'):
@@ -867,18 +925,21 @@
 #---- --- Printing options ---
 #####--------------------------------------------------------------------------
 class _MaskedPrintOption:
-    """Handles the string used to represent missing data in a masked array."""
+    """Handle the string used to represent missing data in a masked
+    array.
+
+    """
     def __init__ (self, display):
-        "Creates the masked_print_option object."
+        "Create the masked_print_option object."
         self._display = display
         self._enabled = True
 
     def display(self):
-        "Displays the string to print for masked values."
+        "Display the string to print for masked values."
         return self._display
 
     def set_display (self, s):
-        "Sets the string to print for masked values."
+        "Set the string to print for masked values."
         self._display = s
 
     def enabled(self):
@@ -903,20 +964,25 @@
 
 #...............................................................................
 class _arraymethod(object):
-    """Defines a wrapper for basic array methods.
-Upon call, returns a masked array, where the new _data array is the output of
-the corresponding method called on the original _data.
+    """Define a wrapper for basic array methods.
 
-If onmask is True, the new mask is the output of the method called on the initial
-mask. Otherwise, the new mask is just a reference to the initial mask.
+    Upon call, returns a masked array, where the new _data array is
+    the output of the corresponding method called on the original
+    _data.
 
-:IVariables:
-    _name : String
-        Name of the function to apply on data.
-    _onmask : {boolean} *[True]*
-        Whether the mask must be processed also (True) or left alone (False).
-    obj : Object
-        The object calling the arraymethod
+    If onmask is True, the new mask is the output of the method called
+    on the initial mask. Otherwise, the new mask is just a reference
+    to the initial mask.
+
+    *Parameters*:
+        _name : String
+            Name of the function to apply on data.
+        _onmask : {boolean} *[True]*
+            Whether the mask must be processed also (True) or left
+            alone (False).
+        obj : Object
+            The object calling the arraymethod
+
     """
     def __init__(self, funcname, onmask=True):
         self._name = funcname
@@ -925,7 +991,7 @@
         self.__doc__ = self.getdoc()
     #
     def getdoc(self):
-        "Returns the doc of the function (from the doc of the method)."
+        "Return the doc of the function (from the doc of the method)."
         methdoc = getattr(ndarray, self._name, None)
         methdoc = getattr(numpy, self._name, methdoc)
         if methdoc is not None:
@@ -955,7 +1021,7 @@
 #..........................................................
 
 class FlatIter(object):
-    "Defines an interator."
+    "Define an interator."
     def __init__(self, ma):
         self.ma = ma
         self.ma_iter = numpy.asarray(ma).flat
@@ -981,38 +1047,40 @@
 
 
 class MaskedArray(numeric.ndarray):
-    """Arrays with possibly masked values.
-Masked values of True exclude the corresponding element from any computation.
+    """Arrays with possibly masked values.  Masked values of True
+    exclude the corresponding element from any computation.
 
-Construction:
-    x = MaskedArray(data, mask=nomask, dtype=None, copy=True, fill_value=None,
-              mask = nomask, fill_value=None, shrink=True)
+    Construction:
+        x = MaskedArray(data, mask=nomask, dtype=None, copy=True,
+        fill_value=None, mask = nomask, fill_value=None, shrink=True)
 
-*Parameters*:
-    data : {var}
-        Input data.
-    mask : {nomask, sequence}
-        Mask.
-        Must be convertible to an array of booleans with the same shape as data:
-        True indicates a masked (eg., invalid) data.
-    dtype : {dtype}
-        Data type of the output. If None, the type of the data argument is used.
-        If dtype is not None and different from data.dtype, a copy is performed.
-    copy : {boolean}
-        Whether to copy the input data (True), or to use a reference instead.
-        Note: data are NOT copied by default.
-    fill_value : {var}
-        Value used to fill in the masked values when necessary. If None, a default
-        based on the datatype is used.
-    keep_mask : {True, boolean}
-        Whether to combine mask with the mask of the input data, if any (True),
-        or to use only mask for the output (False).
-    hard_mask : {False, boolean}
-        Whether to use a hard mask or not. With a hard mask, masked values cannot
-        be unmasked.
-    subok : {True, boolean}
-        Whether to return a subclass of MaskedArray (if possible) or a plain
-        MaskedArray.
+    *Parameters*:
+        data : {var}
+            Input data.
+        mask : {nomask, sequence}
+            Mask.  Must be convertible to an array of booleans with
+            the same shape as data: True indicates a masked (eg.,
+            invalid) data.
+        dtype : {dtype}
+            Data type of the output. If None, the type of the data
+            argument is used.  If dtype is not None and different from
+            data.dtype, a copy is performed.
+        copy : {boolean}
+            Whether to copy the input data (True), or to use a
+            reference instead.  Note: data are NOT copied by default.
+        fill_value : {var}
+            Value used to fill in the masked values when necessary. If
+            None, a default based on the datatype is used.
+        keep_mask : {True, boolean}
+            Whether to combine mask with the mask of the input data,
+            if any (True), or to use only mask for the output (False).
+        hard_mask : {False, boolean}
+            Whether to use a hard mask or not. With a hard mask,
+            masked values cannot be unmasked.
+        subok : {True, boolean}
+            Whether or not to return a subclass of MaskedArray (if
+            possible) or a plain MaskedArray.
+
     """
 
     __array_priority__ = 15
@@ -1020,11 +1088,14 @@
     _defaulthardmask = False
     _baseclass =  numeric.ndarray
 
-    def __new__(cls, data=None, mask=nomask, dtype=None, copy=False, fill_value=None,
-                keep_mask=True, hard_mask=False, flag=None,
+    def __new__(cls, data=None, mask=nomask, dtype=None, copy=False,
+                fill_value=None, keep_mask=True, hard_mask=False, flag=None,
                 subok=True, **options):
-        """Creates a new masked array from scratch.
-    Note: you can also create an array with the .view(MaskedArray) method...
+        """Create a new masked array from scratch.
+
+        Note: you can also create an array with the .view(MaskedArray)
+        method.
+
         """
         if flag is not None:
             warnings.warn("The flag 'flag' is now called 'shrink'!",
@@ -1161,7 +1232,9 @@
     #.............................................
     def __getitem__(self, indx):
         """x.__getitem__(y) <==> x[y]
-Returns the item described by i, as a masked array.
+
+        Return the item described by i, as a masked array.
+
         """
         # This test is useful, but we should keep things light...
 #        if getmask(indx) is not nomask:
@@ -1191,7 +1264,10 @@
     #........................
     def __setitem__(self, indx, value):
         """x.__setitem__(i, y) <==> x[i]=y
-Sets item described by index. If value is masked, masks those locations.
+
+        Set item described by index. If value is masked, masks those
+        locations.
+
         """
         if self is masked:
             raise MAError, 'Cannot alter the masked element.'
@@ -1234,18 +1310,26 @@
     #............................................
     def __getslice__(self, i, j):
         """x.__getslice__(i, j) <==> x[i:j]
-Returns the slice described by (i, j).
-The use of negative indices is not supported."""
+
+        Return the slice described by (i, j).  The use of negative
+        indices is not supported.
+
+        """
         return self.__getitem__(slice(i,j))
     #........................
     def __setslice__(self, i, j, value):
         """x.__setslice__(i, j, value) <==> x[i:j]=value
-Sets the slice (i,j) of a to value. If value is masked, masks those locations.
+
+        Set the slice (i,j) of a to value. If value is masked, mask
+        those locations.
+
         """
         self.__setitem__(slice(i,j), value)
     #............................................
     def __setmask__(self, mask, copy=False):
-        """Sets the mask."""
+        """Set the mask.
+
+        """
         if mask is not nomask:
             mask = narray(mask, copy=copy, dtype=MaskType)
 #            if self._shrinkmask and not mask.any():
@@ -1269,49 +1353,70 @@
     _set_mask = __setmask__
     #....
     def _get_mask(self):
-        """Returns the current mask."""
+        """Return the current mask.
+
+        """
         return self._mask
 #        return self._mask.reshape(self.shape)
     mask = property(fget=_get_mask, fset=__setmask__, doc="Mask")
     #............................................
     def harden_mask(self):
-        "Forces the mask to hard."
+        """Force the mask to hard.
+
+        """
         self._hardmask = True
 
     def soften_mask(self):
-        "Forces the mask to soft."
+        """Force the mask to soft.
+
+        """
         self._hardmask = False
 
     def unshare_mask(self):
-        "Copies the mask and set the sharedmask flag to False."
+        """Copy the mask and set the sharedmask flag to False.
+
+        """
         if self._sharedmask:
             self._mask = self._mask.copy()
             self._sharedmask = False
 
     def shrink_mask(self):
-        "Reduces a mask to nomask when possible."
+        """Reduce a mask to nomask when possible.
+
+        """
         m = self._mask
         if m.ndim and not m.any():
             self._mask = nomask
 
     #............................................
     def _get_data(self):
-        "Returns the current data, as a view of the original underlying data."
+        """Return the current data, as a view of the original
+        underlying data.
+
+        """
         return self.view(self._baseclass)
     _data = property(fget=_get_data)
     data = property(fget=_get_data)
 
     def raw_data(self):
-        """Returns the _data part of the MaskedArray.
-DEPRECATED: You should really use ``.data`` instead..."""
+        """Return the _data part of the MaskedArray.
+
+        DEPRECATED: You should really use ``.data`` instead...
+
+        """
+        warnings.warn('Use .data instead.', DeprecationWarning)
         return self._data
     #............................................
     def _get_flat(self):
-        "Returns a flat iterator."
+        """Return a flat iterator.
+
+        """
         return FlatIter(self)
     #
     def _set_flat (self, value):
-        "Sets a flattened version of self to value."
+        """Set a flattened version of self to value.
+
+        """
         y = self.ravel()
         y[:] = value
     #
@@ -1319,14 +1424,19 @@
                     doc="Flat version of the array.")
     #............................................
     def get_fill_value(self):
-        "Returns the filling value."
+        """Return the filling value.
+
+        """
         if self._fill_value is None:
             self._fill_value = default_fill_value(self)
         return self._fill_value
 
     def set_fill_value(self, value=None):
-        """Sets the filling value to value.
-If value is None, uses a default based on the data type."""
+        """Set the filling value to value.
+
+        If value is None, use a default based on the data type.
+
+        """
         if value is None:
             value = default_fill_value(self)
         self._fill_value = value
@@ -1335,21 +1445,22 @@
                           doc="Filling value.")
 
     def filled(self, fill_value=None):
-        """Returns a copy of self._data, where masked values are filled with
-fill_value.
+        """Return a copy of self._data, where masked values are filled
+        with fill_value.
 
-If fill_value is None, self.fill_value is used instead.
+        If fill_value is None, self.fill_value is used instead.
 
-*Note*:
-    + Subclassing is preserved
-    + The result is NOT a MaskedArray !
+        *Note*:
+            + Subclassing is preserved
+            + The result is NOT a MaskedArray !
 
-*Examples*:
-    >>> x = array([1,2,3,4,5], mask=[0,0,1,0,1], fill_value=-999)
-    >>> x.filled()
-    array([1,2,-999,4,-999])
-    >>> type(x.filled())
-    <type 'numpy.ndarray'>
+        *Examples*:
+            >>> x = array([1,2,3,4,5], mask=[0,0,1,0,1], fill_value=-999)
+            >>> x.filled()
+            array([1,2,-999,4,-999])
+            >>> type(x.filled())
+            <type 'numpy.ndarray'>
+
         """
         m = self._mask
         if m is nomask or not m.any():
@@ -1379,7 +1490,9 @@
         return result
 
     def compressed(self):
-        """Returns a 1-D array of all the non-masked data."""
+        """Return a 1-D array of all the non-masked data.
+
+        """
         data = ndarray.ravel(self._data).view(type(self))
         data._update_from(self)
         if self._mask is not nomask:
@@ -1390,7 +1503,8 @@
 
     #............................................
     def __str__(self):
-        """Calculates the string representation.
+        """String representation.
+
         """
         if masked_print_option.enabled():
             f = masked_print_option
@@ -1416,7 +1530,8 @@
         return str(res)
 
     def __repr__(self):
-        """Calculates the repr representation.
+        """Literal string representation.
+
         """
         with_mask = """\
 masked_%(name)s(data =
@@ -1447,32 +1562,32 @@
             }
     #............................................
     def __add__(self, other):
-        "Adds other to self, and returns a new masked array."
+        "Add other to self, and return a new masked array."
         return add(self, other)
     #
     def __sub__(self, other):
-        "Subtracts other to self, and returns a new masked array."
+        "Subtract other to self, and return a new masked array."
         return subtract(self, other)
     #
     def __mul__(self, other):
-        "Multiplies other to self, and returns a new masked array."
+        "Multiply other by self, and return a new masked array."
         return multiply(self, other)
     #
     def __div__(self, other):
-        "Divides other to self, and returns a new masked array."
+        "Divides other into self, and return a new masked array."
         return divide(self, other)
     #
     def __truediv__(self, other):
-        "Divides other to self, and returns a new masked array."
+        "Divide other into self, and return a new masked array."
         return true_divide(self, other)
     #
     def __floordiv__(self, other):
-        "Divides other to self, and returns a new masked array."
+        "Divide other into self, and return a new masked array."
         return floor_divide(self, other)
 
     #............................................
     def __iadd__(self, other):
-        "Adds other to self in place."
+        "Add other to self in-place."
         ndarray.__iadd__(self._data, getdata(other))
         m = getmask(other)
         if self._mask is nomask:
@@ -1482,7 +1597,7 @@
         return self
     #....
     def __isub__(self, other):
-        "Subtracts other from self in place."
+        "Subtract other from self in-place."
         ndarray.__isub__(self._data, getdata(other))
         m = getmask(other)
         if self._mask is nomask:
@@ -1492,7 +1607,7 @@
         return self
     #....
     def __imul__(self, other):
-        "Multiplies self by other in place."
+        "Multiply self by other in-place."
         ndarray.__imul__(self._data, getdata(other))
         m = getmask(other)
         if self._mask is nomask:
@@ -1502,7 +1617,7 @@
         return self
     #....
     def __idiv__(self, other):
-        "Divides self by other in place."
+        "Divide self by other in-place."
         other_data = getdata(other)
         dom_mask = _DomainSafeDivide().__call__(self._data, other_data)
         other_mask = getmask(other)
@@ -1516,7 +1631,7 @@
         return self
     #............................................
     def __float__(self):
-        "Converts self to float."
+        "Convert to float."
         if self._mask is not nomask:
             warnings.warn("Warning: converting a masked element to nan.")
             return numpy.nan
@@ -1524,7 +1639,7 @@
         return float(self.item())
 
     def __int__(self):
-        "Converts self to int."
+        "Convert to int."
         if self._mask is not nomask:
             raise MAError, 'Cannot convert masked element to a Python int.'
         return int(self.item())
@@ -1544,17 +1659,19 @@
 
     #............................................
     def count(self, axis=None):
-        """Counts the non-masked elements of the array along the given axis.
+        """Count the non-masked elements of the array along the given
+        axis.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to count the non-masked elements. If not given, all the
-        non masked elements are counted.
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to count the non-masked elements. If
+                not given, all the non masked elements are counted.
 
-*Returns*:
-     A masked array where the mask is True where all data are masked.
-     If axis is None, returns either a scalar ot the masked singleton if all values
-     are masked.
+        *Returns*:
+             A masked array where the mask is True where all data are
+             masked.  If axis is None, returns either a scalar ot the
+             masked singleton if all values are masked.
+
         """
         m = self._mask
         s = self.shape
@@ -1592,13 +1709,15 @@
     repeat = _arraymethod('repeat')
     #
     def reshape (self, *s):
-        """Reshapes the array to shape s.
+        """Reshape the array to shape s.
 
-*Returns*:
-    A new masked array.
+        *Returns*:
+            A new masked array.
 
-*Notes:
-    If you want to modify the shape in place, please use ``a.shape = s``
+        *Notes:
+            If you want to modify the shape in place, please use
+            ``a.shape = s``
+
         """
         result = self._data.reshape(*s).view(type(self))
         result.__dict__.update(self.__dict__)
@@ -1608,12 +1727,14 @@
         return result
     #
     def resize(self, newshape, refcheck=True, order=False):
-        """Attempts to modify the size and the shape of the array in place.
+        """Attempt to modify the size and the shape of the array in place.
 
-The array must own its own memory and not be referenced by other arrays.
+        The array must own its own memory and not be referenced by
+        other arrays.
 
-*Returns*:
-    None.
+        *Returns*:
+            None.
+
         """
         try:
             self._data.resize(newshape, refcheck, order)
@@ -1626,12 +1747,14 @@
         return None
     #
     def put(self, indices, values, mode='raise'):
-        """Sets storage-indexed locations to corresponding values.
+        """Set storage-indexed locations to corresponding values.
 
-a.put(values, indices, mode) sets a.flat[n] = values[n] for each n in indices.
-If values is shorter than indices then it will repeat.
-If values has some masked values, the initial mask is updated in consequence,
-else the corresponding values are unmasked.
+        a.put(values, indices, mode) sets a.flat[n] = values[n] for
+        each n in indices.  If ``values`` is shorter than ``indices``
+        then it will repeat.  If ``values`` has some masked values, the
+        initial mask is updated in consequence, else the corresponding
+        values are unmasked.
+
         """
         m = self._mask
         # Hard mask: Get rid of the values/indices that fall on masked data
@@ -1657,27 +1780,31 @@
         self._mask = m
     #............................................
     def ids (self):
-        """Returns the addresses of the data and mask areas."""
+        """Return the addresses of the data and mask areas."""
         return (self.ctypes.data, self._mask.ctypes.data)
     #............................................
     def all(self, axis=None, out=None):
-        """Returns True if all entries along the given axis are True, False otherwise.
-Masked values are considered as True during computation.
+        """Return True if all entries along the given axis are True,
+        False otherwise.  Masked values are considered as True during
+        computation.
 
-*Parameters*
-    axis : {integer}, optional
-        Axis along which the operation is performed.
-        If None, the operation is performed on a flatten array
-    out : {MaskedArray}, optional
-        Alternate optional output.
-        If not None, out should be a valid MaskedArray of the same shape as the
-        output of self._data.all(axis).
+        *Parameters*
+            axis : {integer}, optional
+                Axis along which the operation is performed.  If None,
+                the operation is performed on a flatten array
+            out : {MaskedArray}, optional
+                Alternate optional output.  If not None, out should be
+                a valid MaskedArray of the same shape as the output of
+                self._data.all(axis).
 
-*Returns*
-    A masked array, where the mask is True if all data along the axis are masked.
+        *Returns*
+            A masked array, where the mask is True if all data along
+            the axis are masked.
 
-*Notes*
-    An exception is raised if ``out`` is not None and not of the same type as self.
+        *Notes*
+            An exception is raised if ``out`` is not None and not of
+            the same type as self.
+
         """
         if out is None:
             d = self.filled(True).all(axis=axis).view(type(self))
@@ -1685,7 +1812,8 @@
                 d.__setmask__(self._mask.all(axis))
             return d
         elif type(out) is not type(self):
-            raise TypeError("The external array should have a type %s (got %s instead)" %\
+            raise TypeError("The external array should have " \
+                            "a type %s (got %s instead)" %\
                             (type(self), type(out)))
         self.filled(True).all(axis=axis, out=out)
         if out.ndim:
@@ -1694,25 +1822,29 @@
 
 
     def any(self, axis=None, out=None):
-        """Returns True if at least one entry along the given axis is True.
+        """Returns True if at least one entry along the given axis is
+        True.
 
-Returns False if all entries are False.
-Masked values are considered as True during computation.
+        Returns False if all entries are False.
+        Masked values are considered as True during computation.
 
-*Parameters*
-    axis : {integer}, optional
-        Axis along which the operation is performed.
-        If None, the operation is performed on a flatten array
-    out : {MaskedArray}, optional
-        Alternate optional output.
-        If not None, out should be a valid MaskedArray of the same shape as the
-        output of self._data.all(axis).
+        *Parameters*
+            axis : {integer}, optional
+                Axis along which the operation is performed.
+                If None, the operation is performed on a flatten array
+            out : {MaskedArray}, optional
+                Alternate optional output.  If not None, out should be
+                a valid MaskedArray of the same shape as the output of
+                self._data.all(axis).
 
-*Returns*
-    A masked array, where the mask is True if all data along the axis are masked.
+        *Returns*
+            A masked array, where the mask is True if all data along
+            the axis are masked.
 
-*Notes*
-    An exception is raised if ``out`` is not None and not of the same type as self.
+        *Notes*
+            An exception is raised if ``out`` is not None and not of
+            the same type as self.
+
         """
         if out is None:
             d = self.filled(False).any(axis=axis).view(type(self))
@@ -1729,23 +1861,29 @@
 
 
     def nonzero(self):
-        """Returns the indices of the elements of a that are not zero nor masked,
-as a tuple of arrays.
+        """Return the indices of the elements of a that are not zero
+        nor masked, as a tuple of arrays.
 
-There are as many tuples as dimensions of a, each tuple contains the indices of
-the non-zero elements in that dimension.  The corresponding non-zero values can
-be obtained with ``a[a.nonzero()]``.
+        There are as many tuples as dimensions of a, each tuple
+        contains the indices of the non-zero elements in that
+        dimension.  The corresponding non-zero values can be obtained
+        with ``a[a.nonzero()]``.
 
-To group the indices by element, rather than dimension, use instead:
-``transpose(a.nonzero())``.
+        To group the indices by element, rather than dimension, use
+        instead: ``transpose(a.nonzero())``.
 
-The result of this is always a 2d array, with a row for each non-zero element.
+        The result of this is always a 2d array, with a row for each
+        non-zero element.
+
         """
         return narray(self.filled(0), copy=False).nonzero()
     #............................................
     def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None):
         """a.trace(offset=0, axis1=0, axis2=1, dtype=None, out=None)
-Returns the sum along the offset diagonal of the array's indicated `axis1` and `axis2`.
+
+        Return the sum along the offset diagonal of the array's
+        indicated `axis1` and `axis2`.
+
         """
         # TODO: What are we doing with `out`?
         m = self._mask
@@ -1758,18 +1896,19 @@
             return D.astype(dtype).filled(0).sum(axis=None)
     #............................................
     def sum(self, axis=None, dtype=None):
-        """Sums the array over the given axis.
+        """Sum the array over the given axis.
 
-Masked elements are set to 0 internally.
+        Masked elements are set to 0 internally.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    dtype : {dtype}, optional
-        Datatype for the intermediary computation. If not given, the current dtype
-        is used instead.
-    """
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to perform the operation.
+                If None, applies to a flattened version of the array.
+            dtype : {dtype}, optional
+                Datatype for the intermediary computation. If not given,
+                the current dtype is used instead.
+
+        """
         if self._mask is nomask:
             mask = nomask
         else:
@@ -1782,34 +1921,38 @@
         return result
 
     def cumsum(self, axis=None, dtype=None):
-        """Returns the cumulative sum of the elements of the array along the given axis.
+        """Return the cumulative sum of the elements of the array
+        along the given axis.
 
-Masked values are set to 0 internally.
+        Masked values are set to 0 internally.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    dtype : {dtype}, optional
-        Datatype for the intermediary computation. If not given, the current dtype
-        is used instead.
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to perform the operation.
+                If None, applies to a flattened version of the array.
+            dtype : {dtype}, optional
+                Datatype for the intermediary computation. If not
+                given, the current dtype is used instead.
+
         """
         result = self.filled(0).cumsum(axis=axis, dtype=dtype).view(type(self))
         result.__setmask__(self.mask)
         return result
 
     def prod(self, axis=None, dtype=None):
-        """Returns the product of the elements of the array along the given axis.
+        """Return the product of the elements of the array along the
+        given axis.
 
-Masked elements are set to 1 internally.
+        Masked elements are set to 1 internally.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    dtype : {dtype}, optional
-        Datatype for the intermediary computation. If not given, the current dtype
-        is used instead.
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to perform the operation.
+                If None, applies to a flattened version of the array.
+            dtype : {dtype}, optional
+                Datatype for the intermediary computation. If not
+                given, the current dtype is used instead.
+
         """
         if self._mask is nomask:
             mask = nomask
@@ -1821,37 +1964,41 @@
         if result.ndim:
             result.__setmask__(mask)
         return result
+
     product = prod
 
     def cumprod(self, axis=None, dtype=None):
-        """Returns the cumulative product of the elements of the array along the given axis.
+        """Return the cumulative product of the elements of the array
+        along the given axis.
 
-Masked values are set to 1 internally.
+        Masked values are set to 1 internally.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    dtype : {dtype}, optional
-        Datatype for the intermediary computation. If not given, the current dtype
-        is used instead.
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to perform the operation.
+                If None, applies to a flattened version of the array.
+            dtype : {dtype}, optional
+                Datatype for the intermediary computation. If not
+                given, the current dtype is used instead.
+
         """
         result = self.filled(1).cumprod(axis=axis, dtype=dtype).view(type(self))
         result.__setmask__(self.mask)
         return result
 
     def mean(self, axis=None, dtype=None):
-        """Averages the array over the given axis.  Equivalent to
+        """Average the array over the given axis.  Equivalent to
 
-      a.sum(axis, dtype) / a.size(axis).
+        a.sum(axis, dtype) / a.size(axis).
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    dtype : {dtype}, optional
-        Datatype for the intermediary computation. If not given, the current dtype
-        is used instead.
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to perform the operation.
+                If None, applies to a flattened version of the array.
+            dtype : {dtype}, optional
+                Datatype for the intermediary computation. If not
+                given, the current dtype is used instead.
+
         """
         if self._mask is nomask:
             return super(MaskedArray, self).mean(axis=axis, dtype=dtype)
@@ -1861,16 +2008,18 @@
             return dsum*1./cnt
 
     def anom(self, axis=None, dtype=None):
-        """Returns the anomalies (deviations from the average) along the given axis.
+        """Return the anomalies (deviations from the average) along
+        the given axis.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    dtype : {dtype}, optional
-        Datatype for the intermediary computation. If not given, the current dtype
-        is used instead.
-            """
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to perform the operation.
+                If None, applies to a flattened version of the array.
+            dtype : {dtype}, optional
+                Datatype for the intermediary computation. If not
+                given, the current dtype is used instead.
+
+        """
         m = self.mean(axis, dtype)
         if not axis:
             return (self - m)
@@ -1878,22 +2027,24 @@
             return (self - expand_dims(m,axis))
 
     def var(self, axis=None, dtype=None):
-        """Returns the variance, a measure of the spread of a distribution.
+        """Return the variance, a measure of the spread of a distribution.
 
-The variance is the average of the squared deviations from the mean,
-i.e. var = mean((x - x.mean())**2).
+        The variance is the average of the squared deviations from the
+        mean, i.e. var = mean((x - x.mean())**2).
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    dtype : {dtype}, optional
-        Datatype for the intermediary computation. If not given, the current dtype
-        is used instead.
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to perform the operation.
+                If None, applies to a flattened version of the array.
+            dtype : {dtype}, optional
+                Datatype for the intermediary computation. If not
+                given, the current dtype is used instead.
 
-*Notes*:
-    The value returned is a biased estimate of the true variance.
-    For the (more standard) unbiased estimate, use varu.
+        *Notes*:
+            The value returned is a biased estimate of the true
+            variance.  For the (more standard) unbiased estimate, use
+            varu.
+
         """
         if self._mask is nomask:
             # TODO: Do we keep super, or var _data and take a view ?
@@ -1909,22 +2060,27 @@
             return dvar
 
     def std(self, axis=None, dtype=None):
-        """Returns the standard deviation, a measure of the spread of a distribution.
+        """Return the standard deviation, a measure of the spread of a
+        distribution.
 
-The standard deviation is the square root of the average of the squared
-deviations from the mean, i.e. std = sqrt(mean((x - x.mean())**2)).
+        The standard deviation is the square root of the average of
+        the squared deviations from the mean, i.e.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    dtype : {dtype}, optional
-        Datatype for the intermediary computation.
-        If not given, the current dtype is used instead.
+        std = sqrt(mean((x - x.mean())**2)).
 
-*Notes*:
-    The value returned is a biased estimate of the true standard deviation.
-    For the more standard unbiased estimate, use stdu.
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to perform the operation.
+                If None, applies to a flattened version of the array.
+            dtype : {dtype}, optional
+                Datatype for the intermediary computation.
+                If not given, the current dtype is used instead.
+
+        *Notes*:
+            The value returned is a biased estimate of the true
+            standard deviation.  For the more standard unbiased
+            estimate, use stdu.
+
         """
         dvar = self.var(axis,dtype)
         if axis is not None or dvar is not masked:
@@ -1934,42 +2090,46 @@
     #............................................
     def argsort(self, axis=None, fill_value=None, kind='quicksort',
                 order=None):
-        """Returns a ndarray of indices that sort the array along the specified axis.
-    Masked values are filled beforehand to fill_value.
-    Returns a numpy array.
+        """Return an ndarray of indices that sort the array along the
+        specified axis.  Masked values are filled beforehand to
+        fill_value.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis to be indirectly sorted.
-        If not given, uses a flatten version of the array.
-    fill_value : {var}
-        Value used to fill in the masked values.
-        If not given, self.fill_value is used instead.
-    kind : {string}
-        Sorting algorithm (default 'quicksort')
-        Possible values: 'quicksort', 'mergesort', or 'heapsort'
+        *Parameters*:
+            axis : {integer}, optional
+                Axis to be indirectly sorted.
+                If not given, uses a flatten version of the array.
+            fill_value : {var}
+                Value used to fill in the masked values.
+                If not given, self.fill_value is used instead.
+            kind : {string}
+                Sorting algorithm (default 'quicksort')
+                Possible values: 'quicksort', 'mergesort', or 'heapsort'
 
-*Notes*:
-    This method executes an indirect sort along the given axis using the algorithm
-    specified by the kind keyword. It returns an array of indices of the same shape
-    as 'a' that index data along the given axis in sorted order.
+        *Notes*:
+            This method executes an indirect sort along the given axis
+            using the algorithm specified by the kind keyword. It
+            returns an array of indices of the same shape as 'a' that
+            index data along the given axis in sorted order.
 
-    The various sorts are characterized by average speed, worst case performance
-    need for work space, and whether they are stable.  A stable sort keeps items
-    with the same key in the same relative order. The three available algorithms
-    have the following properties:
+            The various sorts are characterized by average speed,
+            worst case performance need for work space, and whether
+            they are stable.  A stable sort keeps items with the same
+            key in the same relative order. The three available
+            algorithms have the following properties:
 
-    |------------------------------------------------------|
-    |    kind   | speed |  worst case | work space | stable|
-    |------------------------------------------------------|
-    |'quicksort'|   1   | O(n^2)      |     0      |   no  |
-    |'mergesort'|   2   | O(n*log(n)) |    ~n/2    |   yes |
-    |'heapsort' |   3   | O(n*log(n)) |     0      |   no  |
-    |------------------------------------------------------|
+            |------------------------------------------------------|
+            |    kind   | speed |  worst case | work space | stable|
+            |------------------------------------------------------|
+            |'quicksort'|   1   | O(n^2)      |     0      |   no  |
+            |'mergesort'|   2   | O(n*log(n)) |    ~n/2    |   yes |
+            |'heapsort' |   3   | O(n*log(n)) |     0      |   no  |
+            |------------------------------------------------------|
 
-    All the sort algorithms make temporary copies of the data when the sort is not
-    along the last axis. Consequently, sorts along the last axis are faster and use
-    less space than sorts along other axis.
+            All the sort algorithms make temporary copies of the data
+            when the sort is not along the last axis. Consequently,
+            sorts along the last axis are faster and use less space
+            than sorts along other axis.
+
         """
         if fill_value is None:
             fill_value = default_fill_value(self)
@@ -1977,18 +2137,19 @@
         return d.argsort(axis=axis, kind=kind, order=order)
     #........................
     def argmin(self, axis=None, fill_value=None):
-        """Returns a ndarray of indices for the minimum values of a along the
-specified axis.
+        """Return an ndarray of indices for the minimum values of a
+        along the specified axis.
 
-Masked values are treated as if they had the value fill_value.
+        Masked values are treated as if they had the value fill_value.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    fill_value : {var}, optional
-        Value used to fill in the masked values.
-        If None, the output of minimum_fill_value(self._data) is used.
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to perform the operation.
+                If None, applies to a flattened version of the array.
+            fill_value : {var}, optional
+                Value used to fill in the masked values.  If None, the
+                output of minimum_fill_value(self._data) is used.
+
         """
         if fill_value is None:
             fill_value = minimum_fill_value(self)
@@ -1996,18 +2157,19 @@
         return d.argmin(axis)
     #........................
     def argmax(self, axis=None, fill_value=None):
-        """Returns the array of indices for the maximum values of `a` along the
-specified axis.
+        """Returns the array of indices for the maximum values of `a`
+        along the specified axis.
 
-Masked values are treated as if they had the value fill_value.
+        Masked values are treated as if they had the value fill_value.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    fill_value : {var}, optional
-        Value used to fill in the masked values.
-        If None, the output of maximum_fill_value(self._data) is used.
+    *Parameters*:
+        axis : {integer}, optional
+            Axis along which to perform the operation.
+            If None, applies to a flattened version of the array.
+        fill_value : {var}, optional
+            Value used to fill in the masked values.  If None, the
+            output of maximum_fill_value(self._data) is used.
+
         """
         if fill_value is None:
             fill_value = maximum_fill_value(self._data)
@@ -2016,46 +2178,50 @@
 
     def sort(self, axis=-1, kind='quicksort', order=None,
              endwith=True, fill_value=None):
-        """Sort a along the given axis.
+        """Sort along the given axis.
 
-*Parameters*:
-    axis : {integer}
-        Axis to be indirectly sorted.
-    kind : {string}
-        Sorting algorithm (default 'quicksort')
-        Possible values: 'quicksort', 'mergesort', or 'heapsort'.
-    order : {var}
-        If a has fields defined, then the order keyword can be the field
-        name to sort on or a list (or tuple) of field names to indicate
-        the order that fields should be used to define the sort.
-    fill_value : {var}
-        Value used to fill in the masked values.
-        If None, use the the output of minimum_fill_value().
-    endwith : {boolean}
-        Whether missing values (if any) should be forced in the upper indices
-        (at the end of the array) (True) or lower indices (at the beginning).
+        *Parameters*:
+            axis : {integer}
+                Axis to be indirectly sorted.
+            kind : {string}
+                Sorting algorithm (default 'quicksort')
+                Possible values: 'quicksort', 'mergesort', or 'heapsort'.
+            order : {var}
+                If a has fields defined, then the order keyword can be
+                the field name to sort on or a list (or tuple) of
+                field names to indicate the order that fields should
+                be used to define the sort.
+            fill_value : {var}
+                Value used to fill in the masked values.  If None, use
+                the the output of minimum_fill_value().
+            endwith : {boolean}
+                Whether missing values (if any) should be forced in
+                the upper indices (at the end of the array) (True) or
+                lower indices (at the beginning).
 
-*Returns*:
-    When used as method, returns None.
-    When used as a function, returns an array.
+        *Returns*:
+            When used as method, returns None.
+            When used as a function, returns an array.
 
-*Notes*:
-    This method sorts 'a' in place along the given axis using the algorithm
-    specified by the kind keyword.
+        *Notes*:
+            This method sorts 'a' in place along the given axis using
+            the algorithm specified by the kind keyword.
 
-    The various sorts may characterized by average speed, worst case performance
-    need for work space, and whether they are stable.  A stable sort keeps items
-    with the same key in the same relative order and is most useful when used w/
-    argsort where the key might differ from the items being sorted.
-    The three available algorithms have the following properties:
+            The various sorts may characterized by average speed,
+            worst case performance need for work space, and whether
+            they are stable.  A stable sort keeps items with the same
+            key in the same relative order and is most useful when
+            used w/ argsort where the key might differ from the items
+            being sorted.  The three available algorithms have the
+            following properties:
 
-    |------------------------------------------------------|
-    |    kind   | speed |  worst case | work space | stable|
-    |------------------------------------------------------|
-    |'quicksort'|   1   | O(n^2)      |     0      |   no  |
-    |'mergesort'|   2   | O(n*log(n)) |    ~n/2    |   yes |
-    |'heapsort' |   3   | O(n*log(n)) |     0      |   no  |
-    |------------------------------------------------------|
+            |------------------------------------------------------|
+            |    kind   | speed |  worst case | work space | stable|
+            |------------------------------------------------------|
+            |'quicksort'|   1   | O(n^2)      |     0      |   no  |
+            |'mergesort'|   2   | O(n*log(n)) |    ~n/2    |   yes |
+            |'heapsort' |   3   | O(n*log(n)) |     0      |   no  |
+            |------------------------------------------------------|
 
     """
         if self._mask is nomask:
@@ -2079,17 +2245,18 @@
 
     #............................................
     def min(self, axis=None, fill_value=None):
-        """Returns the minimum of a along the given axis.
+        """Return the minimum of a along the given axis.
 
-Masked values are filled with fill_value.
+        Masked values are filled with fill_value.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    fill_value : {var}, optional
-        Value used to fill in the masked values.
-        If None, use the the output of minimum_fill_value().
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to perform the operation.
+                If None, applies to a flattened version of the array.
+            fill_value : {var}, optional
+                Value used to fill in the masked values.
+                If None, use the the output of minimum_fill_value().
+
     """
         mask = self._mask
         # Check all/nothing case ......
@@ -2112,9 +2279,9 @@
         return result
     #........................
     def max(self, axis=None, fill_value=None):
-        """Returns the maximum/a along the given axis.
+        """Return the maximum/a along the given axis.
 
-Masked values are filled with fill_value.
+        Masked values are filled with fill_value.
 
 *Parameters*:
     axis : {integer}, optional
@@ -2145,16 +2312,17 @@
         return result
     #........................
     def ptp(self, axis=None, fill_value=None):
-        """Returns the visible data range (max-min) along the given axis.
+        """Return the visible data range (max-min) along the given axis.
 
-*Parameters*:
-    axis : {integer}, optional
-        Axis along which to perform the operation.
-        If None, applies to a flattened version of the array.
-    fill_value : {var}, optional
-        Value used to fill in the masked values.
-        If None, the maximum uses the maximum default, the minimum uses
-        the minimum default.
+        *Parameters*:
+            axis : {integer}, optional
+                Axis along which to perform the operation.
+                If None, applies to a flattened version of the array.
+            fill_value : {var}, optional
+                Value used to fill in the masked values.  If None, the
+                maximum uses the maximum default, the minimum uses the
+                minimum default.
+
         """
         return self.max(axis, fill_value) - self.min(axis, fill_value)
 
@@ -2174,13 +2342,15 @@
     squeeze = _arraymethod('squeeze')
     #--------------------------------------------
     def tolist(self, fill_value=None):
-        """Copies the data portion of the array to a hierarchical python list and
-returns that list.
+        """Copy the data portion of the array to a hierarchical python
+        list and returns that list.
 
-Data items are converted to the nearest compatible Python type.
-Masked values are converted to fill_value. If fill_value is None, the corresponding
-entries in the output list will be ``None``.
-    """
+        Data items are converted to the nearest compatible Python
+        type.  Masked values are converted to fill_value. If
+        fill_value is None, the corresponding entries in the output
+        list will be ``None``.
+
+        """
         if fill_value is not None:
             return self.filled(fill_value).tolist()
         result = self.filled().tolist()
@@ -2200,25 +2370,29 @@
         return result
     #........................
     def tostring(self, fill_value=None, order='C'):
-        """Returns a copy of array data as a Python string containing the raw
-bytes in the array.
+        """Return a copy of array data as a Python string containing the raw
+        bytes in the array.
 
-*Parameters*:
-    fill_value : {var}, optional
-        Value used to fill in the masked values.
-        If None, uses self.fill_value instead.
-    order : {string}
-        Order of the data item in the copy {"C","F","A"}.
-        "C"       -- C order (row major)
-        "Fortran" -- Fortran order (column major)
-        "Any"     -- Current order of array.
-        None      -- Same as "Any"
+        *Parameters*:
+            fill_value : {var}, optional
+                Value used to fill in the masked values.
+                If None, uses self.fill_value instead.
+            order : {string}
+                Order of the data item in the copy {"C","F","A"}.
+                "C"       -- C order (row major)
+                "Fortran" -- Fortran order (column major)
+                "Any"     -- Current order of array.
+                None      -- Same as "Any"
+
     """
         return self.filled(fill_value).tostring(order=order)
     #--------------------------------------------
     # Pickling
     def __getstate__(self):
-        "Returns the internal state of the masked array, for pickling purposes."
+        """Return the internal state of the masked array, for pickling
+        purposes.
+
+        """
         state = (1,
                  self.shape,
                  self.dtype,
@@ -2230,30 +2404,36 @@
         return state
     #
     def __setstate__(self, state):
-        """Restores the internal state of the masked array, for pickling purposes.
-``state`` is typically the output of the ``__getstate__`` output, and is a 5-tuple:
+        """Restore the internal state of the masked array, for
+        pickling purposes.  ``state`` is typically the output of the
+        ``__getstate__`` output, and is a 5-tuple:
 
         - class name
         - a tuple giving the shape of the data
         - a typecode for the data
         - a binary string for the data
         - a binary string for the mask.
-            """
+
+        """
         (ver, shp, typ, isf, raw, msk, flv) = state
         ndarray.__setstate__(self, (shp, typ, isf, raw))
         self._mask.__setstate__((shp, dtype(bool), isf, msk))
         self.fill_value = flv
     #
     def __reduce__(self):
-        """Returns a 3-tuple for pickling a MaskedArray."""
+        """Return a 3-tuple for pickling a MaskedArray.
+
+        """
         return (_mareconstruct,
                 (self.__class__, self._baseclass, (0,), 'b', ),
                 self.__getstate__())
 
 
 def _mareconstruct(subtype, baseclass, baseshape, basetype,):
-    """Internal function that builds a new MaskedArray from the information stored
-in a pickle."""
+    """Internal function that builds a new MaskedArray from the
+    information stored in a pickle.
+
+    """
     _data = ndarray.__new__(baseclass, baseshape, basetype)
     _mask = ndarray.__new__(ndarray, baseshape, 'b1')
     return subtype.__new__(subtype, _data, mask=_mask, dtype=basetype, shrink=False)
@@ -2280,8 +2460,10 @@
           keep_mask=True, hard_mask=False, fill_value=None, shrink=True):
     """array(data, dtype=None, copy=True, order=False, mask=nomask,
              keep_mask=True, shrink=True, fill_value=None)
-Acts as shortcut to MaskedArray, with options in a different order for convenience.
-And backwards compatibility...
+
+    Acts as shortcut to MaskedArray, with options in a different order
+    for convenience.  And backwards compatibility...
+
     """
     #TODO: we should try to put 'order' somwehere
     return MaskedArray(data, mask=mask, dtype=dtype, copy=copy, subok=subok,
@@ -2290,7 +2472,7 @@
 array.__doc__ = masked_array.__doc__
 
 def is_masked(x):
-    """Returns whether x has some masked values."""
+    """Does x have masked values?"""
     m = getmask(x)
     if m is nomask:
         return False
@@ -2311,7 +2493,7 @@
         return where(self.compare(a, b), a, b)
     #.........
     def reduce(self, target, axis=None):
-        "Reduces target along the given axis."
+        "Reduce target along the given axis."
         m = getmask(target)
         if axis is not None:
             kargs = { 'axis' : axis }
@@ -2333,7 +2515,7 @@
         return t
     #.........
     def outer (self, a, b):
-        "Returns the function applied to the outer product of a and b."
+        "Return the function applied to the outer product of a and b."
         ma = getmask(a)
         mb = getmask(b)
         if ma is nomask and mb is nomask:
@@ -2372,8 +2554,11 @@
 
 #..........................................................
 def min(array, axis=None, out=None):
-    """Returns the minima along the given axis.
-If `axis` is None, applies to the flattened array."""
+    """Return the minima along the given axis.
+
+    If `axis` is None, applies to the flattened array.
+
+    """
     if out is not None:
         raise TypeError("Output arrays Unsupported for masked arrays")
     if axis is None:
@@ -2404,14 +2589,18 @@
 #---- --- Definition of functions from the corresponding methods ---
 #####---------------------------------------------------------------------------
 class _frommethod:
-    """Defines functions from existing MaskedArray methods.
-:ivar _methodname (String): Name of the method to transform.
+    """Define functions from existing MaskedArray methods.
+
+    *Parameters*:
+        _methodname : string
+            Name of the method to transform.
+
     """
     def __init__(self, methodname):
         self._methodname = methodname
         self.__doc__ = self.getdoc()
     def getdoc(self):
-        "Returns the doc of the function (from the doc of the method)."
+        "Return the doc of the function (from the doc of the method)."
         try:
             return getattr(MaskedArray, self._methodname).__doc__
         except:
@@ -2454,7 +2643,10 @@
 #..............................................................................
 def power(a, b, third=None):
     """Computes a**b elementwise.
-    Masked values are set to 1."""
+
+    Masked values are set to 1.
+
+    """
     if third is not None:
         raise MAError, "3-argument power not supported."
     ma = getmask(a)
@@ -2522,14 +2714,14 @@
 
 
 def compressed(x):
-    """Returns a 1-D array of all the non-masked data."""
+    """Return a 1-D array of all the non-masked data."""
     if getmask(x) is nomask:
         return x
     else:
         return x.compressed()
 
 def concatenate(arrays, axis=0):
-    "Concatenates the arrays along the given axis."
+    "Concatenate the arrays along the given axis."
     d = numpy.concatenate([getdata(a) for a in arrays], axis)
     rcls = get_masked_subclass(*arrays)
     data = d.view(rcls)
@@ -2553,7 +2745,10 @@
 
 
 def expand_dims(x,axis):
-    "Expands the shape of the array by including a new axis before the given one."
+    """Expand the shape of the array by including a new axis before
+    the given one.
+
+    """
     result = n_expand_dims(x,axis)
     if isinstance(x, MaskedArray):
         new_shape = result.shape
@@ -2586,8 +2781,11 @@
 
 #......................................
 def put(a, indices, values, mode='raise'):
-    """Sets storage-indexed locations to corresponding values.
-Values and indices are filled if necessary."""
+    """Set storage-indexed locations to corresponding values.
+
+    Values and indices are filled if necessary.
+
+    """
     # We can't use 'frommethod', the order of arguments is different
     try:
         return a.put(indices, values, mode=mode)
@@ -2595,10 +2793,13 @@
         return narray(a, copy=False).put(indices, values, mode=mode)
 
 def putmask(a, mask, values): #, mode='raise'):
-    """Sets a.flat[n] = values[n] for each n where mask.flat[n] is true.
+    """Set a.flat[n] = values[n] for each n where mask.flat[n] is true.
 
-If values is not the same size of a and mask then it will repeat as necessary.
-This gives different behavior than a[mask] = values."""
+    If values is not the same size of a and mask then it will repeat
+    as necessary.  This gives different behavior than
+    a[mask] = values.
+
+    """
     # We can't use 'frommethod', the order of arguments is different
     try:
         return a.putmask(values, mask)
@@ -2606,11 +2807,12 @@
         return numpy.putmask(narray(a, copy=False), mask, values)
 
 def transpose(a,axes=None):
-    """Returns a view of the array with dimensions permuted according to axes,
-as a masked array.
+    """Return a view of the array with dimensions permuted according to axes,
+    as a masked array.
 
-If ``axes`` is None (default), the output view has reversed dimensions compared
-to the original.
+    If ``axes`` is None (default), the output view has reversed
+    dimensions compared to the original.
+
     """
     #We can't use 'frommethod', as 'transpose' doesn't take keywords
     try:
@@ -2619,7 +2821,7 @@
         return narray(a, copy=False).transpose(axes).view(MaskedArray)
 
 def reshape(a, new_shape):
-    """Changes the shape of the array a to new_shape."""
+    """Change the shape of the array a to new_shape."""
     #We can't use 'frommethod', it whine about some parameters. Dmmit.
     try:
         return a.reshape(new_shape)
@@ -2627,11 +2829,13 @@
         return narray(a, copy=False).reshape(new_shape).view(MaskedArray)
 
 def resize(x, new_shape):
-    """Returns a new array with the specified shape.
+    """Return a new array with the specified shape.
 
-The total size of the original array can be any size.
-The new array is filled with repeated copies of a. If a was masked, the new array
-will be masked, and the new mask will be a repetition of the old one.
+    The total size of the original array can be any size.  The new
+    array is filled with repeated copies of a. If a was masked, the
+    new array will be masked, and the new mask will be a repetition of
+    the old one.
+
     """
     # We can't use _frommethods here, as N.resize is notoriously whiny.
     m = getmask(x)
@@ -2666,17 +2870,20 @@
 def where (condition, x=None, y=None):
     """where(condition | x, y)
 
-Returns a (subclass of) masked array, shaped like condition, where the elements
-are x when condition is True, and  y otherwise.   If neither x nor y are given,
-returns a tuple of indices where condition is True (a la condition.nonzero()).
+    Returns a (subclass of) masked array, shaped like condition, where
+    the elements are x when condition is True, and y otherwise.  If
+    neither x nor y are given, returns a tuple of indices where
+    condition is True (a la condition.nonzero()).
 
-*Parameters*:
-    condition : {var}
-        The condition to meet. Must be convertible to an integer array.
-    x : {var}, optional
-        Values of the output when the condition is met
-    y : {var}, optional
-        Values of the output when the condition is not met.
+    *Parameters*:
+        condition : {var}
+            The condition to meet. Must be convertible to an integer
+            array.
+        x : {var}, optional
+            Values of the output when the condition is met
+        y : {var}, optional
+            Values of the output when the condition is not met.
+
     """
     if x is None and y is None:
         return filled(condition, 0).nonzero()
@@ -2725,7 +2932,7 @@
 #    return d.astype(ndtype)
 
 def choose (indices, t, out=None, mode='raise'):
-    "Returns array shaped like indices with elements chosen from t"
+    "Return array shaped like indices with elements chosen from t"
     #TODO: implement options `out` and `mode`, if possible.
     def fmask (x):
         "Returns the filled array, or True if masked."
@@ -2749,22 +2956,25 @@
     return masked_array(d, mask=m)
 
 def round_(a, decimals=0, out=None):
-    """Returns a copy of a, rounded to 'decimals' places.
+    """Return a copy of a, rounded to 'decimals' places.
 
-When 'decimals' is negative, it specifies the number of positions to the left of
-the decimal point.  The real and imaginary parts of complex numbers are rounded
-separately. Nothing is done if the array is not of float type and 'decimals' is
-greater than or equal to 0.
+    When 'decimals' is negative, it specifies the number of positions
+    to the left of the decimal point.  The real and imaginary parts of
+    complex numbers are rounded separately. Nothing is done if the
+    array is not of float type and 'decimals' is greater than or equal
+    to 0.
 
-*Parameters*:
-    decimals : {integer}
-        Number of decimals to round to. May be negative.
-    out : {ndarray}
-        Existing array to use for output.
-        If not given, returns a default copy of a.
+    *Parameters*:
+        decimals : {integer}
+            Number of decimals to round to. May be negative.
+        out : {ndarray}
+            Existing array to use for output.
+            If not given, returns a default copy of a.
 
-*Notes*:
-    If out is given and does not have a mask attribute, the mask of a is lost!
+    *Notes*:
+        If out is given and does not have a mask attribute, the mask
+        of a is lost!
+
     """
     if out is None:
         result = fromnumeric.round_(getdata(a), decimals, out)
@@ -2816,8 +3026,9 @@
 outerproduct = outer
 
 def allequal (a, b, fill_value=True):
-    """Returns True if all entries of  a and b are equal, using fill_value
-as a truth value where either or both are masked.
+    """Return True if all entries of a and b are equal, using
+    fill_value as a truth value where either or both are masked.
+
     """
     m = mask_or(getmask(a), getmask(b))
     if m is nomask:
@@ -2835,12 +3046,15 @@
         return False
 
 def allclose (a, b, fill_value=True, rtol=1.e-5, atol=1.e-8):
-    """ Returns True if all elements of a and b are equal subject to given tolerances.
-If fill_value is True, masked values are considered equal.
-If fill_value is False, masked values considered unequal.
-The relative error rtol should be positive and << 1.0
-The absolute error atol comes into play for those elements of b that are very small
-or zero; it says how small `a` must be also.
+    """ Return True if all elements of a and b are equal subject to
+    given tolerances.
+
+    If fill_value is True, masked values are considered equal.
+    If fill_value is False, masked values considered unequal.
+    The relative error rtol should be positive and << 1.0
+    The absolute error atol comes into play for those elements of b
+    that are very small or zero; it says how small `a` must be also.
+
     """
     m = mask_or(getmask(a), getmask(b))
     d1 = getdata(a)
@@ -2853,19 +3067,23 @@
 #..............................................................................
 def asarray(a, dtype=None):
     """asarray(data, dtype) = array(data, dtype, copy=0, subok=0)
-Returns a as a MaskedArray object of the given dtype.
-If dtype is not given or None, is is set to the dtype of a.
-No copy is performed if a is already an array.
-Subclasses are converted to the base class MaskedArray.
+
+    Return a as a MaskedArray object of the given dtype.
+    If dtype is not given or None, is is set to the dtype of a.
+    No copy is performed if a is already an array.
+    Subclasses are converted to the base class MaskedArray.
+
     """
     return masked_array(a, dtype=dtype, copy=False, keep_mask=True, subok=False)
 
 def asanyarray(a, dtype=None):
     """asanyarray(data, dtype) = array(data, dtype, copy=0, subok=1)
-Returns a as an masked array.
-If dtype is not given or None, is is set to the dtype of a.
-No copy is performed if a is already an array.
-Subclasses are conserved.
+
+    Return a as an masked array.
+    If dtype is not given or None, is is set to the dtype of a.
+    No copy is performed if a is already an array.
+    Subclasses are conserved.
+
     """
     return masked_array(a, dtype=dtype, copy=False, keep_mask=True, subok=True)
 
@@ -2894,26 +3112,33 @@
 #---- --- Pickling ---
 #####--------------------------------------------------------------------------
 def dump(a,F):
-    """Pickles the MaskedArray `a` to the file `F`.
-`F` can either be the handle of an exiting file, or a string representing a file name.
+    """Pickle the MaskedArray `a` to the file `F`.  `F` can either be
+    the handle of an exiting file, or a string representing a file
+    name.
+
     """
     if not hasattr(F,'readline'):
         F = open(F,'w')
     return cPickle.dump(a,F)
 
 def dumps(a):
-    """Returns a string corresponding to the pickling of the MaskedArray."""
+    """Return a string corresponding to the pickling of the
+    MaskedArray.
+
+    """
     return cPickle.dumps(a)
 
 def load(F):
-    """Wrapper around ``cPickle.load`` which accepts either a file-like object or
- a filename."""
+    """Wrapper around ``cPickle.load`` which accepts either a
+    file-like object or a filename.
+
+    """
     if not hasattr(F, 'readline'):
         F = open(F,'r')
     return cPickle.load(F)
 
 def loads(strg):
-    "Loads a pickle from the current string."""
+    "Load a pickle from the current string."""
     return cPickle.loads(strg)
 
 

Modified: branches/maskedarray/numpy/ma/tests/test_old_ma.py
===================================================================
--- branches/maskedarray/numpy/ma/tests/test_old_ma.py	2007-12-15 02:53:30 UTC (rev 4582)
+++ branches/maskedarray/numpy/ma/tests/test_old_ma.py	2007-12-15 11:29:33 UTC (rev 4583)
@@ -229,7 +229,7 @@
         x2 = masked_values(x1, 3.0)
         assert eq(x1,x2)
         assert allequal(array([0,0,0,1,0],MaskType), x2.mask)
-        assert eq(3.0, x2.fill_value())
+        assert eq(3.0, x2.fill_value)
         x1 = array([1,'hello',2,3],object)
         x2 = numpy.array([1,'hello',2,3],object)
         s1 = x1[1]
@@ -295,13 +295,13 @@
         self.failUnless( eq(x, [0,10,2,-1,40]))
 
         x = array(d, mask = m)
-        x.put([-1,100,200])
+        x.put([0,1,2],[-1,100,200])
         self.failUnless( eq(x, [-1,100,200,0,0]))
         self.failUnless( x[3] is masked)
         self.failUnless( x[4] is masked)
 
         x = array(d, mask = m)
-        x.putmask([30,40])
+        numpy.putmask(x,[30,40])
         self.failUnless( eq(x, [0,1,2,30,40]))
         self.failUnless( x.mask is nomask)
 
@@ -309,16 +309,16 @@
         y = x.compressed()
         z = array(x, mask = m)
         z.put(y)
-        assert eq (x, z)
+        assert eq(x, z)
 
     def check_testMaPut(self):
         (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d
         m = [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1]
         i = numpy.nonzero(m)[0]
         putmask(xm, m, z)
-        assert take(xm, i,axis=0) == z
+        assert all(take(xm, i, axis=0) == z)
         put(ym, i, zm)
-        assert take(ym, i,axis=0) == zm
+        assert take(ym, i, axis=0) == zm
 
     def check_testOddFeatures(self):
         "Test of other odd features"




More information about the Numpy-svn mailing list