+
    [°³j"  ã                   óx   € R t ^ RItRR.tRR ltRR ltRR ltRR ltRR ltR	]R
]R]R]R]R]/t	RR lt
R tR# )z[
The thresholding helper module implements the most popular signal thresholding
functions.
NÚ	thresholdÚthreshold_firmc                 ó’  € \         P                  ! V 4      p \         P                  ! V 4      p\         P                  ! R R7      ;_uu_ 4        ^W,          ,
          pVP	                  ^ RVR7       W,          pRRR4       V^ 8X  d   X# \         P
                  ! W14      p\         P                  ! WRX4      #   + '       g   i     LF; i)Úignore©ÚdivideN©ÚminÚmaxÚout©ÚnpÚasarrayÚabsoluteÚerrstateÚclipÚlessÚwhere©ÚdataÚvalueÚ
substituteÚ	magnitudeÚthresholdedÚconds   &&&   ÚS/home/luca/screen-checking/.venv/lib/python3.14/site-packages/pywt/_thresholding.pyÚsoftr      s’   € Ü�:Š:�dÓ€DÜ—’˜DÓ!€Iä	�Š˜H×	%Ö	%à˜5�?Õ*ˆØ×Ñ˜Q D¨kÐÔ:ØÕ(ˆ÷	 
&ð �Q„ØÐä�wŠw�yÓ(ˆÜ�xŠx˜¨+Ó6Ð6÷ 
&×	%ús   Á,B6Â6C	c                ó°  € \         P                  ! V 4      p \         P                  ! V 4      p\         P                  ! RR7      ;_uu_ 4        ^V^,          V^,          ,          ,
          pVP	                  ^ RVR7       W,          pRRR4       V^ 8X  d   X# \         P
                  ! W14      p\         P                  ! WRX4      #   + '       g   i     LF; i)zNon-negative Garrote.r   r   Nr   r   r   s   &&&   r   Ú
nn_garroter   !   s�   € ä�:Š:�dÓ€DÜ—’˜DÓ!€Iä	�Š˜H×	%Ö	%à˜5 !�8 I¨q¥LÕ0Õ0ˆØ×Ñ˜Q D¨kÐÔ:ØÕ(ˆ÷	 
&ð �Q„ØÐä�wŠw�yÓ(ˆÜ�xŠx˜¨+Ó6Ð6÷ 
&×	%ús   Á;CÃC	c                 ó²   € \         P                  ! V 4      p \         P                  ! \         P                  ! V 4      V4      p\         P                  ! W2V 4      # )N)r   r   r   r   r   )r   r   r   r   s   &&& r   Úhardr    3   s:   € Ü�:Š:�dÓ€DÜ�7Š7”2—;’;˜tÓ$ eÓ,€DÜ�8Š8�D dÓ+Ð+ó    c                 óÒ   € \         P                  ! V 4      p \         P                  ! V 4      '       d   \        R 4      h\         P                  ! \         P
                  ! W4      W 4      # )z,greater thresholding only supports real data)r   r   ÚiscomplexobjÚ
ValueErrorr   r   ©r   r   r   s   &&&r   Úgreaterr&   9   sE   € Ü�:Š:�dÓ€DÜ	‡‚�t×ÒÜÐGÓHÐHÜ�8Š8”B—G’G˜DÓ(¨*Ó;Ð;r!   c                 óÒ   € \         P                  ! V 4      p \         P                  ! V 4      '       d   \        R 4      h\         P                  ! \         P
                  ! W4      W 4      # )z)less thresholding only supports real data)r   r   r#   r$   r   r&   r%   s   &&&r   r   r   @   sE   € Ü�:Š:�dÓ€DÜ	‡‚�t×ÒÜÐDÓEÐEÜ�8Š8”B—J’J˜tÓ+¨ZÓ>Ð>r!   r   r    r&   r   ÚgarroteÚgarottec                óä   €  \         V,          ! WV4      #   \         dO    R \        \         P                  4       4       4       p\	        RP                  RP                  T4      4      4      hi ; i)aó
  
Thresholds the input data depending on the mode argument.

In ``soft`` thresholding [1]_, data values with absolute value less than
`param` are replaced with `substitute`. Data values with absolute value
greater or equal to the thresholding value are shrunk toward zero
by `value`.  In other words, the new value is
``data/np.abs(data) * np.maximum(np.abs(data) - value, 0)``.

In ``hard`` thresholding, the data values where their absolute value is
less than the value param are replaced with `substitute`. Data values with
absolute value greater or equal to the thresholding value stay untouched.

``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.

In ``greater`` thresholding, the data is replaced with `substitute` where
data is below the thresholding value. Greater data values pass untouched.

In ``less`` thresholding, the data is replaced with `substitute` where data
is above the thresholding value. Lesser data values pass untouched.

Both ``hard`` and ``soft`` thresholding also support complex-valued data.

Parameters
----------
data : array_like
    Numeric data.
value : scalar
    Thresholding value.
mode : {'soft', 'hard', 'garrote', 'greater', 'less'}
    Decides the type of thresholding to be applied on input data. Default
    is 'soft'.
substitute : float, optional
    Substitute value (default: 0).

Returns
-------
output : array
    Thresholded array.

See Also
--------
threshold_firm

References
----------
.. [1] D.L. Donoho and I.M. Johnstone. Ideal Spatial Adaptation via
    Wavelet Shrinkage. Biometrika. Vol. 81, No. 3, pp.425-455, 1994.
    DOI:10.1093/biomet/81.3.425
.. [2] L. Breiman. Better Subset Regression Using the Nonnegative Garrote.
    Technometrics, Vol. 37, pp. 373-384, 1995.
    DOI:10.2307/1269730
.. [3] H-Y. Gao.  Wavelet Shrinkage Denoising Using the Non-Negative
    Garrote.  Journal of Computational and Graphical Statistics Vol. 7,
    No. 4, pp.469-488. 1998.
    DOI:10.1080/10618600.1998.10474789

Examples
--------
>>> import numpy as np
>>> import pywt
>>> data = np.linspace(1, 4, 7)
>>> data
array([ 1. ,  1.5,  2. ,  2.5,  3. ,  3.5,  4. ])
>>> pywt.threshold(data, 2, 'soft')
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, 'garrote')
array([ 0.        ,  0.        ,  0.        ,  0.9       ,  1.66666667,
        2.35714286,  3.        ])
>>> pywt.threshold(data, 2, 'greater')
array([ 0. ,  0. ,  2. ,  2.5,  3. ,  3.5,  4. ])
>>> pywt.threshold(data, 2, 'less')
array([ 1. ,  1.5,  2. ,  0. ,  0. ,  0. ,  0. ])

c              3   ó.   "  € T F  pR V R 2x € K  	  R# 5i)Ú'N© )Ú.0Úkeys   & r   Ú	<genexpr>Úthreshold.<locals>.<genexpr>§   s   é € ð 5Ù3ð  #�!�C�5˜•
Û3ùs   ‚z.The mode parameter only takes values from: {}.z, )Úthresholding_optionsÚKeyErrorÚsortedÚkeysr$   ÚformatÚjoin)r   r   Úmoder   r5   s   &&&& r   r   r   Q   si   € ðd3Ü# DÖ)¨$°zÓBÐBøÜô 3ñ5ÜÔ+×0Ñ0Ó2Ô3ó5ˆäÐIß ™& §¡¨4£Ó1ó3ð 	3ð	3ús
   ‚ –AA/c                ó(  € V^ 8  d   \        R4      hW!8  d   \        R4      h\        P                  ! V 4      p \        P                  ! V 4      p\        P                  ! RR7      ;_uu_ 4        W!,
          pV^W,          ,
          ,          V,          pVP                  ^ RVR7       W,          pRRR4       \        P                  ! W28„  4      p\        P                  ! V^ ,          4      '       d   W,          XV&   X#   + '       g   i     LX; i)a³  Firm threshold.

The approach is intermediate between soft and hard thresholding [1]_. It
behaves the same as soft-thresholding for values below `value_low` and
the same as hard-thresholding for values above `thresh_high`.  For
intermediate values, the thresholded value is in between that corresponding
to soft or hard thresholding.

Parameters
----------
data : array-like
    The data to threshold.  This can be either real or complex-valued.
value_low : float
    Any values smaller then `value_low` will be set to zero.
value_high : float
    Any values larger than `value_high` will not be modified.

Notes
-----
This thresholding technique is also known as semi-soft thresholding [2]_.

For each value, `x`, in `data`. This function computes::

    if np.abs(x) <= value_low:
        return 0
    elif np.abs(x) > value_high:
        return x
    elif value_low < np.abs(x) and np.abs(x) <= value_high:
        return x * value_high * (1 - value_low/x)/(value_high - value_low)

``firm`` is a continuous function (like soft thresholding), but is
unbiased for large values (like hard thresholding).

If ``value_high == value_low`` this function becomes hard-thresholding.
If ``value_high`` is infinity, this function becomes soft-thresholding.

Returns
-------
val_new : array-like
    The values after firm thresholding at the specified thresholds.

See Also
--------
threshold

References
----------
.. [1] H.-Y. Gao and A.G. Bruce. Waveshrink with firm shrinkage.
    Statistica Sinica, Vol. 7, pp. 855-874, 1997.
.. [2] A. Bruce and H-Y. Gao. WaveShrink: Shrinkage Functions and
    Thresholds. Proc. SPIE 2569, Wavelet Applications in Signal and
    Image Processing III, 1995.
    DOI:10.1117/12.217582
zvalue_low must be non-negative.z6value_high must be greater than or equal to value_low.r   r   Nr   )r$   r   r   r   r   r   r   Úany)r   Ú	value_lowÚ
value_highr   Úvdiffr   Ú
large_valss   &&&    r   r   r   ­   sà   € ðp �1„}ÜÐ:Ó;Ð;àÔÜØDóFð 	Fô �:Š:�dÓ€DÜ—’˜DÓ!€IÜ	�Š˜H×	%Ö	%àÕ&ˆØ  A¨	Õ(;Õ$;Õ<¸uÕDˆØ×Ñ˜Q D¨kÐÔ:ØÕ(ˆ÷ 
&ô —’˜)Ñ0Ó1€JÜ	‡v‚vˆj˜�m×ÒØ"&Õ"2ˆ�JÑØÐ÷ 
&×	%ús   Á/ADÄD	)é    )r   r?   )Ú__doc__Únumpyr   Ú__all__r   r   r    r&   r   r2   r   r   r-   r!   r   Ú<module>rC      sh   ðñó
 àÐ(Ð
)€ô7ô"7ô$,ô<ô?ð  Ø Ø! 7Ø Ø! :à! :ðÐ ôY3ôxLr!   