Skip to content

Commit db6cdd0

Browse files
committed
add test_zero_mean_unit_variance_preprocessing_fixed
1 parent acbd194 commit db6cdd0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/prediction_pipeline/test_preprocessing.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,21 @@ def test_zero_mean_unit_variance_preprocessing():
4343
xr.testing.assert_allclose(expected, result)
4444

4545

46+
def test_zero_mean_unit_variance_preprocessing_fixed():
47+
from bioimageio.core.prediction_pipeline._processing import ZeroMeanUnitVariance
48+
49+
preprocessing = ZeroMeanUnitVariance(
50+
"data_name", mode="fixed", axes=["y"], mean=[1, 4, 7], std=[0.81650, 0.81650, 0.81650]
51+
)
52+
data = xr.DataArray(np.arange(9).reshape((1, 1, 3, 3)), dims=("b", "c", "x", "y"))
53+
expected = xr.DataArray(
54+
np.array([[-1.224743, 0.0, 1.224743], [-1.224743, 0.0, 1.224743], [-1.224743, 0.0, 1.224743]])[None, None],
55+
dims=("b", "c", "x", "y"),
56+
)
57+
result = preprocessing(data)
58+
xr.testing.assert_allclose(expected, result)
59+
60+
4661
def test_zero_mean_unit_across_axes():
4762
from bioimageio.core.prediction_pipeline._processing import ZeroMeanUnitVariance
4863

0 commit comments

Comments
 (0)