diff --git a/doc/source/pyplots/plot_thresholds.py b/doc/source/pyplots/plot_thresholds.py index 3f377309c..6b86fd5c8 100644 --- a/doc/source/pyplots/plot_thresholds.py +++ b/doc/source/pyplots/plot_thresholds.py @@ -6,7 +6,7 @@ s_soft = pywt.threshold(s, value=0.5, mode='soft') s_hard = pywt.threshold(s, value=0.5, mode='hard') -s_garotte = pywt.threshold(s, value=0.5, mode='garotte') +s_garrote = pywt.threshold(s, value=0.5, mode='garrote') s_firm1 = pywt.threshold_firm(s, value_low=0.5, value_high=1) s_firm2 = pywt.threshold_firm(s, value_low=0.5, value_high=2) s_firm3 = pywt.threshold_firm(s, value_low=0.5, value_high=4) @@ -14,8 +14,8 @@ fig, ax = plt.subplots(1, 2, figsize=(10, 4)) ax[0].plot(s, s_soft) ax[0].plot(s, s_hard) -ax[0].plot(s, s_garotte) -ax[0].legend(['soft (0.5)', 'hard (0.5)', 'non-neg. garotte (0.5)']) +ax[0].plot(s, s_garrote) +ax[0].legend(['soft (0.5)', 'hard (0.5)', 'non-neg. garrote (0.5)']) ax[0].set_xlabel('input value') ax[0].set_ylabel('thresholded value') diff --git a/pywt/_thresholding.py b/pywt/_thresholding.py index 598fcf53d..286f61179 100644 --- a/pywt/_thresholding.py +++ b/pywt/_thresholding.py @@ -32,7 +32,7 @@ def soft(data, value, substitute=0): def nn_garrote(data, value, substitute=0): - """Non-negative Garotte.""" + """Non-negative Garrote.""" data = np.asarray(data) magnitude = np.absolute(data) @@ -73,7 +73,10 @@ def less(data, value, substitute=0): 'hard': hard, 'greater': greater, 'less': less, - 'garotte': nn_garrote} + 'garrote': nn_garrote, + # misspelled garrote for backwards compatibility + 'garotte': nn_garrote, + } def threshold(data, value, mode='soft', substitute=0): @@ -90,7 +93,7 @@ def threshold(data, value, mode='soft', substitute=0): less than the value param are replaced with `substitute`. Data values with absolute value greater or equal to the thresholding value stay untouched. - ``garotte`` corresponds to the Non-negative garrote threshold [2]_, [3]_. + ``garrote`` corresponds to the Non-negative garrote threshold [2]_, [3]_. It is intermediate between ``hard`` and ``soft`` thresholding. It behaves like soft thresholding for small data values and approaches hard thresholding for large data values. @@ -109,7 +112,7 @@ def threshold(data, value, mode='soft', substitute=0): Numeric data. value : scalar Thresholding value. - mode : {'soft', 'hard', 'garotte', 'greater', 'less'} + mode : {'soft', 'hard', 'garrote', 'greater', 'less'} Decides the type of thresholding to be applied on input data. Default is 'soft'. substitute : float, optional @@ -148,7 +151,7 @@ def threshold(data, value, mode='soft', substitute=0): array([ 0. , 0. , 0. , 0.5, 1. , 1.5, 2. ]) >>> pywt.threshold(data, 2, 'hard') array([ 0. , 0. , 2. , 2.5, 3. , 3.5, 4. ]) - >>> pywt.threshold(data, 2, 'garotte') + >>> pywt.threshold(data, 2, 'garrote') array([ 0. , 0. , 0. , 0.9 , 1.66666667, 2.35714286, 3. ]) >>> pywt.threshold(data, 2, 'greater')