U
    b*                     @   s  d Z ddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ dd	lmZ dd
lmZmZ ejjZejjZejjZejjZejjZejjZe ej!e ej"e ej#e ej$iZ%e ej&e ej$kre%'e ej(e ej&i dddedfddZ)dddedfddZ*ddddedfddZ+ddddedfddZ,d3ddddZ-d4ddddZ.d5ddZ/dd Z0dd Z1ddd d!d"Z2d6dd#d$d%Z3d7ddd&d'Z4d8ddd(d)Z5d9ddd*d+Z6d:d,d-Z7d;d/d0Z8d<d1d2Z9dS )=zx
Array methods which are called by both the C-code for the method
and the Python code for the NumPy-namespace function

    N)nullcontext)
multiarray)umath)
asanyarray)numerictypes)_exceptions)_NoValue)pickle	os_fspathFTc                 C   s   t | |d ||||S N)umr_maximumaaxisoutkeepdimsinitialwhere r   S/home/fireinfo/NEWAFireInfo/venv/lib/python3.8/site-packages/numpy/core/_methods.py_amax&   s    r   c                 C   s   t | |d ||||S r   )umr_minimumr   r   r   r   _amin*   s    r   c                 C   s   t | ||||||S r   )umr_sumr   r   dtyper   r   r   r   r   r   r   _sum.   s    r   c                 C   s   t | ||||||S r   )umr_prodr   r   r   r   _prod2   s    r   r   c                C   s,   |dkrt | ||||S t | |||||dS NTr   )umr_anyr   r   r   r   r   r   r   r   r   _any6   s    r#   c                C   s,   |dkrt | ||||S t | |||||dS r    )umr_allr"   r   r   r   _all<   s    r%   c                 C   s   |dkrb|d kr t t| j}nt|t s0|f}d}|D ]}|| jt|| j 9 }q8t|}n&ddl	m
} t||| j|tjd |}|S )NT   r   )broadcast_to)tuplerangendim
isinstanceshapemuZnormalize_axis_indexntZintpZnumpy.lib.stride_tricksr'   r   )arrr   r   r   itemsZaxr'   r   r   r   _count_reduce_itemsB   s    
r1   c                 C   sD   ddl m} || dkrdS zt| W S  tk
r>   Y dS X d S )Nr   )r*   F)Znumpy.core.fromnumericr*   umisnan	TypeError)r   r*   r   r   r   _clip_dep_is_scalar_nan\   s    r5   c                 C   s   t | tjr| jj S dS )NF)r+   r-   ndarrayr   Zisnative)r   r   r   r   _clip_dep_is_byte_swappedf   s    
r7   r   castingc             
   O   s   |d k	r| |||d|S z| |d|i|W S  t jk
r } z8tjd|j|jtdd | ||dd| W Y S d }~X Y nX d S )Nr8   r   zConverting the output of clip from {!r} to {!r} is deprecated. Pass `casting="unsafe"` explicitly to silence this warning, or correct the type of the variables.   
stacklevelunsafe)r   Z_UFuncOutputCastingErrorwarningswarnformatfrom_toDeprecationWarning)Zufuncr   r9   argskwargser   r   r   _clip_dep_invoke_with_castingk   s     rG   )r9   c                K   s   |d kr|d krt dt| sjt|sjd}t|rBtd }d}t|rVtd}d}|rjtjdtdd |d krttj	| |f||d|S |d krttj
| |f||d|S ttj| ||f||d|S d S )	NzOne of max or min must be givenFinfTa  Passing `np.nan` to mean no clipping in np.clip has always been unreliable, and is now deprecated. In future, this will always return nan, like it already does when min or max are arrays that contain nan. To skip a bound, pass either None or an np.inf of an appropriate sign.r:   r;   r8   )
ValueErrorr7   r5   floatr>   r?   rC   rG   r2   minimummaximumZclip)r   minmaxr   r9   rE   Zusing_deprecated_nanr   r   r   _clip~   sb    
          rO   c          
      C   s&  t | }d}t||||d}|dkr.|dkrNnt|dkd drNtjdtdd |d krt|jjt	j
t	jfrxtd	}nt|jjt	jrtd
}d}t||||||d}	t|	tjrtj|	||	ddd}	|r|d kr|j|	}	n>t|	dr|r|j|	| }	n|	j|	| }	n|	| }	|	S )NFr   r   Tr   r   zMean of empty slice.r:   r;   f8Zf4r   r=   r   r9   Zsubokr   )r   r1   r!   r>   r?   RuntimeWarning
issubclassr   typer.   integerbool_r-   Zfloat16r   r+   r6   r2   true_dividehasattr)
r   r   r   r   r   r   r/   Zis_float16_resultrcountretr   r   r   _mean   s8    "
    r]   c                C   s  t | }t||||d}|dkr*||krJnt||kd drJtjdtdd |d krrt|jjt	j
t	jfrrtd}t|||d|d}	|jdkr|}
n||	j}
t|	tjrtj|	|
|	d	d
d}	n$t|	dr|	j|	| }	n|	| }	t ||	 }t|jjt	jt	j
frtj|||d}nh|jtkrl|jt|j dfd}tj|||d tj|d |d |jdj}ntj|t||dj}t||||||d}t|| d}t|tjrtj|||d	d
d}n&t|dr|j|| }n|| }|S )NrP   TrQ   z!Degrees of freedom <= 0 for slicer:   r;   rR   r   r=   FrS   r   r   )r:   )r   ).r   ).r&   )r   r1   r!   r>   r?   rT   rU   r   rV   r.   rW   rX   r-   r   r*   Zreshaper,   r+   r6   r2   rY   rZ   Zfloatingmultiply_complex_to_floatviewaddreal	conjugaterL   )r   r   r   r   ddofr   r   r/   r[   ZarrmeandivxZxvr\   r   r   r   _var   sR    "


    rh   c             	   C   s^   t | ||||||d}t|tjr2tj||d}n(t|drP|jt|}n
t|}|S )N)r   r   r   re   r   r   r^   r   )	rh   r+   r-   r6   r2   sqrtrZ   r   rV   )r   r   r   r   re   r   r   r\   r   r   r   _std  s     

rj   c              	   C   s&   t t| |d ||t| |d d ||S r   )r2   subtractr   r   )r   r   r   r   r   r   r   _ptp  s
    rl   r:   c              	   C   sF   t |drt|}ntt|d}|}tj| ||d W 5 Q R X d S )Nwritewbprotocol)rZ   r   openr
   r	   dump)selffilerp   ctxfr   r   r   _dump  s
    

rw   c                 C   s   t j| |dS )Nro   )r	   dumps)rs   rp   r   r   r   _dumps$  s    ry   )NNNF)NNNF)FT)NNN)NNNF)NNNr   F)NNNr   F)NNF)r:   )r:   ):__doc__r>   
contextlibr   Z
numpy.corer   r-   r   r2   Znumpy.core.multiarrayr   r   r.   r   Znumpy._globalsr   Znumpy.compatr	   r
   rL   reducer   rK   r   rb   r   r_   r   
logical_orr!   logical_andr$   r   ZcsingleZsingleZcdoubledoubler`   Z
longdoubleupdateZclongdoubler   r   r   r   r#   r%   r1   r5   r7   rG   rO   r]   rh   rj   rl   rw   ry   r   r   r   r   <module>   st   
 

 

 
 
 
 
 


%!C

