Ejemplo n.º 1
0
 def test_wrong_method_name(self):
     with self.assertRaises(ValueError):
         reg.get_shift(
             reference_array=self.reference_array,
             shifted_array=self.shifted_array,
             shift_method="wrong",
         )
Ejemplo n.º 2
0
 def test_precision_None(self):
     with self.assertRaises(ValueError):
         reg.get_shift(
             reference_array=self.reference_array,
             shifted_array=self.shifted_array,
             precision=None,
         )
Ejemplo n.º 3
0
 def test_precision_float(self):
     with self.assertRaises(TypeError):
         reg.get_shift(
             reference_array=self.reference_array,
             shifted_array=self.shifted_array,
             precision=2.3,
         )
Ejemplo n.º 4
0
 def test_method_support_none(self):
     with self.assertRaises(ValueError):
         reg.get_shift(
             reference_array=self.reference_array,
             shifted_array=self.shifted_array,
             shift_method="support",
         )
Ejemplo n.º 5
0
 def setUp(self):
     # executed before each test
     reference_array = np.zeros((5, 5, 5), dtype=complex)
     reference_array[1:4, 1:4, 1:4] = 1 + 1j
     shifted_array = np.zeros((5, 5, 5), dtype=complex)
     shifted_array[2:, 2:, 0:3] = 1 + 1j
     self.reference_array = reference_array
     self.shifted_array = shifted_array
     self.shifts = reg.get_shift(reference_array=self.reference_array,
                                 shifted_array=self.shifted_array)
Ejemplo n.º 6
0
 def test_method_modulus(self):
     shifts = reg.get_shift(
         reference_array=self.reference_array,
         shifted_array=self.shifted_array,
         shift_method="modulus",
     )
     self.assertTrue(
         np.allclose(
             np.asarray(shifts),
             np.array([-1.0, -1.0]),
             rtol=1e-09,
             atol=1e-09,
         ))
Ejemplo n.º 7
0
 def test_precision_min_allowed(self):
     shifts = reg.get_shift(
         reference_array=self.reference_array,
         shifted_array=self.shifted_array,
         precision=1,
     )
     self.assertTrue(
         np.allclose(
             np.asarray(shifts),
             np.array([-1.0, -1.0, 1.0]),
             rtol=1e-09,
             atol=1e-09,
         ))
Ejemplo n.º 8
0
 def test_method_support(self):
     shifts = reg.get_shift(
         reference_array=self.reference_array,
         shifted_array=self.shifted_array,
         shift_method="support",
         support_threshold=0.5,
     )
     self.assertTrue(
         np.allclose(
             np.asarray(shifts),
             np.array([-1.0, -1.0, 1.0]),
             rtol=1e-09,
             atol=1e-09,
         ))