(dtype)
| 207 | @pytest.mark.slow |
| 208 | @pytest.mark.parametrize("dtype", ["f4", "i4", "c8"]) |
| 209 | def test_reductions_2D(dtype): |
| 210 | with warnings.catch_warnings(): |
| 211 | warnings.simplefilter("ignore", ComplexWarning) |
| 212 | x = (np.arange(1, 122) + 1j * np.arange(1, 122)).reshape((11, 11)).astype(dtype) |
| 213 | a = da.from_array(x, chunks=(4, 4)) |
| 214 | |
| 215 | b = a.sum(keepdims=True) |
| 216 | assert b.__dask_keys__() == [[(b.name, 0, 0)]] |
| 217 | |
| 218 | reduction_2d_test(da.sum, a, np.sum, x) |
| 219 | reduction_2d_test(da.mean, a, np.mean, x) |
| 220 | reduction_2d_test(da.var, a, np.var, x, False) # Difference in dtype algo |
| 221 | reduction_2d_test(da.std, a, np.std, x, False) # Difference in dtype algo |
| 222 | reduction_2d_test(da.min, a, np.min, x, False) |
| 223 | reduction_2d_test(da.max, a, np.max, x, False) |
| 224 | reduction_2d_test(da.any, a, np.any, x, False) |
| 225 | reduction_2d_test(da.all, a, np.all, x, False) |
| 226 | |
| 227 | reduction_2d_test(da.nansum, a, np.nansum, x) |
| 228 | reduction_2d_test(da.nanmean, a, np.mean, x) |
| 229 | reduction_2d_test(da.nanvar, a, np.nanvar, x, False) # Difference in dtype algo |
| 230 | reduction_2d_test(da.nanstd, a, np.nanstd, x, False) # Difference in dtype algo |
| 231 | reduction_2d_test(da.nanmin, a, np.nanmin, x, False) |
| 232 | reduction_2d_test(da.nanmax, a, np.nanmax, x, False) |
| 233 | |
| 234 | # prod/nanprod overflow for data at this size, leading to warnings about |
| 235 | # overflow/invalid values. |
| 236 | with warnings.catch_warnings(): |
| 237 | warnings.simplefilter("ignore", RuntimeWarning) |
| 238 | reduction_2d_test(da.prod, a, np.prod, x) |
| 239 | reduction_2d_test(da.nanprod, a, np.nanprod, x) |
| 240 | |
| 241 | |
| 242 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected