ó
    Eñiw  ã                  óH   • S SK Jr  S SKrS SKJr  SSKJr   " S S5      r\rg)é    )ÚannotationsN)Úcached_propertyé   )ÚImagec                  óâ   • \ rS rSr S     SS jjr\SS j5       r\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
\SS	 j5       r\SS
 j5       r\SS j5       r\SS j5       rSrg)ÚStaté   Nc                ó   • [        U[        R                  5      (       a  UR                  U5      U l        O)[        U[        5      (       a  Xl        OSn[        U5      e[	        [        [        U R                  5      S-  5      5      U l        g)a¢  
Calculate statistics for the given image. If a mask is included,
only the regions covered by that mask are included in the
statistics. You can also pass in a previously calculated histogram.

:param image: A PIL image, or a precalculated histogram.

    .. note::

        For a PIL image, calculations rely on the
        :py:meth:`~PIL.Image.Image.histogram` method. The pixel counts are
        grouped into 256 bins, even if the image has more than 8 bits per
        channel. So ``I`` and ``F`` mode images have a maximum ``mean``,
        ``median`` and ``rms`` of 255, and cannot have an ``extrema`` maximum
        of more than 255.

:param mask: An optional mask.
z$first argument must be image or listé   N)	Ú
isinstancer   Ú	histogramÚhÚlistÚ	TypeErrorÚrangeÚlenÚbands)ÚselfÚimage_or_listÚmaskÚmsgs       ÚJ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/PIL/ImageStat.pyÚ__init__ÚStat.__init__    sf   € ô* �m¤U§[¡[×1Ñ1Ø"×,Ñ,¨TÓ2ˆD�FÜ˜¤t×,Ñ,Ø"�Fà8ˆCÜ˜C“.Ð Üœ%¤ D§F¡F£¨sÑ 2Ó3Ó4ˆ�
ó    c                óœ   • SS jn[        S[        U R                  5      S5       Vs/ s H  o!" U R                  US 5      PM     sn$ s  snf )a%  
Min/max values for each band in the image.

.. note::
    This relies on the :py:meth:`~PIL.Image.Image.histogram` method, and
    simply returns the low and high bins used. This is correct for
    images with 8 bits per channel, but fails for other modes such as
    ``I`` or ``F``. Instead, use :py:meth:`~PIL.Image.Image.getextrema` to
    return per-band extrema for the image. This is more correct and
    efficient because, for non-8-bit modes, the histogram method uses
    :py:meth:`~PIL.Image.Image.getextrema` to determine the bins used.
c                ó”   • Su  p[        S5       H  nX   (       d  M  Un  O   [        SSS5       H  nX   (       d  M  Un  X4$    X4$ )N)éÿ   r   r   r   éÿÿÿÿ)r   )r   Úres_minÚres_maxÚis       r   ÚminmaxÚStat.extrema.<locals>.minmaxM   s_   € Ø%ÑˆGÜ˜3–Z�Ø—<‘<Ø�GÙñ  ô ˜3  BÖ'�Ø—<‘<Ø�GØØÐ#Ð#ñ	 (ð Ð#Ð#r   r   r   N)r   ú	list[int]Úreturnztuple[int, int])r   r   r   )r   r#   r"   s      r   ÚextremaÚStat.extrema>   sC   € ô
	$ô -2°!´S¸¿¹³[À#Ô,FÓGÒ,F q��t—v‘v˜a˜b�zÖ"Ñ,FÑGÐGùÒGs   ¨A	c           	     óž   • [        S[        U R                  5      S5       Vs/ s H  n[        U R                  XS-    5      PM     sn$ s  snf )z2Total number of pixels for each band in the image.r   r   )r   r   r   Úsum©r   r"   s     r   ÚcountÚ
Stat.count[   sA   € ô 38¸¼3¸t¿v¹v»;ÈÔ2LÓMÒ2L¨Q”�D—F‘F˜1 3™wÐ'Ö(Ñ2LÑMÐMùÒMs   £$A
c                óÎ   • / n[        S[        U R                  5      S5       H>  nSn[        S5       H  nX4U R                  X$-      -  -  nM     UR                  U5        M@     U$ )z-Sum of all pixels for each band in the image.r   r   ç        )r   r   r   Úappend)r   Úvr"   Ú	layer_sumÚjs        r   r*   ÚStat.sum`   sa   € ð ˆÜ�qœ#˜dŸf™f›+ sÖ+ˆAØˆIÜ˜3–Z�Ø §¡¨©¡Ñ.Ñ.’	ñ  à�H‰H�YÖñ	 ,ð
 ˆr   c           	     óæ   • / n[        S[        U R                  5      S5       HJ  nSn[        S5       H%  nX4S-  [        U R                  X$-      5      -  -  nM'     UR	                  U5        ML     U$ )z5Squared sum of all pixels for each band in the image.r   r   r/   é   )r   r   r   Úfloatr0   )r   r1   r"   Úsum2r3   s        r   r8   Ú	Stat.sum2l   si   € ð ˆÜ�qœ#˜dŸf™f›+ sÖ+ˆAØˆDÜ˜3–Z�Ø˜A™¤ t§v¡v¨a©e¡}Ó!5Ñ5Ñ5’ñ  à�H‰H�TŽNñ	 ,ð
 ˆr   c                óª   • U R                    Vs/ s H7  oR                  U   (       a  U R                  U   U R                  U   -  OSPM9     sn$ s  snf )zAAverage (arithmetic mean) pixel level for each band in the image.r   )r   r,   r*   r+   s     r   ÚmeanÚ	Stat.meanx   sD   € ð NRÏZÊZÓXÊZÈ¯z©z¸!¯}�—‘˜‘˜dŸj™j¨™mÒ+À!ÒCÉZÑXÐXùÒXs   �>Ac                óÜ   • / nU R                    HY  nSnU R                  U   S-  nUS-  n[        S5       H  nX0R                  XV-      -   nX4:”  d  M    O   UR	                  W5        M[     U$ )z.Median pixel level for each band in the image.r   r6   r   )r   r,   r   r   r0   )r   r1   r"   ÚsÚhalfÚbr3   s          r   ÚmedianÚStat.median}   ss   € ð ˆØ—”ˆAØˆAØ—:‘:˜a‘= AÑ%ˆDØ�C‘ˆAÜ˜3–Z�ØŸ™˜q™u™Ñ%�Ø•8Ùñ  ð �H‰H�QŽKñ ð ˆr   c                óÔ   • U R                    Vs/ s HL  nU R                  U   (       a3  [        R                  " U R                  U   U R                  U   -  5      OSPMN     sn$ s  snf )z2RMS (root-mean-square) for each band in the image.r   )r   r,   ÚmathÚsqrtr8   r+   s     r   ÚrmsÚStat.rms�   sZ   € ð
 —Z’Zó
â�ð 8<·z±zÀ!·}ŒD�IŠI�d—i‘i ‘l T§Z¡Z°¡]Ñ2Ô3È!ÒKÙñ
ð 	
ùò 
s   �AA%c                óò   • U R                    Vs/ s H[  nU R                  U   (       aB  U R                  U   U R                  U   S-  U R                  U   -  -
  U R                  U   -  OSPM]     sn$ s  snf )z$Variance for each band in the image.g       @r   )r   r,   r8   r*   r+   s     r   ÚvarÚStat.var•   s{   € ð —Z’Zó
ò  �ð —:‘:˜a—=ð —‘˜1‘ §¡¨!¡°Ñ!3°t·z±zÀ!±}Ñ DÑDÈÏ
É
ÐSTÉÒUàòñ  ñ
ð 	
ùò 
s   �A"A4c                óˆ   • U R                    Vs/ s H&  n[        R                  " U R                  U   5      PM(     sn$ s  snf )z.Standard deviation for each band in the image.)r   rD   rE   rI   r+   s     r   ÚstddevÚStat.stddev¡   s1   € ð 15·
²
Ó;²
¨1”—	’	˜$Ÿ(™( 1™+Ö&±
Ñ;Ð;ùÒ;s   �-?)r   r   )N)r   zImage.Image | list[int]r   zImage.Image | Noner&   ÚNone)r&   zlist[tuple[int, int]])r&   r%   )r&   zlist[float])Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   r'   r,   r*   r8   r;   rA   rF   rI   rL   Ú__static_attributes__© r   r   r   r      sÜ   † àQUð5Ø4ð5Ø<Nð5à	õ5ð< óHó ðHð8 óNó ðNð ó	ó ð	ð ó	ó ð	ð óYó ðYð óó ðð ó
ó ð
ð ó	
ó ð	
ð ó<ó ó<r   r   )	Ú
__future__r   rD   Ú	functoolsr   Ú r   r   ÚGlobalrT   r   r   Ú<module>rY      s'   ðõ. #ã Ý %å ÷E<ñ E<ðP 
�r   