
    0-Phs                        d dl Z d dlZd dlZd dlZd dlZddlmZmZ g dZ	d Z
d Zd Z G d d	          Z G d
 de          Z G d de          Z G d de          Z G d d          Zd Z G d d          Z G d de          Zd Zd+dZd Zd Zd Zd,dZd  Zd! Zd" Zd# Zd$ Z  ej!                    j"        j#        ej!         ej$                    j"        j#        ej$         ej%                    j"        j#        ej%         ej&                    j"        j#        ej&         ej'                    j"        j#        ej!        d%ej$        d&ej&        iZ(d-d(Z)d) Z*d* Z+dS ).    N   )all_warningswarn)deprecate_funcget_bound_method_classr   safe_as_intcheck_shape_equalitycheck_nDr   
reshape_ndidentityslice_at_axisdeprecate_parameter
DEPRECATEDc                 f    | }d}t          |d          r|j        }|dz  }t          |d          |S )z+Count the number of wrappers around `func`.r   __wrapped__r   )hasattrr   )func	unwrappedcounts      U/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/skimage/_shared/utils.py_count_wrappersr      sJ    IE
)]
+
+ )	
 )]
+
+  L    c                 r   t          |           }t          j                            | j                  }	 | j                            d          D ]}t          ||          }	 t          |          }n.# t          $ r!}t          d| j         d|d          |d}~ww xY w||z
  dz   }t          |d          S )zFind stacklevel for a warning raised from a wrapper around `func`.

    Try to determine the number of

    Parameters
    ----------
    func : Callable


    Returns
    -------
    stacklevel : int
        The stacklevel. Minimum of 2.
    .zCould not access `z` in z.,  may be a closure. Set stacklevel manually. Nr      )r   sysmodulesget
__module____qualname__splitgetattrAttributeErrorRuntimeErrormax)r   wrapped_countmodulenameglobal_funcglobal_wrapped_counte
stacklevels           r   _warning_stacklevelr-   $   s      $D))M [__T_--F	<%++C00 	0 	0D!&$//KK	0  /{;;    <!2 < < < < <
 
 	 &59Jz1s   -A3 3
B=BBc                 d    | j                             | j        |           }t          |          }|S )z"Return function call stack length.)__globals__r   __name__r   )r   _funclengths      r   _get_stack_lengthr3   G   s.      55EU##FMr   c                       e Zd ZdZi Zd ZdS )_DecoratorBaseClassa  Used to manage decorators' warnings stacklevel.

    The `_stack_length` class variable is used to store the number of
    times a function is wrapped by a decorator.

    Let `stack_length` be the total number of times a decorated
    function is wrapped, and `stack_rank` be the rank of the decorator
    in the decorators stack. The stacklevel of a warning is then
    `stacklevel = 1 + stack_length - stack_rank`.
    c                 `    | j                             |j        t          |                    }|S N)_stack_lengthr   r0   r3   )selfr   r2   s      r   get_stack_lengthz$_DecoratorBaseClass.get_stack_length\   s*    #''7H7N7NOOr   N)r0   r   r    __doc__r8   r:    r   r   r5   r5   N   s4        	 	 M    r   r5   c                   $    e Zd ZdZdddZd ZdS )change_default_valuea  Decorator for changing the default value of an argument.

    Parameters
    ----------
    arg_name: str
        The name of the argument to be updated.
    new_value: any
        The argument new value.
    changed_version : str
        The package version in which the change will be introduced.
    warning_msg: str
        Optional warning message. If None, a generic warning message
        is used.

    N)warning_msgc                >    || _         || _        || _        || _        d S r7   )arg_name	new_valuer?   changed_version)r9   rA   rB   rC   r?   s        r   __init__zchange_default_value.__init__r   s&     "&.r   c                     t          j                  j        }t          |                                                               j                  | j                 j        }t                     j	        Kd j         d j
         d j         d j         d| d j         d j         d j
         d	 j         d
 _	        t          j                   fd            }|S )NzThe new recommended value for z is z. Until version z, the default z
 value is z. From version z, the z default value will be z/. To avoid this warning, please explicitly set z value.c                      d                               z   z
  }t          |           dz   k     r<j        |                                vr!t	          j        j        t          |            | i |S )Nr   )r,   )r:   lenrA   keyswarningsr   r?   FutureWarning)argskwargsr,   arg_idxr   r9   
stack_ranks      r   
fixed_funcz1change_default_value.__call__.<locals>.fixed_func   sx    T224888:EJ4yy7Q;&&4=+M+Md.*UUUU4((((r   )inspect	signature
parameterslistrH   indexrA   defaultr   r?   rB   rC   	functoolswraps)r9   r   rR   	old_valuerO   rM   rN   s   ``   @@r   __call__zchange_default_value.__call__x   sa   &t,,7
z(())//>>t}-5	$T**
#N N N>N N373GN N#}N N8AN N !% 4N N =AMN N *.	N N
 8<}N N N  
			) 	) 	) 	) 	) 	) 	) 
		) r   r0   r   r    r;   rD   rY   r<   r   r   r>   r>   a   sM           MQ / / / / /    r   r>   c                       e Zd ZdZd ZdS )PatchClassReprz5Control class representations in rendered signatures.c                     d| j          dS )N<>)r0   )clss    r   __repr__zPatchClassRepr.__repr__   s    "3<""""r   N)r0   r   r    r;   ra   r<   r   r   r\   r\      s)        ??# # # # #r   r\   c                       e Zd ZdZdS )r   a  Signal value to help with deprecating parameters that use None.

    This is a proxy object, used to signal that a parameter has not been set.
    This is useful if ``None`` is already used for a different purpose or just
    to highlight a deprecated parameter in the signature.
    N)r0   r   r    r;   r<   r   r   r   r      s           r   r   )	metaclassc                   6    e Zd ZdZeZdZdZddddddZd ZdS )	r   a  Deprecate a parameter of a function.

    Parameters
    ----------
    deprecated_name : str
        The name of the deprecated parameter.
    start_version : str
        The package version in which the warning was introduced.
    stop_version : str
        The package version in which the warning will be replaced by
        an error / the deprecation is completed.
    template : str, optional
        If given, this message template is used instead of the default one.
    new_name : str, optional
        If given, the default message will recommend the new parameter name and an
        error will be raised if the user uses both old and new names for the
        same parameter.
    modify_docstring : bool, optional
        If the wrapped function has a docstring, add the deprecated parameters
        to the "Other Parameters" section.
    stacklevel : int, optional
        This decorator attempts to detect the appropriate stacklevel for the
        deprecation warning automatically. If this fails, e.g., due to
        decorating a closure, you can set the stacklevel manually. The
        outermost decorator should have stacklevel 2, the next inner one
        stacklevel 3, etc.

    Notes
    -----
    Assign `DEPRECATED` as the new default value for the deprecated parameter.
    This marks the status of the parameter also in the signature and rendered
    HTML docs.

    This decorator can be stacked to deprecate more than one parameter.

    Examples
    --------
    >>> from skimage._shared.utils import deprecate_parameter, DEPRECATED
    >>> @deprecate_parameter(
    ...     "b", new_name="c", start_version="0.1", stop_version="0.3"
    ... )
    ... def foo(a, b=DEPRECATED, *, c=None):
    ...     return a, c

    Calling ``foo(1, b=2)``  will warn with::

        FutureWarning: Parameter `b` is deprecated since version 0.1 and will
        be removed in 0.3 (or later). To avoid this warning, please use the
        parameter `c` instead. For more details, see the documentation of
        `foo`.
    a	  Parameter `{deprecated_name}` is deprecated since version {deprecated_version} and will be removed in {changed_version} (or later). To avoid this warning, please do not use the parameter `{deprecated_name}`. For more details, see the documentation of `{func_name}`.a  Parameter `{deprecated_name}` is deprecated since version {deprecated_version} and will be removed in {changed_version} (or later). To avoid this warning, please use the parameter `{new_name}` instead. For more details, see the documentation of `{func_name}`.NT)templatenew_namemodify_docstringr,   c                h    || _         || _        || _        || _        || _        || _        || _        d S r7   )deprecated_namerf   re   start_versionstop_versionrg   r,   )r9   ri   rj   rk   re   rf   rg   r,   s           r   rD   zdeprecate_parameter.__init__   s=      /  *( 0$r   c                     t          j                  j        }t          |                                                               j                   j        r:t          |                                                               j                  nd| j                 j        t          ur t          d j         dt          d           j         j        }n j         j        }n j        }|                     j         j         j        j         j                  t%          j                   fd            } j        r0j        )t-           j         j        i j                  }||_        |S )NFz
Expected `z` to have the value z2 to indicate its status in the rendered signature.)ri   deprecated_versionrC   	func_namerf   c                     t           }t           }t          |           k    r0|          }j        !| d          t           fz   | dz   d          z   } j        |                                v r#|j                 }j        t           |j        <   durt          |           k    r|          }j        r(j        |                                v r|j                 }|t           ursj        j        nt                    }t          j        	t          |           |t           ur t          dj         dj         d          j        
||j        <    | i |S )Nr   Fcategoryr,   zBoth deprecated parameter `z` and new parameter `z<` are used. Use only the latter to avoid conflicting values.)r   rG   rf   ri   rH   r,   r-   rI   r   rJ   
ValueError)
rK   rL   deprecated_valuerB   r,   deprecated_idxr   new_idxr9   warning_messages
        r   rO   z0deprecate_parameter.__call__.<locals>.fixed_func  s   )"I 4yy>))#'#7 =,_n_-%-(~13345 
 #v{{}}44#)$*>#? =,3=F4/0 e##D		G(;(; M	} 2&++--!?!?"4=1	z11 2 OO,T22 
 #m
    J..$Hd6J H H.2mH H H  
 ].,<F4=)4((((r   )rP   rQ   rR   rS   rH   rT   ri   rf   rU   r   r$   re   replace_parameter_templateremove_parameter_templateformatrj   rk   r    rV   rW   rg   r;   _docstring_add_deprecated)	r9   r   rR   re   rO   newdocrt   ru   rv   s	   ``    @@@r   rY   zdeprecate_parameter.__call__   s   &t,,7
joo//0066t7KLL= 	:??,,--33DMBBGGGd*+3:EEET1 E Ez E E E  
 =$}HH]&6HH5H"// 0#1 -'] * 
 
 
		.	) .	) .	) .	) .	) .	) .	) .	) 
	.	)`   	(T\%=.t+T];T=O F "(Jr   )	r0   r   r    r;   r   rx   rw   rD   rY   r<   r   r   r   r      sv        2 2h J	 	M  % % % % %&S S S S Sr   r   c                    | j         dS 	 ddlm}m} n# t          $ r
 | j         cY S w xY w ||           }|                                D ]m\  }}g }||                    d| d           n|                    d| d           |dd	| gz  }|d
                              ||d|                     nt          |          }	|	                    d          }
|
dd         }|d         	                                s/|
                    d           |d         	                                /|
                    d          }|d         	                                r5|d|
                    d          z   z  }|d         	                                5|dz  }|d                    |          z   }d                    d |                    d          D                       }|S )a0  Add deprecated kwarg(s) to the "Other Params" section of a docstring.

    Parameters
    ----------
    func : function
        The function whose docstring we wish to update.
    kwarg_mapping : dict
        A dict containing {old_arg: new_arg} key/value pairs, see
        `deprecate_parameter`.
    deprecated_version : str
        A major.minor version string specifying when old_arg was
        deprecated.

    Returns
    -------
    new_doc : str
        The updated docstring. Returns the original docstring if numpydoc is
        not available.
    Nr   )FunctionDoc	Parameter`z` is deprecated.zDeprecated in favor of `z`. z.. deprecated:: zOther Parametersr   )r(   typedesc
r   z
    z

c                 6    g | ]}|                                 S r<   )rstrip).0lines     r   
<listcomp>z-_docstring_add_deprecated.<locals>.<listcomp>  s      W W W4 W W Wr   )r;   numpydoc.docscraper}   r~   ImportErroritemsappendstrr!   strippopjoin)r   kwarg_mappingrm   r}   r~   Docold_argnew_argr   new_docstringr!   	no_headerdescrfinal_docstrings                 r   rz   rz   S  sK   ( |t=========   | +d

C)//11 

 

?KK5G5556666KK>7>>>???<(:<<==&&I7DAAA	
 	
 	
 	
 HHM %%Eabb	Il  "" a l  ""  MM!E
A,



 -IMM!,,,, A,



 -	VOEhmmI666Oii W W?;P;PQU;V;V W W WXXOs    ((c                   &    e Zd ZdZ	 	 	 ddZd ZdS )	channel_as_last_axisa%  Decorator for automatically making channels axis last for all arrays.

    This decorator reorders axes for compatibility with functions that only
    support channels along the last axis. After the function call is complete
    the channels axis is restored back to its original position.

    Parameters
    ----------
    channel_arg_positions : tuple of int, optional
        Positional arguments at the positions specified in this tuple are
        assumed to be multichannel arrays. The default is to assume only the
        first argument to the function is a multichannel array.
    channel_kwarg_names : tuple of str, optional
        A tuple containing the names of any keyword arguments corresponding to
        multichannel arrays.
    multichannel_output : bool, optional
        A boolean that should be True if the output of the function is not a
        multichannel array and False otherwise. This decorator does not
        currently support the general case of functions with multiple outputs
        where some or all are multichannel.

    r   r<   Tc                 d    t          |          | _        t          |          | _        || _        d S r7   )setarg_positionskwarg_namesmultichannel_output)r9   channel_arg_positionschannel_kwarg_namesr   s       r   rD   zchannel_as_last_axis.__init__  s4     !!677233#6   r   c                 J     t          j                   fd            }|S )Nc                     |                     dd           }| | i |S t          j        |          r|f}t          |          dk    rt	          d          |dk    s|dk    r | i |S 	j        rug }t          |           D ]S\  }}|	j        v r0|                    t          j        ||d         d                     >|                    |           Tt          |          }n| }	j
        D ]'}t          j        ||         |d         d          ||<   (d|d<    |i |}	j        rt          j        |d|d                   }|S )Nchannel_axisr   z1only a single channel axis is currently supported)r   r   )r   npisscalarrG   rr   r   	enumerater   moveaxistupler   r   )
rK   rL   r   new_argsposargr(   outr   r9   s
           r   rO   z1channel_as_last_axis.__call__.<locals>.fixed_func  s   !::nd;;L#tT,V,,,
 {<(( / ,<  1$$ !TUUUu$$(:(:tT,V,,,! 	  )$ - -HCd000 Ca"(M(MNNNN ,,,, ??( N N!{6$<a"MMt &(F>" $+F++C' <k#r<?;;Jr   )rV   rW   )r9   r   rO   s   `` r   rY   zchannel_as_last_axis.__call__  s@    			'	 '	 '	 '	 '	 
	'	R r   N)r   r<   TrZ   r<   r   r   r   r     sL         2 # 	7 7 7 7+ + + + +r   r   c                   &    e Zd ZdZddddZd ZdS )r   av  Decorate a deprecated function and warn when it is called.

    Adapted from <http://wiki.python.org/moin/PythonDecoratorLibrary>.

    Parameters
    ----------
    deprecated_version : str
        The package version when the deprecation was introduced.
    removed_version : str
        The package version in which the deprecated function will be removed.
    hint : str, optional
        A hint on how to address this deprecation,
        e.g., "Use `skimage.submodule.alternative_func` instead."

    Examples
    --------
    >>> @deprecate_func(
    ...     deprecated_version="1.0.0",
    ...     removed_version="1.2.0",
    ...     hint="Use `bar` instead."
    ... )
    ... def foo():
    ...     pass

    Calling ``foo`` will warn with::

        FutureWarning: `foo` is deprecated since version 1.0.0
        and will be removed in version 1.2.0. Use `bar` instead.
    N)removed_versionhintc                0    || _         || _        || _        d S r7   )rm   r   r   )r9   rm   r   r   s       r   rD   zdeprecate_func.__init__  s    "4.			r   c                 Z    dj          d j          j        rd j         dz   j        r!d j                            d           dz  t                    t          j                   fd            }d }|j        ||_        n|dz   |j        z   |_        |S )	Nr   z` is deprecated since version z  and will be removed in version r    c                      d                               z   z
  }t          j        t          |            | i |S )Nr   rp   )r:   rI   r   rJ   )rK   rL   r,   r   messager9   rN   s      r   wrappedz(deprecate_func.__call__.<locals>.wrapped  sL    T224888:EJM'MjQQQQ4((((r   z**Deprecated:** z

    )	r0   rm   r   r   r   r   rV   rW   r;   )r9   r   r   docr   rN   s   ``  @@r   rY   zdeprecate_func.__call__	  s   ) ) )&) ) 	  	RQ$:NQQQQG9 	4349++C003333G$T**
				) 	) 	) 	) 	) 	) 	) 
		) +**?"!GOO!J.@GOr   rZ   r<   r   r   r   r     sN         < ?C     
    r   r   c                 H    t           j        dk     r| j        n| j        j        S )z$Return the class for a bound method.3)r   versionim_class__self__	__class__)ms    r   r   r   &  s    s**1::
0DDr   MbP?c                 v   t          j        |           dz  }|j        dk    r|dk    rd|z
  }nd||dk             z
  ||dk    <   	 t           j                            |d|           n!# t
          $ r t          d|  d          w xY wt          j        |                               t           j	                  S )a  
    Attempt to safely cast values to integer format.

    Parameters
    ----------
    val : scalar or iterable of scalars
        Number or container of numbers which are intended to be interpreted as
        integers, e.g., for indexing purposes, but which may not carry integer
        type.
    atol : float
        Absolute tolerance away from nearest integer to consider values in
        ``val`` functionally integers.

    Returns
    -------
    val_int : NumPy scalar or ndarray of dtype `np.int64`
        Returns the input value(s) coerced to dtype `np.int64` assuming all
        were within ``atol`` of the nearest integer.

    Notes
    -----
    This operation calculates ``val`` modulo 1, which returns the mantissa of
    all values. Then all mantissas greater than 0.5 are subtracted from one.
    Finally, the absolute tolerance from zero is calculated. If it is less
    than ``atol`` for all value(s) in ``val``, they are rounded and returned
    in an integer array. Or, if ``val`` was a scalar, a NumPy scalar type is
    returned.

    If any value(s) are outside the specified tolerance, an informative error
    is raised.

    Examples
    --------
    >>> safe_as_int(7.0)
    7

    >>> safe_as_int([9, 4, 2.9999999999])
    array([9, 4, 3])

    >>> safe_as_int(53.1)
    Traceback (most recent call last):
        ...
    ValueError: Integer argument required but received 53.1, check inputs.

    >>> safe_as_int(53.01, atol=0.01)
    53

    r   r   g      ?)atolz'Integer argument required but received z, check inputs.)
r   asarrayndimtestingassert_allcloseAssertionErrorrr   roundastypeint64)valr   mods      r   r   r   +  s    b *S//A
C x1}}99c'CSs^+C#I


""3"5555 
 
 
N#NNN
 
 	


 8C==)))s   "A) )Bc                  |    | d         t          fd| dd         D                       st          d          dS )z)Check that all images have the same shaper   c              3   8   K   | ]}j         |j         k    V  d S r7   )shape)r   imageimage0s     r   	<genexpr>z'check_shape_equality.<locals>.<genexpr>r  s,      CCuv|u{*CCCCCCr   r   Nz+Input images must have the same dimensions.)allrr   )imagesr   s    @r   r	   r	   o  sN    AYFCCCCqrr
CCCCC HFGGG
Fr   c                 6    t          d          f|z  | fz   dz   S )a   
    Construct tuple of slices to slice an array in the given dimension.

    Parameters
    ----------
    sl : slice
        The slice for the given dimension.
    axis : int
        The axis to which `sl` is applied. All other dimensions are left
        "unsliced".

    Returns
    -------
    sl : tuple of slices
        A tuple with slices matching `shape` in length.

    Examples
    --------
    >>> slice_at_axis(slice(None, 3, -1), 1)
    (slice(None, None, None), slice(None, 3, -1), Ellipsis)
    N).)slice)slaxiss     r   r   r   w  s#    , $KK>D B5(611r   c                 v    | j         dk    rt          d          dg|z  }d||<   t          j        | |          S )a  Reshape a 1D array to have n dimensions, all singletons but one.

    Parameters
    ----------
    arr : array, shape (N,)
        Input array
    ndim : int
        Number of desired dimensions of reshaped array.
    dim : int
        Which dimension/axis will not be singleton-sized.

    Returns
    -------
    arr_reshaped : array, shape ([1, ...], N, [1,...])
        View of `arr` reshaped to the desired shape.

    Examples
    --------
    >>> rng = np.random.default_rng()
    >>> arr = rng.random(7)
    >>> reshape_nd(arr, 2, 0).shape
    (7, 1)
    >>> reshape_nd(arr, 3, 1).shape
    (1, 7, 1)
    >>> reshape_nd(arr, 4, -1).shape
    (1, 1, 1, 7)
    r   zarr must be a 1D arrayr   )r   rr   r   reshape)arrr   dim	new_shapes       r   r   r     sD    8 x1}}1222d
IIcN:c9%%%r   r   c                    t          j        |           } d}d}t          |t                    r|g}| j        dk    rt          ||z            | j        |vr1t          ||d                    d |D                       fz            dS )aJ  
    Verify an array meets the desired ndims and array isn't empty.

    Parameters
    ----------
    array : array-like
        Input array to be validated
    ndim : int or iterable of ints
        Allowable ndim or ndims for the array.
    arg_name : str, optional
        The name of the array in the original function.

    z1The parameter `%s` must be a %s-dimensional arrayz+The parameter `%s` cannot be an empty arrayr   z-or-c                 ,    g | ]}t          |          S r<   )r   )r   ns     r   r   zcheck_nD.<locals>.<listcomp>  s    7M7M7M1A7M7M7Mr   N)r   
asanyarray
isinstanceintsizerr   r   r   )arrayr   rA   msg_incorrect_dimmsg_empty_arrays        r   r
   r
     s     M%  EKCO$ vzQH5666z6;;7M7M7M7M7M+N+N OO
 
 	
 r   c                     | j         t          j        k    r|                     t          j                  S |r)| j         j        dvr|                     t                    } nddlm}  ||           } | S )a  Convert input image to float image with the appropriate range.

    Parameters
    ----------
    image : ndarray
        Input image.
    preserve_range : bool
        Determines if the range of the image should be kept or transformed
        using img_as_float. Also see
        https://scikit-image.org/docs/dev/user_guide/data_types.html

    Notes
    -----
    * Input images with `float32` data type are not upcast.

    Returns
    -------
    image : ndarray
        Transformed version of the input.

    dfr   )img_as_float)	dtyper   float16r   float32charfloat
util.dtyper   )r   preserve_ranger   s      r   convert_to_floatr     sy    , {bj  ||BJ''' $ ;4''LL''E------U##Lr   c                     || t           k    rdndS |dk     s|dk    rt          d          | t           k    r|dk    rt          d          |S )a3  Validate and return spline interpolation's order.

    Parameters
    ----------
    image_dtype : dtype
        Image dtype.
    order : int, optional
        The order of the spline interpolation. The order has to be in
        the range 0-5. See `skimage.transform.warp` for detail.

    Returns
    -------
    order : int
        if input order is None, returns 0 if image_dtype is bool and 1
        otherwise. Otherwise, image_dtype is checked and input order
        is validated accordingly (order > 0 is not supported for bool
        image dtype)

    Nr   r      z6Spline interpolation order has to be in the range 0-5.zInput image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitly cast input image to another data type.)boolrr   )image_dtypeorders     r   _validate_interpolation_orderr     sn    * }4''qqQ.qyyEAIITUUUduzz5
 
 	
 Lr   c                 B    t          ddd          }| |v r||          } | S )z7Convert padding modes from `ndi.correlate` to `np.pad`.edge	symmetricreflect)nearestr   mirror)dictmodemode_translation_dicts     r   _to_np_moder    s2     YWWW$$$$T*Kr   c                     t          ddddd          }| |vrt          d|  d          t          ||                    S )	zEConvert from `numpy.pad` mode name to the corresponding ndimage mode.constantr   r   r   wrap)r  r   r   r   r  zUnknown mode: 'z', or cannot translate mode. The mode should be one of 'constant', 'edge', 'symmetric', 'reflect', or 'wrap'. See the documentation of numpy.pad for more info.)r   rr   _fix_ndimage_moder  s     r   _to_ndimage_moder	    sr        (((d   
 
 	
 248999r   c                 8    ddd}|                     | |           S )Nzgrid-constantz	grid-wrap)r  r  )r   )r  
grid_modess     r   r  r  2  s%     .{CCJ>>$%%%r   gGFc                    t          | t                    rt          j        d | D              S t          j        |           } |s| j        dk    rt          d          t                              | j	        t          j
                  S )a  Return an appropriate floating-point dtype for a given dtype.

    float32, float64, complex64, complex128 are preserved.
    float16 is promoted to float32.
    complex256 is demoted to complex128.
    Other types are cast to float64.

    Parameters
    ----------
    input_dtype : np.dtype or tuple of np.dtype
        The input dtype. If a tuple of multiple dtypes is provided, each
        dtype is first converted to a supported floating point type and the
        final dtype is then determined by applying `np.result_type` on the
        sequence of supported floating point types.
    allow_complex : bool, optional
        If False, raise a ValueError on complex-valued inputs.

    Returns
    -------
    float_type : dtype
        Floating-point dtype for the image.
    c              3   4   K   | ]}t          |          V  d S r7   )_supported_float_type)r   ds     r   r   z(_supported_float_type.<locals>.<genexpr>^  s+      NNQ 5a 8 8NNNNNNr   cz%complex valued input is not supported)r   r   r   result_typer   kindrr   new_float_typer   r   float64)input_dtypeallow_complexs     r   r  r  F  s    . +u%% P~NN+NNNOO(;''K B[-44@AAAk.
;;;r   c                     | S )z&Returns the first argument unmodified.r<   )r   rK   rL   s      r   r   r   e  s    Lr   c                    t          j        |           } | j        t          k    r1t          j        | dk    | dk    z            rt          | d          t          j        | t                    S )zReturn `array` as a numpy.ndarray of dtype bool.

    Raises
    ------
    ValueError:
        An error including the given `variable_name` if `array` can not be
        safely cast to a boolean array.
    r   r   zo array is not of dtype boolean or contains values other than 0 and 1 so cannot be safely cast to boolean array.)r   )r   r   r   r   anyrr   )r   variable_names     r   as_binary_ndarrayr  j  sz     JuE{d65A:%1*-.. 	  1 1 1  
 :e4((((r   )r   )r   )F),rV   rP   r   rI   numpyr   	_warningsr   r   __all__r   r-   r3   r5   r>   r   r\   r   r   rz   r   r   r   r   r	   r   r   r
   r   r   r  r	  r  r   r   r   r  	complex64
complex128r   r  r  r   r  r<   r   r   <module>r#     sP        



      ) ) ) ) ) ) ) )          F         &0 0 0 0 0. 0 0 0f# # # # #T # # #    >    l l l l l l l l^? ? ?DM M M M M M M M`> > > > >( > > >BE E E
A* A* A* A*H  2 2 22 &  &  &F
 
 
 
6! ! !H" " "J  : : :&& & & BJLLRZBJLLRZBLNNr|BMOOBJLLRZ
< < < <>  
) ) ) ) )r   