Example #1
0
 def test_few_samples(self):
     g = kernel_smoothing(self.x,
                          self.y,
                          target_x=np.linspace(-5, 200, 5,
                                               dtype=np.float32),
                          q=7)
     self.assertTrue(g is not None, msg="None output")
     self.assertEqual(len(g), 5)
Example #2
0
    def test_many_samples(self):
        x_ref_count = getrefcount(self.x)
        y_ref_count = getrefcount(self.y)
        target_x_ref_count = getrefcount(self.target_x)

        self.assertEqual(x_ref_count, y_ref_count)
        self.assertEqual(x_ref_count, target_x_ref_count)

        g = kernel_smoothing(self.x, self.y, target_x=self.target_x, q=7)

        self.assertEqual(x_ref_count, getrefcount(self.x))
        self.assertEqual(y_ref_count, getrefcount(self.y))
        self.assertEqual(target_x_ref_count, getrefcount(self.target_x))
        self.assertEqual(1, getrefcount(g))
Example #3
0
 def test_large_smoothing(self):
     g = kernel_smoothing(self.x, self.y, f=1.5)
     self.assertTrue(g is not None, msg="None output")
     self.assertEqual(len(g), len(self.x))
Example #4
0
 def test_small(self):
     g = kernel_smoothing(self.x, self.y, q=1)
     self.assertTrue(g is not None, msg="None output")
     self.assertEqual(len(g), len(self.x))
Example #5
0
 def test_nans(self):
     x = [1, 2, 3, 4, 5, 6]
     y = [1, np.nan, 3, 4, np.nan, 6]
     g = kernel_smoothing(x, y, q=3)
     self.assertTrue(g is not None, msg="None output")
     self.assertEqual(len(g), len(x))
Example #6
0
 def test_numpy_float64(self):
     x = np.arange(0, 10, 1, dtype=np.float64)
     y = np.arange(0, 10, 1, dtype=np.float64)
     g = kernel_smoothing(x, y, q=3)
     self.assertTrue(g is not None, msg="None output")
     self.assertEqual(len(g), len(x))