Esempio n. 1
0
    def test_02_convolve_random(self):
        """Convolve a random image with a large circular Gaussian kernel"""

        np.random.seed(0)
        image = np.random.uniform(size=(100, 100))
        kernel = cpms.circular_gaussian_kernel(1, 10)
        expected = scipy.ndimage.gaussian_filter(image, 1)
        result = scipy.ndimage.convolve(image, kernel)
        self.assertTrue(np.all(np.abs(result - expected) < 0.001))
Esempio n. 2
0
 def test_02_convolve_random(self):
     """Convolve a random image with a large circular Gaussian kernel"""
     
     np.random.seed(0)
     image = np.random.uniform(size=(100,100))
     kernel = cpms.circular_gaussian_kernel(1, 10)
     expected = scipy.ndimage.gaussian_filter(image, 1)
     result = scipy.ndimage.convolve(image, kernel)
     self.assertTrue(np.all(np.abs(result - expected) < .001))
Esempio n. 3
0
 def test_01_convolve_1(self):
     """The center of a large uniform image, convolved with a Gaussian should not change value"""
     image = np.ones((100, 100))
     kernel = cpms.circular_gaussian_kernel(1, 3)
     result = scipy.ndimage.convolve(image, kernel)
     self.assertTrue(np.all(np.abs(result[40:60, 40:60] - 1) < 0.00001))
Esempio n. 4
0
 def test_01_convolve_1(self):
     """The center of a large uniform image, convolved with a Gaussian should not change value"""
     image = np.ones((100,100))
     kernel = cpms.circular_gaussian_kernel(1, 3)
     result = scipy.ndimage.convolve(image, kernel)
     self.assertTrue(np.all(np.abs(result[40:60,40:60]-1) < .00001))