From 105afa632c8c1a5527f62488ca5596f089999ed9 Mon Sep 17 00:00:00 2001 From: nuff Date: Fri, 16 Feb 2024 06:52:46 +0100 Subject: [PATCH 1/2] fix: return entire array if no outliers are found --- circleguard/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/circleguard/utils.py b/circleguard/utils.py index 75870705..0945cfe7 100644 --- a/circleguard/utils.py +++ b/circleguard/utils.py @@ -235,7 +235,8 @@ def filter_outliers(arr, bias=1.5): iqr = q3 - q1 lower_limit = q1 - (bias * iqr) upper_limit = q3 + (bias * iqr) - return [x for x in arr if lower_limit < x < upper_limit] + outliers = [x for x in arr if lower_limit < x < upper_limit] + return arr if not outliers else outliers TRACE = 5 From ac305d56477bcdd036bd970d01ed3020648ba2a8 Mon Sep 17 00:00:00 2001 From: nuff Date: Fri, 16 Feb 2024 06:58:18 +0100 Subject: [PATCH 2/2] clearer variable names --- circleguard/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circleguard/utils.py b/circleguard/utils.py index 0945cfe7..76d6c916 100644 --- a/circleguard/utils.py +++ b/circleguard/utils.py @@ -235,8 +235,8 @@ def filter_outliers(arr, bias=1.5): iqr = q3 - q1 lower_limit = q1 - (bias * iqr) upper_limit = q3 + (bias * iqr) - outliers = [x for x in arr if lower_limit < x < upper_limit] - return arr if not outliers else outliers + arr_without_outliers = [x for x in arr if lower_limit < x < upper_limit] + return arr if not arr_without_outliers else arr_without_outliers TRACE = 5