Skip to content

Commit a251bb1

Browse files
authored
fixes for #142 and outlier tests (#143)
* fixes for #142 and outlier tests * stops main pulls in iris tests action
1 parent 72d98ec commit a251bb1

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

.github/workflows/tests_run.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ jobs:
2222

2323
steps:
2424
- name: Checkout repository code
25-
uses: actions/checkout@v3
26-
with:
27-
ref: "main"
28-
fetch-depth: 0
25+
uses: actions/checkout@v4
2926

3027
- name: Create conda environment
3128
uses: mamba-org/setup-micromamba@v1

httomolibgpu/prep/normalize.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def __normalize(
8585
cutoff: float = 10.0,
8686
minus_log: bool = True,
8787
nonnegativity: bool = False,
88-
remove_nans: bool = False,
88+
remove_nans: bool = True,
8989
) -> cp.ndarray:
9090
from cupy import mean
9191

@@ -116,6 +116,7 @@ def __normalize(
116116
kernel += "if (isinf(v)) v = 0.0f;\n"
117117
kernel_name += "_remnan"
118118
kernel += "if (v > cutoff) v = cutoff;\n"
119+
kernel += "if (v < -cutoff) v = cutoff;\n"
119120
kernel += "out = v;\n"
120121

121122
normalisation_kernel = cp.ElementwiseKernel(

tests/test_misc/test_corr.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def test_remove_outlier3d(data):
145145
assert_allclose(np.mean(filtered_data), 808.753494, rtol=eps)
146146
assert_allclose(np.mean(filtered_data, axis=(1, 2)).sum(), 145575.628906)
147147
assert_allclose(np.median(filtered_data), 976.0)
148-
assert_allclose(np.median(filtered_data, axis=(1, 2)).sum(), 175741.5)
148+
assert_allclose(np.median(filtered_data, axis=(1, 2)).sum(), 175742)
149149

150150
assert filtered_data.dtype == np.uint16
151151

@@ -160,10 +160,10 @@ def test_remove_outlier2d(data):
160160
filtered_data = remove_outlier(data, kernel_size=3, axis=0, dif=1.5).get()
161161

162162
assert filtered_data.ndim == 3
163-
assert_allclose(np.mean(filtered_data), 808.861578504, rtol=eps)
164-
assert_allclose(np.mean(filtered_data, axis=(1, 2)).sum(), 145595.0841308)
165-
assert_allclose(np.max(filtered_data), 1080)
166-
assert_allclose(np.min(filtered_data), 80)
163+
assert_allclose(np.mean(filtered_data), 809.049971, rtol=eps)
164+
assert_allclose(np.mean(filtered_data, axis=(1, 2)).sum(), 145628.994824)
165+
assert_allclose(np.max(filtered_data), 1136)
166+
assert_allclose(np.min(filtered_data), 62)
167167

168168
assert filtered_data.dtype == np.uint16
169169
assert filtered_data.flags.c_contiguous

0 commit comments

Comments
 (0)