Commit 734fe1c0 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Add test_sino_array_subtraction_cuda

parent 811c42d3
......@@ -64,3 +64,25 @@ class TestSinoNormalization:
compare_normalizations(array_1D)
compare_normalizations(array_2D)
@pytest.mark.skipif(not(__has_pycuda__), reason="Need pycuda for sinogram normalization with cuda backend")
def test_sino_array_subtraction_cuda(self):
with pytest.raises(ValueError):
CudaSinoNormalization(kind="subtract_array", sinos_shape=self.sino.shape)
array_1D = np.arange(self.sino.shape[-1])
array_2D = np.arange(self.sino.size).reshape(self.sino.shape)
def compare_normalizations(normalization_arr):
sino_normalization = CudaSinoNormalization(
kind="subtract_array", sinos_shape=self.sino.shape,
normalization_array=normalization_arr
)
sino = garray.to_gpu(self.sino)
sino_normalization.normalize(sino)
ref = self.sino - normalization_arr
assert np.allclose(sino.get(), ref)
compare_normalizations(array_1D)
compare_normalizations(array_2D)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment