From f52a894231fc81792045033d726c6eda0db6e82b Mon Sep 17 00:00:00 2001 From: fynnbe Date: Fri, 6 Dec 2024 16:42:16 +0100 Subject: [PATCH] sort tests --- tests/test_proc_ops.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/test_proc_ops.py b/tests/test_proc_ops.py index e408d220..0b93f08b 100644 --- a/tests/test_proc_ops.py +++ b/tests/test_proc_ops.py @@ -105,6 +105,22 @@ def test_zero_mean_unit_variance_fixed(tid: MemberId): xr.testing.assert_allclose(expected, sample.members[tid].data, rtol=1e-5, atol=1e-7) +def test_zero_mean_unit_variance_fixed2(tid: MemberId): + from bioimageio.core.proc_ops import FixedZeroMeanUnitVariance + + np_data = np.arange(9).reshape(3, 3) + mean = float(np_data.mean()) + std = float(np_data.mean()) + eps = 1.0e-7 + op = FixedZeroMeanUnitVariance(tid, tid, mean=mean, std=std, eps=eps) + + data = xr.DataArray(np_data, dims=("x", "y")) + sample = Sample(members={tid: Tensor.from_xarray(data)}, stat={}, id=None) + expected = xr.DataArray((np_data - mean) / (std + eps), dims=("x", "y")) + op(sample) + xr.testing.assert_allclose(expected, sample.members[tid].data, rtol=1e-5, atol=1e-7) + + def test_zero_mean_unit_across_axes(tid: MemberId): from bioimageio.core.proc_ops import ZeroMeanUnitVariance @@ -126,22 +142,6 @@ def test_zero_mean_unit_across_axes(tid: MemberId): xr.testing.assert_allclose(expected, sample.members[tid].data, rtol=1e-5, atol=1e-7) -def test_zero_mean_unit_variance_fixed2(tid: MemberId): - from bioimageio.core.proc_ops import FixedZeroMeanUnitVariance - - np_data = np.arange(9).reshape(3, 3) - mean = float(np_data.mean()) - std = float(np_data.mean()) - eps = 1.0e-7 - op = FixedZeroMeanUnitVariance(tid, tid, mean=mean, std=std, eps=eps) - - data = xr.DataArray(np_data, dims=("x", "y")) - sample = Sample(members={tid: Tensor.from_xarray(data)}, stat={}, id=None) - expected = xr.DataArray((np_data - mean) / (std + eps), dims=("x", "y")) - op(sample) - xr.testing.assert_allclose(expected, sample.members[tid].data, rtol=1e-5, atol=1e-7) - - def test_binarize(tid: MemberId): from bioimageio.core.proc_ops import Binarize