def test_center_origin_joint_upsample_and_downsample_with_err_to_larger_False(self):
     kwargs = dict(
         image=np.array(
             [
                 [0, 1, 2, 3, 4],
                 [5, 6, 7, 8, 9],
                 [10, 11, 12, 13, 14],
             ]
         ),
         new_resolution=[1 / 2, 2],
         old_resolution=1,
         err_to_larger=False,
         extrapolation_fill_value=None,
         origin="zero",
         method="linear",
         anti_aliasing=False,
     )
     correct_output = np.array(
         [
             [0, 2],
             [2.5, 4.5],
             [5.0, 7.0],
             [7.5, 9.5],
             [10.0, 12.0],
             [12.5, 14.5],
         ]
     )
     assert np.array_equal(resample(**kwargs), correct_output)
 def test_center_origin_downsample(self):
     kwargs = dict(
         image=np.array(
             [
                 [0, 1, 2, 3, 4],
                 [5, 6, 7, 8, 9],
                 [10, 11, 12, 13, 14],
                 [15, 16, 17, 18, 19],
             ]
         ),
         new_resolution=2,
         old_resolution=1,
         err_to_larger=True,
         extrapolation_fill_value=None,
         origin="center",
         method="linear",
         anti_aliasing=False,
     )
     correct_output = np.array(
         [
             [2.5, 4.5, 6.5],
             [12.5, 14.5, 16.5],
         ]
     )
     assert np.array_equal(resample(**kwargs), correct_output)
 def test_center_origin_joint_upsample_and_downsample(self):
     kwargs = dict(
         image=np.array(
             [
                 [0, 1, 2, 3, 4],
                 [5, 6, 7, 8, 9],
             ]
         ),
         new_resolution=[1 / 2, 2],
         old_resolution=1,
         err_to_larger=True,
         extrapolation_fill_value=None,
         origin="center",
         method="linear",
         anti_aliasing=False,
     )
     correct_output = np.array(
         [
             [-1.25, 0.75, 2.75],
             [1.25, 3.25, 5.25],
             [3.75, 5.75, 7.75],
             [6.25, 8.25, 10.25],
         ]
     )
     assert np.array_equal(resample(**kwargs), correct_output)
 def test_center_origin_upsample(self):
     kwargs = dict(
         image=np.array(
             [
                 [0, 1, 2],
                 [3, 4, 5],
             ]
         ),
         new_resolution=1 / 2,
         old_resolution=1,
         err_to_larger=True,
         extrapolation_fill_value=None,
         origin="center",
         method="linear",
         anti_aliasing=False,
     )
     correct_output = np.array(
         [
             [-1.0, -0.5, 0.0, 0.5, 1.0, 1.5],
             [0.5, 1.0, 1.5, 2.0, 2.5, 3.0],
             [2.0, 2.5, 3.0, 3.5, 4.0, 4.5],
             [3.5, 4.0, 4.5, 5.0, 5.5, 6.0],
         ]
     )
     assert np.array_equal(resample(**kwargs), correct_output)