diff options
Diffstat (limited to 'numpy/ma')
-rw-r--r-- | numpy/ma/core.py | 7 | ||||
-rw-r--r-- | numpy/ma/extras.py | 2 | ||||
-rw-r--r-- | numpy/ma/mrecords.py | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index b1e48c156..1bf41b3d8 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -3210,7 +3210,8 @@ class MaskedArray(ndarray): "of fill_value at 0. Discarding " "heterogeneous fill_value and setting " "all to {fv!s}.".format(indx=indx, - fv=dout._fill_value[0])) + fv=dout._fill_value[0]), + stacklevel=2) dout._fill_value = dout._fill_value.flat[0] dout._isfield = True # Update the mask if needed @@ -4195,7 +4196,7 @@ class MaskedArray(ndarray): raise TypeError("Only length-1 arrays can be converted " "to Python scalars") elif self._mask: - warnings.warn("Warning: converting a masked element to nan.") + warnings.warn("Warning: converting a masked element to nan.", stacklevel=2) return np.nan return float(self.item()) @@ -6909,7 +6910,7 @@ def rank(obj): # 2015-04-12, 1.10.0 warnings.warn( "`rank` is deprecated; use the `ndim` function instead. ", - np.VisibleDeprecationWarning) + np.VisibleDeprecationWarning, stacklevel=2) return np.ndim(getdata(obj)) rank.__doc__ = np.rank.__doc__ diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index aefdd4e49..a05ea476b 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -1344,7 +1344,7 @@ def corrcoef(x, y=None, rowvar=True, bias=np._NoValue, allow_masked=True, msg = 'bias and ddof have no effect and are deprecated' if bias is not np._NoValue or ddof is not np._NoValue: # 2015-03-15, 1.10 - warnings.warn(msg, DeprecationWarning) + warnings.warn(msg, DeprecationWarning, stacklevel=2) # Get the data (x, xnotmask, rowvar) = _covhelper(x, y, rowvar, allow_masked) # Compute the covariance matrix diff --git a/numpy/ma/mrecords.py b/numpy/ma/mrecords.py index 6c9a4ea73..6b7acf469 100644 --- a/numpy/ma/mrecords.py +++ b/numpy/ma/mrecords.py @@ -743,7 +743,7 @@ def fromtextfile(fname, delimitor=None, commentchar='#', missingchar='', if len(vartypes) != nfields: msg = "Attempting to %i dtypes for %i fields!" msg += " Reverting to default." - warnings.warn(msg % (len(vartypes), nfields)) + warnings.warn(msg % (len(vartypes), nfields), stacklevel=2) vartypes = _guessvartypes(_variables[0]) # Construct the descriptor. |