From b4f6793db0f4834b9f04cd8471a86cb17bc37306 Mon Sep 17 00:00:00 2001 From: Vineet Kumar Date: Wed, 23 Sep 2026 10:11:09 +0530 Subject: [PATCH] BUG: handle equal thresholds in threshold_firm --- pywt/_thresholding.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pywt/_thresholding.py b/pywt/_thresholding.py index 10a0127d..85d00b23 100644 --- a/pywt/_thresholding.py +++ b/pywt/_thresholding.py @@ -239,6 +239,10 @@ def threshold_firm(data, value_low, value_high): "value_high must be greater than or equal to value_low.") data = np.asarray(data) + + if value_low == value_high: + return hard(data, value_low) + magnitude = np.absolute(data) with np.errstate(divide='ignore', invalid='ignore'): # divide by zero okay as np.inf values get clipped, so ignore warning.