summaryrefslogtreecommitdiff
path: root/numpy/ma/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'main' into deprecate-find-common-typeCharles Harris2023-05-135-11/+249
|\
| * BUG: Fix masked array ravel order for A (and somewhat K)Sebastian Berg2023-04-281-0/+2
| | | | | | | | | | | | Swaps the order to the correct thing and thus closes gh-23651
| * Merge pull request #23626 from seberg/issue-22912Charles Harris2023-04-211-0/+16
| |\ | | | | | | BUG: Fix masked array raveling when `order="A"` or `order="K"`
| | * BUG: Fix masked array raveling when `order="A"` or `order="K"`Sebastian Berg2023-04-211-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This transitively fixes gh-22912. I had alooked a bit into whether it is worthwhile to preserve the mask order, but TBH, we seem to not do so in so many places, that I don't think it really is worthwhile. Applying `order="K"` or `order="A"` to the data and mask separately is an big bug though. Closes gh-22912
| * | BUG: Ignore invalid and overflow warnings in masked setitemSebastian Berg2023-04-211-0/+18
| |/ | | | | | | | | | | | | | | | | | | | | | | Giving a warning for invalid/overflow in settitem/casts is right (IMO), however for masked arrays it can be surprising since the warning is not useful if the value is invalid but also masked. So, simply blanket ignore the relevant warnings in setitem via errstate. (There may be some other cases like `.astype()` where it might be helpful to MA users to just blanket opt-out of these new warnings.) Closes gh-23000
| * ENH: fix formatyuki2023-03-221-12/+24
| |
| * Merge branch 'main' into enh-ma-dotyuki2023-03-223-8/+14
| |\
| | * BUG: ma with structured dtypeTyler Reddy2023-03-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #22041 * add regression test and fix for creating a masked array with a structured dtype; the test is simply for lack of error in the repoducer * the concern expressed by core team in matching issue was that `astropy` might be negatively affected; I ran full `astropy` (hash: `c9ad7c56`) test suite locally with this feature branch and it seemed "ok," just 1 unrelated network failure in the network-requiring tests (`test_ftp_tls_auto`): ```1 failed, 21430 passed, 3490 skipped, 176 xfailed, 23275 warnings in 430.18s (0:07:10)```
| | * DEP: deprecate `product`, `cumproduct`, `sometrue`, `alltrue`Ralf Gommers2023-03-022-8/+8
| | | | | | | | | | | | [skip cirrus]
| * | add support for non-2d arraysyuki2023-03-031-0/+29
| |/
| * DEP: deprecate `np.round_`Ralf Gommers2023-02-281-2/+2
| | | | | | | | Closes gh-22617
| * BUG: PR 23269 revisionsTyler Reddy2023-02-251-0/+8
| | | | | | | | | | * handle 0-D masked object array deepcopies, with regression test, based on reviewer feedback
| * MAINT: PR 23269 revisionsTyler Reddy2023-02-241-0/+3
| | | | | | | | | | * the deepcopy of masked array object type now also includes the components beyond just `_data`; add a related test case
| * MAINT: PR 23269 revisionsTyler Reddy2023-02-241-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * guard masked array `__deepcopy__` special object handling behind `dtype.hasobject`, based on reviewer feedback * masked array `__deepcopy__` for object type handling now deepcopies from `self._data` directly, based on reviewer feedback * add a test case for 2D masked array object deepcopies, since reviewer was not convinced this was working
| * BUG: masked array proper deepcopiesTyler Reddy2023-02-231-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #22556 Fixes #21022 * add regression test and fix for gh-22556, where we were relying on the array `copy` arg to deepcopy a compound object type; I thought about performance issues here, but if you are already in the land of `object` and you are explicitly opting in to `deepcopy`, it seems like performance might be wishful thinking anyway * add regression test and fix for gh-21022--this one was weirder but seems possible to sidestep by not trying to assign a shape of `()` to something that already has shape `()` and a non-writeable `shape` attribute
| * Merge pull request #23113 from hmaarrfk/slots_for_mixinsSebastian Berg2023-01-271-0/+10
| |\ | | | | | | ENH: Add slots to NDArrayOperatorsMixin allowing them in subclasses
| | * TST: Add a test for slots and NDArrayOperatorsMixin subclassingMark Harfouche2023-01-271-0/+10
| | |
| * | BUG: fix ma.diff not preserving mask when using append/prepend (#22776)Marko Pacak2023-01-191-0/+40
| |/ | | | | | | | | Port CORE diff relevant code to MA and adapt docstrings examples and add tsts. Closes gh-22465
| * MAINT: restore npymath implementations needed for freebsdmattip2022-12-251-0/+2
| |
| * API: Ensure a full mask is returned for masked_invalidSebastian Berg2022-12-211-0/+12
| | | | | | | | | | | | | | | | Matplotlib relies on this, so we don't seem to have much of a choice. I am surprised that we were not notified of the issue before release time. Closes gh-22720, gh-22720
| * BUG: Do not use getdata() in np.ma.masked_invalidSebastian Berg2022-12-191-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | This is the minimal solution to fix gh-22826 with as little change as possible. We should fix `getdata()` but I don't want to do that in a bug-fix release really. IMO the alternative is to revert gh-22046 which would also revert the behavior noticed in gh-22720 (which seems less harmful though). Closes gh-22826
| * BUG: `keepdims=True` is ignored if `out` is not `None` in `numpy.median()`, ↵Roy Smart2022-12-051-0/+29
| | | | | | | | | | | | `numpy.percentile()`, and `numpy.quantile()`. Closes #22714, #22544.
| * ENH: Speedup masked array creation when mask=None (#22725)Lefteris Loukas2022-12-051-0/+2
| | | | | | | | | | | | | | This PR Closes gh-17046. The problem was that when calling mask=None, the array creation took seconds compared to the microseconds needed when calling mask=False. Using `mask=None` is a bit dubious, since it has a different meaning from the default `mask=nomask`, but the speed trap is so hard to find, that it seems pragmatic to support it. OTOH, it also would seem fine to deprecate the whole path (or maybe see if the path can be sped up so that the speed difference isn't forbidding eough to bother).
| * TST: Skip tests that are not currently supported in wasmHood Chatham2022-11-111-1/+2
| |
* | DEP: Deprecate `np.find_common_type`Sebastian Berg2022-11-071-1/+1
|/ | | | | | | | | The function uses the numeric scalar common dtype/promotion rules. These are subtly different from the typical NumPy rules defined by `np.result_type`. Mainly, there is no good reason to have two subtly different rules exposed and `find_common_type` is less reliable, slower, and not really maintainable when it comes to NEP 50.
* STY: Make linter happySebastian Berg2022-10-271-3/+2
| | | | Not new things, but in touched lines...
* TST,MAINT: Replace most `setup` with `setup_method` (also teardown)Sebastian Berg2022-10-275-40/+41
| | | | | | | | In some cases, the replacement is clearly not what is intended, in those (where setup was called explicitly), I mostly renamed `setup` to `_setup`. The `test_ccompile_opt` is a bit confusing, so left it right now (this will probably fail)
* MAINT: remove u-prefix for former Unicode strings (#22479)Mike Taves2022-10-262-4/+4
|
* Merge pull request #22046 from cmarmo/masked-invalidSebastian Berg2022-10-051-0/+12
|\ | | | | BUG: Make `mask_invalid` consistent with `mask_where` if `copy` is set to `False`
| * Remove try statement. Add test.Chiara Marmo2022-09-071-0/+4
| |
| * Fix lint.Chiara Marmo2022-07-251-1/+2
| |
| * Make mask_invalid consistent with mask_where when copy is set to False. Add ↵Chiara Marmo2022-07-251-0/+7
| | | | | | | | test for type erroring.
* | Remove long deprecated functionality from np.maBrigitta Sipőcz2022-09-081-5/+0
| |
* | Merge pull request #21995 from eirrgang/mei-1468Matti Picus2022-09-071-1/+1
|\ \ | |/ |/| BUG: Distinguish exact vs. equivalent dtype for C type aliases.
| * Don't regenerate the descriptor unnecessarily.M. Eric Irrgang2022-07-161-1/+1
| | | | | | | | | | Fix a false mismatch. Separate dtype objects, even if equivalent, cause distinct array views to be created.
* | Revert "TST: add a test for ma.minimum.reduce with axis keyword"mattip2022-07-201-12/+0
| | | | | | | | This reverts commit e2efced9bdfc773f5aca2487f12ab1cb2bd11833.
* | Revert "BUG: Fix masked median multiple masked arrays (#21999)"mattip2022-07-201-19/+0
| | | | | | | | This reverts commit 6b8d55e66e532d66e1701ad039b4cda306839b3f.
* | Revert "ENH: Adding __array_ufunc__ capability to MaskedArrays."mattip2022-07-201-2/+2
| | | | | | | | This reverts commit 8cd6f4ca00b6e0da3833fc267d50067b2ddbc069.
* | BUG: Fix masked median multiple masked arrays (#21999)Brigitta Sipőcz2022-07-171-0/+19
| | | | | | | | | | | | | | Fixed issue that occurs when trying to take the median of a list of masked arrays. Added a check to see if the input is a list then converts to a masked array. See issue #10757 for more information. Co-authored-by: jsclose <jsclose@umich.edu>
* | TST: add a test for ma.minimum.reduce with axis keywordRuth Comer2022-07-161-0/+12
|/ | | | | Adapted from the problem reported at https://github.com/numpy/numpy/pull/21977#issuecomment-1186082534
* TST: Adding a test that MaskedArrays respect ufunc deferral heirarchyGreg Lucas2022-07-131-0/+64
| | | | | This test makes sure that a MaskedArray defers properly to another class if it doesn't know how to handle it. See #15200.
* ENH: Adding __array_ufunc__ capability to MaskedArrays.Greg Lucas2022-07-131-2/+2
| | | | | | This enables any ufunc numpy operations that are called on a MaskedArray to use the masked version of that function automatically without needing to resort to np.ma.func() calls.
* Revert "ENH: Adding __array_ufunc__ capability to MaskedArrays"Matti Picus2022-07-092-61/+2
|
* TST: Adding a test that MaskedArrays respect ufunc deferral heirarchyGreg Lucas2022-06-291-0/+59
| | | | | This test makes sure that a MaskedArray defers properly to another class if it doesn't know how to handle it. See #15200.
* ENH: Adding __array_ufunc__ capability to MaskedArrays.Greg Lucas2022-06-291-2/+2
| | | | | | This enables any ufunc numpy operations that are called on a MaskedArray to use the masked version of that function automatically without needing to resort to np.ma.func() calls.
* BUG: Use `keepdims` during normalization in `np.average` and `np.ma.average` ↵Srimukh Sripada2022-06-261-0/+9
| | | | | | | | | (#21851) The keepdims flag needs to be applied during the calculation of the sum of the weights in np.average and np.ma.average. Not passing it causes weights to broadcast incorrectly. Fixes #21850
* API: Define `<`, `<=`, `>`, `>=` for masked arraysSebastian Berg2022-06-211-0/+46
| | | | | | | | | | This defines the comparison operators (other than `==` and `!=`) explicitly for masked arrays. The mask is ignored for the resuling `res._data` (unlike `==` and `!=` which take the mask into account. Closes gh-21770, although the way that masked arrays propagate the fill-value seems generally broken and error prone.
* ENH: Add overflow check to float setitemSebastian Berg2022-06-131-1/+5
|
* TST: Fixup tests that cause FPEs during castsSebastian Berg2022-06-131-1/+4
|
* Merge pull request #20914 from kinshukdua/fix_ma_meanMatti Picus2022-06-121-0/+6
|\ | | | | BUG: change `ma.mean` dtype to be consistent with `np.mean`