a
    zn„f�  ã                   @  s*   d Z ddlmZ ddlZG dd„ dƒZdS )z=
This module defines the behaviors of ``TGraphAsymmErrors``.
é    )ÚannotationsNc                   @  s4   e Zd ZdZdd„ Zdd„ Zddd„Zdd	d
„ZdS )ÚTGraphAsymmErrorszQ
    Behaviors for TGraphAsymmErrors: get values and errors as NumPy arrays.
    c                 C  s    |   |¡}tj||j d¡d�S )Nú=)Údtype)ÚmemberÚnumpyZasarrayr   Znewbyteorder)ÚselfÚkeyÚvalues© r   úe/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/uproot/behaviors/TGraphAsymmErrors.pyÚ_normalize_array   s    
z"TGraphAsymmErrors._normalize_arrayc                 C  sd   |dkr|   |¡S |dkr$|   |¡S |dkrD|   |¡|   |¡ d S |dkr`|   |¡|   |¡ S d S )NÚlowÚhighÚmeang       @Údiff)r   )r   ÚwhichZlowkeyZhighkeyr   r   r   Ú_reduce_errors   s    

þz TGraphAsymmErrors._reduce_errorsÚbothc                 C  sL   |dv r|   d¡S |dv r$|   d¡S |dkr@|  d¡|  d¡fS tdƒ‚d	S )
aª  
        Args:
            axis (int or str): If ``0``, ``-2``, or ``"x"``, get the *x* axis.
                If ``1``, ``-1``, or ``"y"``, get the *y* axis. If ``"both"``,
                get ``"x"`` and ``"y"`` axes as a 2-tuple.

        Returns the values of all points in the scatter plot, either as a
        1-dimensional NumPy array (if ``axis`` selects only one) or as a 2-tuple
        (if ``axis="both"``).
        ©r   éþÿÿÿÚxZfX©é   éÿÿÿÿÚyZfYr   r   r   úHaxis must be 0 (-2, 'x'), 1 (-1, 'y'), or 'both' for a TGraphAsymmErrorsN)r   r
   Ú
ValueError)r   Úaxisr   r   r   r
   %   s    

ÿzTGraphAsymmErrors.valuesc                 C  sh   |dvrt dƒ‚|dv r&|  |dd¡S |dv r<|  |dd¡S |d	kr\|  |d
¡|  |d¡fS t dƒ‚dS )a©  
        Args:
            which (str): If ``"low"`` or ``"high"``, get the low-side or
                high-side error. If ``"mean"``, get the average. If ``"diff"``,
                get their difference.
            axis (int or str): If ``0``, ``-2``, or ``"x"``, get the *x* axis.
                If ``1``, ``-1``, or ``"y"``, get the *y* axis. If ``"both"``,
                get ``"x"`` and ``"y"`` axes as a 2-tuple.

        Returns the errors in all points in the scatter plot, either as a
        1-dimensional NumPy array (if ``axis`` selects only one) or as a 2-tuple
        (if ``axis="both"``). The value of ``which`` does not affect the return
        type.
        )r   r   r   r   zFwhich must be 'low', 'high', 'mean', or 'diff' for a TGraphAsymmErrorsr   ZfEXlowZfEXhighr   ZfEYlowZfEYhighr   r   r   r   N)r   r   Úerrors)r   r   r   r   r   r   r   ;   s    ÿÿzTGraphAsymmErrors.errorsN)r   )r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r
   r   r   r   r   r   r      s
   
r   )r#   Ú
__future__r   r   r   r   r   r   r   Ú<module>   s   