@@ -21,15 +21,17 @@ def tid():
2121def test_scale_linear (tid : MemberId ):
2222 from bioimageio .core .proc_ops import ScaleLinear
2323
24- offset = xr .DataArray ([1 , 2 , 42 ], dims = ("c" ))
25- gain = xr .DataArray ([1 , 2 , 3 ], dims = ("c" ))
26- data = xr .DataArray (np .arange (6 ).reshape ((1 , 2 , 3 )), dims = ("x" , "y" , "c " ))
24+ offset = xr .DataArray ([1 , 2 , 42 ], dims = ("channel" , ))
25+ gain = xr .DataArray ([1 , 2 , 3 ], dims = ("channel" , ))
26+ data = xr .DataArray (np .arange (6 ).reshape ((1 , 2 , 3 )), dims = ("x" , "y" , "channel " ))
2727 sample = Sample (members = {tid : Tensor .from_xarray (data )}, stat = {}, id = None )
2828
2929 op = ScaleLinear (input = tid , output = tid , offset = offset , gain = gain )
3030 op (sample )
3131
32- expected = xr .DataArray (np .array ([[[1 , 4 , 48 ], [4 , 10 , 57 ]]]), dims = ("x" , "y" , "c" ))
32+ expected = xr .DataArray (
33+ np .array ([[[1 , 4 , 48 ], [4 , 10 , 57 ]]]), dims = ("x" , "y" , "channel" )
34+ )
3335 xr .testing .assert_allclose (expected , sample .members [tid ].data , rtol = 1e-5 , atol = 1e-7 )
3436
3537
@@ -84,10 +86,10 @@ def test_zero_mean_unit_variance_fixed(tid: MemberId):
8486 op = FixedZeroMeanUnitVariance (
8587 tid ,
8688 tid ,
87- mean = xr .DataArray ([3 , 4 , 5 ], dims = ("c" )),
88- std = xr .DataArray ([2.44948974 , 2.44948974 , 2.44948974 ], dims = ("c" )),
89+ mean = xr .DataArray ([3 , 4 , 5 ], dims = ("channel" , )),
90+ std = xr .DataArray ([2.44948974 , 2.44948974 , 2.44948974 ], dims = ("channel" , )),
8991 )
90- data = xr .DataArray (np .arange (9 ).reshape ((1 , 3 , 3 )), dims = ("b" , "c " , "x" ))
92+ data = xr .DataArray (np .arange (9 ).reshape ((1 , 3 , 3 )), dims = ("b" , "channel " , "x" ))
9193 expected = xr .DataArray (
9294 np .array (
9395 [
@@ -124,7 +126,7 @@ def test_zero_mean_unit_variance_fixed2(tid: MemberId):
124126def test_zero_mean_unit_across_axes (tid : MemberId ):
125127 from bioimageio .core .proc_ops import ZeroMeanUnitVariance
126128
127- data = xr .DataArray (np .arange (18 ).reshape ((2 , 3 , 3 )), dims = ("c " , "x" , "y" ))
129+ data = xr .DataArray (np .arange (18 ).reshape ((2 , 3 , 3 )), dims = ("channel " , "x" , "y" ))
128130
129131 op = ZeroMeanUnitVariance (
130132 tid ,
@@ -136,7 +138,8 @@ def test_zero_mean_unit_across_axes(tid: MemberId):
136138 sample .stat = compute_measures (op .required_measures , [sample ])
137139
138140 expected = xr .concat (
139- [(data [i : i + 1 ] - data [i ].mean ()) / data [i ].std () for i in range (2 )], dim = "c"
141+ [(data [i : i + 1 ] - data [i ].mean ()) / data [i ].std () for i in range (2 )],
142+ dim = "channel" ,
140143 )
141144 op (sample )
142145 xr .testing .assert_allclose (expected , sample .members [tid ].data , rtol = 1e-5 , atol = 1e-7 )
@@ -146,7 +149,7 @@ def test_binarize(tid: MemberId):
146149 from bioimageio .core .proc_ops import Binarize
147150
148151 op = Binarize (tid , tid , threshold = 14 )
149- data = xr .DataArray (np .arange (30 ).reshape ((2 , 3 , 5 )), dims = ("x" , "y" , "c " ))
152+ data = xr .DataArray (np .arange (30 ).reshape ((2 , 3 , 5 )), dims = ("x" , "y" , "channel " ))
150153 sample = Sample (members = {tid : Tensor .from_xarray (data )}, stat = {}, id = None )
151154 expected = xr .zeros_like (data )
152155 expected [{"x" : slice (1 , None )}] = 1
@@ -158,7 +161,7 @@ def test_binarize2(tid: MemberId):
158161 from bioimageio .core .proc_ops import Binarize
159162
160163 shape = (3 , 32 , 32 )
161- axes = ("c " , "y" , "x" )
164+ axes = ("channel " , "y" , "x" )
162165 np_data = np .random .rand (* shape )
163166 data = xr .DataArray (np_data , dims = axes )
164167
@@ -188,7 +191,7 @@ def test_clip(tid: MemberId):
188191def test_combination_of_op_steps_with_dims_specified (tid : MemberId ):
189192 from bioimageio .core .proc_ops import ZeroMeanUnitVariance
190193
191- data = xr .DataArray (np .arange (18 ).reshape ((2 , 3 , 3 )), dims = ("c " , "x" , "y" ))
194+ data = xr .DataArray (np .arange (18 ).reshape ((2 , 3 , 3 )), dims = ("channel " , "x" , "y" ))
192195 sample = Sample (members = {tid : Tensor .from_xarray (data )}, stat = {}, id = None )
193196 op = ZeroMeanUnitVariance (
194197 tid ,
@@ -239,7 +242,7 @@ def test_scale_mean_variance(tid: MemberId, axes: Optional[Tuple[AxisId, ...]]):
239242 from bioimageio .core .proc_ops import ScaleMeanVariance
240243
241244 shape = (3 , 32 , 46 )
242- ipt_axes = ("c " , "y" , "x" )
245+ ipt_axes = ("channel " , "y" , "x" )
243246 np_data = np .random .rand (* shape )
244247 ipt_data = xr .DataArray (np_data , dims = ipt_axes )
245248 ref_data = xr .DataArray ((np_data * 2 ) + 3 , dims = ipt_axes )
0 commit comments