Ejemplo n.º 1
0
 def test_center_enrichment(self):
     """Tests center enrichment of sliding diamond
     of a synthetically generated gaussian."""
     x_values, y_values = HT.sliding_diamond(self.gaussian, side_len=6)
     center_mean = np.mean(y_values[np.where(np.abs(x_values) < 1)])
     border_mean = np.mean(y_values[:5])
     self.assertTrue(center_mean > 5 * border_mean)
Ejemplo n.º 2
0
 def test_odd_diamond(self):
     """Tests sliding a diamond of odd sidelength
     for small fixed matrix."""
     x_values, y_values = HT.sliding_diamond(self.test_matrix,
                                             side_len=3,
                                             center_x=False)
     x_check = np.array([1, 2, 3, 4])
     y_check = np.array([3.666666666, 4.11111111, 4.77777777, 2.55555555])
     self.assertTrue(all(np.isclose(x_values, x_check)))
     self.assertTrue(all(np.isclose(y_values, y_check)))
Ejemplo n.º 3
0
 def test_even_diamond(self):
     """Tests sliding a diamond of even sidelength
     for small fixed matrix."""
     x_values, y_values = HT.sliding_diamond(self.test_matrix,
                                             side_len=2,
                                             center_x=False)
     x_check = np.array([0.5, 1.5, 2.5, 3.5, 4.5])
     y_check = np.array([3.5, 4.75, 4.75, 3.25, 2.0])
     self.assertTrue(all(np.isclose(x_values, x_check)))
     self.assertTrue(all(np.isclose(y_values, y_check)))
Ejemplo n.º 4
0
 def test_odd_diamond_xnorm(self):
     """Tests sliding a diamond of odd sidelength
     with x normalization for small fixed matrix."""
     x_values, y_values = HT.sliding_diamond(self.test_matrix,
                                             side_len=3,
                                             center_x=True)
     x_check = np.array([-1.5, -0.5, 0.5, 1.5])
     y_check = np.array([3.666666666, 4.11111111, 4.77777777, 2.55555555])
     self.assertTrue(all(np.isclose(x_values, x_check)))
     self.assertTrue(all(np.isclose(y_values, y_check)))
Ejemplo n.º 5
0
 def test_even_diamond_xnorm(self):
     """Tests sliding a diamond of even sidelength
     with x normalization (center is set to 0) for
     small fixed matrix.."""
     x_values, y_values = HT.sliding_diamond(self.test_matrix,
                                             side_len=2,
                                             center_x=True)
     x_check = np.array([-2, -1, 0, 1, 2])
     y_check = np.array([3.5, 4.75, 4.75, 3.25, 2.0])
     self.assertTrue(all(np.isclose(x_values, x_check)))
     self.assertTrue(all(np.isclose(y_values, y_check)))