def test_patch_creation(self): """ Test the patch creation. """ index = numpy.array((4, 5, 2), dtype=numpy.int) patch_shape = numpy.array((3, 3, 3), dtype=numpy.int) py_patch = py_get_patch(index, self.to_denoise_array, patch_shape) c_patch = c_get_patch(index, self.to_denoise_array, patch_shape) self.assertTrue(numpy.allclose(py_patch, c_patch))
def test_patch_creation(self): """ Test the patch creation at different locations. """ for index, target in zip(self.locations, self.results): patch = get_patch(index, self.array, self.full_patch_size) cpatch = c_get_patch(index, self.array, self.full_patch_size) self.assertTrue(numpy.allclose(patch, target)) self.assertTrue(numpy.allclose(patch, cpatch))
def test_speed(self): """ Test the patch creation speed. """ for vector_index in range(self.array.size): index = vector_to_array_index(vector_index, self.array) patch = c_get_patch(index, self.array, self.full_patch_size)