
    ge                     D    d dl mZ d dlZd dlZd dlZd Zd ZddZd ZdS )	    )IterableNc                     | dk    rdS | dk    rdS | dv rdS | dk    rdS | d	k    rd
S | dk    rdS | dk    rdS t          d          )zAConvert an extension mode to the corresponding integer code.
    nearestr   wrap   )reflectzgrid-mirror   mirror   constant   z	grid-wrap   zgrid-constant   zboundary mode not supported)RuntimeError)modes    9lib/python3.11/site-packages/scipy/ndimage/_ni_support.py_extend_mode_to_coder   %   s     yq	q	+	+	+q			q			q			q		 	 q8999    c                     t          | t                    }|sIt          | t                    r4t          |           }t	          |          |k    rd}t          |          n| g|z  }|S )zIf input is a scalar, create a sequence of length equal to the
    rank by duplicating the input. If input is a sequence,
    check if its length is equal to the length of array.
    z6sequence argument must have length equal to input rank)
isinstancestrr   listlenr   )inputrankis_str
normalizederrs        r   _normalize_sequencer   :   ss    
 s##F $j11 $%[[
z??d""JCs### # Wt^
r   Fc                 >   ||j         }| `|s"t          j        ||j        j                  } nmt          j        |j        t          j                  }t          j        ||          } n1t          | t          t          j        f          ri|rPt          j        |           j	        dk    r3t          j        d           t          j        | t          j                  } t          j        ||           } nt          | t                    rWt          j        |          } |r,t          j        |           j	        dk    rt          d          t          j        ||           } n;| j         |k    rt          d          |r| j        j	        dk    rt          d          | S )N)dtypecz+promoting specified output dtype to complexzoutput must have complex dtypezoutput shape not correct)shapenumpyzerosr!   namepromote_types	complex64r   typekindwarningswarnr   
sctypeDictr   )outputr   r#   complex_outputcomplex_types        r   _get_outputr1   J   s   }~ 	<[ek.>???FF .u{EOLLL[l;;;FF	FT5;/	0	0 = 	Bek&116#==MGHHH(AAFU&111	FC	 	  =!&) 	Aek&116#==?@@@U&111			5666	 =FL-44;<<<Mr   c                 0   | t          t                              S t          j        |           rt	          j        |           f} nt          | t                    r]| D ]>}t          d | D                       } | k     s	|dz
  k    rt          d| d          ?t          fd| D                       } nd}t          |          t          t          t          |                               t          |           k    rt          d          | S )Nc              3   >   K   | ]}t          j        |          V  d S )N)operatorindex).0axs     r   	<genexpr>z_check_axes.<locals>.<genexpr>l   s,      ;;++;;;;;;r   r   zspecified axis: z is out of rangec              3   2   K   | ]}|d k     r|z  n|V  dS )r   N )r6   r7   ndims     r   r8   z_check_axes.<locals>.<genexpr>o   s3      @@R"q&&R$YYb@@@@@@r   z6axes must be an integer, iterable of integers, or Nonezaxes must be unique)tupleranger$   isscalarr4   r5   r   r   
ValueErrorr   set)axesr;   r7   messages    `  r   _check_axesrC   e   s)   |U4[[!!!			 
"t$$&	D(	#	# " 	J 	JB;;d;;;;;DTEzzR$(]] !HB!H!H!HIII +@@@@4@@@@@J!!!
5TD		)).///Kr   )NF)	collections.abcr   r4   r+   r$   r   r   r1   rC   r:   r   r   <module>rE      s   > % $ $ $ $ $   : : :*      6    r   