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))
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))
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))
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))