(self)
| 2312 | assert_identical(v, expected) |
| 2313 | |
| 2314 | def test_coarsen(self): |
| 2315 | v = self.cls(["x"], [0, 1, 2, 3, 4]) |
| 2316 | actual = v.coarsen({"x": 2}, boundary="pad", func="mean") |
| 2317 | expected = self.cls(["x"], [0.5, 2.5, 4]) |
| 2318 | assert_identical(actual, expected) |
| 2319 | |
| 2320 | actual = v.coarsen({"x": 2}, func="mean", boundary="pad", side="right") |
| 2321 | expected = self.cls(["x"], [0, 1.5, 3.5]) |
| 2322 | assert_identical(actual, expected) |
| 2323 | |
| 2324 | actual = v.coarsen({"x": 2}, func=np.mean, side="right", boundary="trim") |
| 2325 | expected = self.cls(["x"], [1.5, 3.5]) |
| 2326 | assert_identical(actual, expected) |
| 2327 | |
| 2328 | # working test |
| 2329 | v = self.cls(["x", "y", "z"], np.arange(40 * 30 * 2).reshape(40, 30, 2)) |
| 2330 | for windows, func, side, boundary in [ |
| 2331 | ({"x": 2}, np.mean, "left", "trim"), |
| 2332 | ({"x": 2}, np.median, {"x": "left"}, "pad"), |
| 2333 | ({"x": 2, "y": 3}, np.max, "left", {"x": "pad", "y": "trim"}), |
| 2334 | ]: |
| 2335 | v.coarsen(windows, func, boundary, side) |
| 2336 | |
| 2337 | def test_coarsen_2d(self): |
| 2338 | # 2d-mean should be the same with the successive 1d-mean |
nothing calls this directly
no test coverage detected