Skip to content

Commit

Permalink
sort tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnBe committed Dec 6, 2024
1 parent 9690574 commit f52a894
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/test_proc_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit f52a894

Please sign in to comment.