From e1777cc13d6e1f152e488d43ce4ccf60edec6c77 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Sat, 8 Jun 2024 10:38:00 -0400 Subject: [PATCH] FIX: Nonnegative meands >=0 --- src/eddymotion/estimator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/eddymotion/estimator.py b/src/eddymotion/estimator.py index 1423414c..89a77ef3 100644 --- a/src/eddymotion/estimator.py +++ b/src/eddymotion/estimator.py @@ -220,8 +220,8 @@ def _advanced_clip(data, p_min=35, p_max=99.98, nonnegative=True, dtype="int16", # Calculate stats on denoised version, to preempt outliers from biasing denoised = ndimage.median_filter(data, footprint=ball(3)) - a_min = np.percentile(denoised[denoised > 0] if nonnegative else denoised, p_min) - a_max = np.percentile(denoised[denoised > 0] if nonnegative else denoised, p_max) + a_min = np.percentile(denoised[denoised >= 0] if nonnegative else denoised, p_min) + a_max = np.percentile(denoised[denoised >= 0] if nonnegative else denoised, p_max) # Clip and cast data = np.clip(data, a_min=a_min, a_max=a_max)