Skip to content

Commit d9755b4

Browse files
committed
Add zenodo test
1 parent 28a17ed commit d9755b4

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import time
2+
import cupy as cp
3+
import numpy as np
4+
import pytest
5+
6+
from numpy.testing import assert_allclose
7+
from httomolibgpu.prep.stripe import remove_all_stripe
8+
from httomolibgpu.prep.normalize import normalize
9+
from conftest import force_clean_gpu_memory
10+
11+
12+
@pytest.mark.parametrize(
13+
"dataset_fixture, exp_sum, exp_mean, exp_mean_sum, exp_shape",
14+
[
15+
("i13_dataset1", 32071604.0, 0.208765, 1252.7957, (6001, 10, 2560)),
16+
("i13_dataset3", 27234604.0, 0.59093, 3546.1704, (6001, 3, 2560)),
17+
],
18+
ids=["dataset_one", "dataset_three"],
19+
)
20+
def test_remove_all_stripe_with_i13_data(
21+
request, dataset_fixture, exp_sum, exp_mean, exp_mean_sum, exp_shape
22+
):
23+
dataset = request.getfixturevalue(dataset_fixture)
24+
data_normalised = normalize(dataset[0], dataset[2], dataset[3], minus_log=True)
25+
output = remove_all_stripe(cp.copy(data_normalised)).get()
26+
27+
assert_allclose(np.sum(output), exp_sum, rtol=1e-07, atol=1e-6)
28+
assert_allclose(np.mean(output), exp_mean, rtol=1e-07, atol=1e-6)
29+
assert_allclose(np.mean(output, axis=(1, 2)).sum(), exp_mean_sum, rtol=1e-06)
30+
force_clean_gpu_memory()
31+
assert output.shape == exp_shape
32+
assert output.dtype == np.float32
33+
assert output.flags.c_contiguous

zenodo-tests/test_recon/test_algorithm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_reconstruct_FBP_i12_dataset1(i12_dataset1):
3838
)
3939
assert recon_data.flags.c_contiguous
4040
recon_data = recon_data.get()
41-
assert_allclose(np.sum(recon_data), 46569.395, rtol=1e-07, atol=1e-6)
41+
assert_allclose(np.sum(recon_data), 46569.402, rtol=1e-07, atol=1e-6)
4242
assert recon_data.dtype == np.float32
4343
assert recon_data.shape == (2560, 50, 2560)
4444

0 commit comments

Comments
 (0)