8000 Deprecations 1.6 by rgommers · Pull Request #54 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Deprecations 1.6 #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DEP: remove deprecated items from ma/core.py
The following are removed:
  - MaskedArray.raw_data method
  - MaskedArray flag keyword
  - make_mask flag keyword
  - allclose fill_value keyword

Also change some assert's to assert_().
  • Loading branch information
rgommers committed Mar 7, 2011
commit 9e8fd8e6d74f1bb31d10714b931f2a6e8c6956cd
49 changes: 5 additions & 44 deletions numpy/ma/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ def is_mask(m):
except AttributeError:
return False

def make_mask(m, copy=False, shrink=True, flag=None, dtype=MaskType):
def make_mask(m, copy=False, shrink=True, dtype=MaskType):
"""
Create a boolean mask from an array.

Expand All @@ -1436,8 +1436,6 @@ def make_mask(m, copy=False, shrink=True, flag=None, dtype=MaskType):
Whether to return a copy of `m` (True) or `m` itself (False).
shrink : bool, optional
Whether to shrink `m` to ``nomask`` if all its values are False.
flag : bool, optional
Deprecated equivalent of `shrink`.
dtype : dtype, optional
Data-type of the output mask. By default, the output mask has
a dtype of MaskType (bool). If the dtype is flexible, each field
Expand Down Expand Up @@ -1491,10 +1489,6 @@ def make_mask(m, copy=False, shrink=True, flag=None, dtype=MaskType):
dtype=[('man', '|b1'), ('mouse', '|b1')])

"""
if flag is not None:
warnings.warn("The flag 'flag' is now called 'shrink'!",
DeprecationWarning)
shrink = flag
if m is nomask:
return nomask
elif isinstance(m, ndarray):
Expand Down Expand Up @@ -2582,7 +2576,7 @@ class MaskedArray(ndarray):

x = MaskedArray(data, mask=nomask, dtype=None,
copy=False, subok=True, ndmin=0, fill_value=None,
keep_mask=True, hard_mask=None, flag=None, shrink=True)
keep_mask=True, hard_mask=None, shrink=True)

Parameters
----------
Expand Down Expand Up @@ -2625,7 +2619,7 @@ class MaskedArray(ndarray):

def __new__(cls, data=None, mask=nomask, dtype=None, copy=False,
subok=True, ndmin=0, fill_value=None,
keep_mask=True, hard_mask=None, flag=None, shrink=True,
keep_mask=True, hard_mask=None, shrink=True,
**options):
"""
Create a new masked array from scratch.
Expand All @@ -2635,10 +2629,6 @@ def __new__(cls, data=None, mask=nomask, dtype=None, copy=False,
A masked array can also be created by taking a .view(MaskedArray).

"""
if flag is not None:
warnings.warn("The flag 'flag' is now called 'shrink'!",
DeprecationWarning)
shrink = flag
# Process data............
_data = np.array(data, dtype=dtype, copy=copy, subok=True, ndmin=ndmin)
_baseclass = getattr(data, '_baseclass', type(_data))
Expand Down Expand Up @@ -3258,27 +3248,6 @@ def _get_data(self):
_data = property(fget=_get_data)
data = property(fget=_get_data)

def raw_data(self):
"""
Return the data part of the masked array.

DEPRECATED: You should really use ``.data`` instead.

Examples
--------
>>> x = np.ma.array([1, 2, 3], mask=[False, True, False])
>>> x
masked_array(data = [1 -- 3],
mask = [False True False],
fill_value = 999999)
>>> x.data
array([1, 2, 3])

"""
warnings.warn('Use .data instead.', DeprecationWarning)
return self._data


def _get_flat(self):
"Return a flat iterator."
return MaskedIterator(self)
Expand Down Expand Up @@ -5025,7 +4994,7 @@ def sort(self, axis= -1, kind='quicksort', order=None,
>>> a.sort(endwith=False, fill_value=3)
>>> print a
[1 -- -- 3 5]

"""
if self._mask is nomask:
ndarray.sort(self, axis=axis, kind=kind, order=order)
Expand Down Expand Up @@ -6798,7 +6767,7 @@ def allequal (a, b, fill_value=True):
else:
return False

def allclose (a, b, masked_equal=True, rtol=1e-5, atol=1e-8, fill_value=None):
def allclose (a, b, masked_equal=True, rtol=1e-5, atol=1e-8):
"""
Returns True if two arrays are element-wise equal within a tolerance.

Expand All @@ -6819,9 +6788,6 @@ def allclose (a, b, masked_equal=True, rtol=1e-5, atol=1e-8, fill_value=None):
atol : float, optional
Absolute tolerance. The absolute difference is equal to `atol`.
Default is 1e-8.
fill_value : bool, optional
*Deprecated* - Whether masked values in `a` or `b` are considered equal
(True) or not (False).

Returns
-------
Expand Down Expand Up @@ -6873,11 +6839,6 @@ def allclose (a, b, masked_equal=True, rtol=1e-5, atol=1e-8, fill_value=None):
False

"""
if fill_value is not None:
warnings.warn("The use of fill_value is deprecated."\
" Please use masked_equal instead.")
masked_equal = fill_value
#
x = masked_array(a, copy=False)
y = masked_array(b, copy=False)
m = mask_or(getmask(x), getmask(y))
Expand Down
Loading
0