pywt.threshold_firm returns NaN for input values whose magnitude is exactly equal to the threshold in the case where value_low is equal to value_high. This is unexpected because the function's docstring clearly states that when value_high equals value_low, threshold_firm is equivalent to hard thresholding.
|
If ``value_high == value_low`` this function becomes hard-thresholding. |
Reproducer
import numpy as np
import pywt
data = np.array([1.0, 2.0, -2.0, 3.0])
print(pywt.threshold_firm(data, 2.0, 2.0))
Current result:
Expected result:
which is the same result as:
pywt.threshold(data, 2.0, mode="hard")
pywt.threshold_firmreturnsNaNfor input values whose magnitude is exactly equal to the threshold in the case wherevalue_lowis equal tovalue_high. This is unexpected because the function's docstring clearly states that whenvalue_highequalsvalue_low,threshold_firmis equivalent to hard thresholding.pywt/pywt/_thresholding.py
Line 212 in cc45b0d
Reproducer
Current result:
Expected result:
which is the same result as: