We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c94b84 commit 624f482Copy full SHA for 624f482
httomolibgpu/misc/morph.py
@@ -83,15 +83,15 @@ def __sino_360_to_180(
83
out = cp.empty((n, dy, 2 * dz - overlap), dtype=data.dtype)
84
85
if rotation == "left":
86
- weights = cp.linspace(0, 1.0, overlap)
+ weights = cp.linspace(0, 1.0, overlap, dtype=cp.float32)
87
out[:, :, -dz + overlap :] = data[:n, :, overlap:]
88
out[:, :, : dz - overlap] = data[n : 2 * n, :, overlap:][:, :, ::-1]
89
out[:, :, dz - overlap : dz] = (
90
weights * data[:n, :, :overlap]
91
+ (weights * data[n : 2 * n, :, :overlap])[:, :, ::-1]
92
)
93
elif rotation == "right":
94
- weights = cp.linspace(1.0, 0, overlap)
+ weights = cp.linspace(1.0, 0, overlap, dtype=cp.float32)
95
out[:, :, : dz - overlap] = data[:n, :, :-overlap]
96
out[:, :, -dz + overlap :] = data[n : 2 * n, :, :-overlap][:, :, ::-1]
97
tests/test_misc/test_morph.py
@@ -7,6 +7,21 @@
7
from httomolibgpu.misc.morph import sino_360_to_180, data_resampler
8
9
10
+
11
+@pytest.mark.parametrize("rotation", ["left", "right"])
12
+def test_sino_360_to_180_realdata(ensure_clean_memory, sino3600, rotation):
13
+ shape_new = (3601, 3, 2560)
14
+ data3d = cp.zeros(shape_new, dtype=np.float32)
15
+ data3d[:,0,:] = sino3600
16
+ data3d[:,1,:] = sino3600
17
+ data3d[:,2,:] = sino3600
18
19
+ sino_360_to_180(data3d, overlap=900, rotation=rotation)
20
21
+ assert data3d.shape == shape_new
22
+ assert data3d.dtype == np.float32
23
+ assert data3d.flags.c_contiguous
24
25
@pytest.mark.parametrize(
26
"overlap, rotation",
27
[
0 commit comments