a
    |=ic%                     @   s   d dl ZddlmZmZmZmZmZmZm	Z	m
Z
mZ ddlmZ ddlmZ ddlmZmZmZ g dZeeeee	dZd	d
 Zddddddddde
jd d
ddZdS )    N   )	ContourGeneratorFillTypeLineTypeMpl2005ContourGeneratorMpl2014ContourGeneratorSerialContourGeneratorThreadedContourGeneratorZInterpmax_threads)__version__)calc_chunk_sizes)as_fill_typeas_line_typeas_z_interp)r   contour_generatorr   r   r   r   r   r   r   r	   r
   )mpl2005mpl2014serialZthreadedc                 C   sT   t jj| t jd} t jj| dd} t j| r<t j| }nd }t j| } | |fS )NZdtypeF)copy)npmaasarrayfloat64Zmasked_invalidZ	is_maskedZgetmaskZgetdata)zmask r   c/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/contourpy/__init__.py_remove_z_mask#   s    r   r   F)
namecorner_mask	line_type	fill_type
chunk_sizechunk_counttotal_chunk_countquad_as_triz_interpthread_countc       
         C   s  t j| t jd} t j|t jd}t|\}}|jdkrHtd|j d|jd dk sd|jd dk rttd|j |j\}}| j|jkrtd| j d	|j d
| jdkrt j|t jd} t j|t jd}t | |\} }n| jdkrNt	| |krtdt	|  d| dt	||kr<tdt	| d| dt | |\} }np| jdkr| j|jkrtd| j d|j d|j|jkrtd|j d|j dntd| j d|dur|j|jkrt
d|tvrt
d| t|||	||\}}t| }|du r&| }n|rD| sDt
| d|du rV|j}nt|}||s|t
| d| |du r|j}nt|}||st
| d| |
r| st
| d|du rtj}nt|}|tjkr| st
| d| |dvr:| s:t
| d| | |||g}||d}|d vrj||d!< ||d"< | r|||d#< | r|
|d$< | r||d%< | r||d&< ||i |}|S )'a  Create and return a contour generator object.

    The class and properties of the contour generator are determined by the function arguments,
    with sensible defaults.

    Args:
        x (array-like of shape (ny, nx) or (nx,), optional): The x-coordinates of the ``z`` values.
            May be 2D with the same shape as ``z.shape``, or 1D with length ``nx = z.shape[1]``.
            If not specified are assumed to be ``np.arange(nx)``. Must be ordered monotonically.
        y (array-like of shape (ny, nx) or (ny,), optional): The y-coordinates of the ``z`` values.
            May be 2D with the same shape as ``z.shape``, or 1D with length ``ny = z.shape[0]``.
            If not specified are assumed to be ``np.arange(ny)``. Must be ordered monotonically.
        z (array-like of shape (ny, nx), may be a masked array): The 2D gridded values to calculate
            the contours of.  May be a masked array, and any invalid values (``np.inf`` or
            ``np.nan``) will also be masked out.
        name (str): Algorithm name, one of ``"serial"``, ``"threaded"``, ``"mpl2005"`` or
            ``"mpl2014"``, default ``"serial"``.
        corner_mask (bool, optional): Enable/disable corner masking, which only has an effect if
            ``z`` is a masked array. If ``False``, any quad touching a masked point is masked out.
            If ``True``, only the triangular corners of quads nearest these points are always masked
            out, other triangular corners comprising three unmasked points are contoured as usual.
            If not specified, uses the default provided by the algorithm ``name``.
        line_type (LineType, optional): The format of contour line data returned from calls to
            :meth:`~contourpy.ContourGenerator.lines`. If not specified, uses the default provided
            by the algorithm ``name``.
        fill_type (FillType, optional): The format of filled contour data returned from calls to
            :meth:`~contourpy.ContourGenerator.filled`. If not specified, uses the default provided
            by the algorithm ``name``.
        chunk_size (int or tuple(int, int), optional): Chunk size in (y, x) directions, or the same
            size in both directions if only one value is specified.
        chunk_count (int or tuple(int, int), optional): Chunk count in (y, x) directions, or the
            same count in both directions if only one value is specified.
        total_chunk_count (int, optional): Total number of chunks.
        quad_as_tri (bool): Enable/disable treating quads as 4 triangles, default ``False``.
            If ``False``, a contour line within a quad is a straight line between points on two of
            its edges. If ``True``, each full quad is divided into 4 triangles using a virtual point
            at the centre (mean x, y of the corner points) and a contour line is piecewise linear
            within those triangles. Corner-masked triangles are not affected by this setting, only
            full unmasked quads.
        z_interp (ZInterp): How to interpolate ``z`` values when determining where contour lines
            intersect the edges of quads and the ``z`` values of the central points of quads,
            default ``ZInterp.Linear``.
        thread_count (int): Number of threads to use for contour calculation, default 0. Threads can
            only be used with an algorithm ``name`` that supports threads (currently only
            ``name="threaded"``) and there must be at least the same number of chunks as threads.
            If ``thread_count=0`` and ``name="threaded"`` then it uses the maximum number of threads
            as determined by the C++11 call ``std::thread::hardware_concurrency()``.

    Return:
        :class:`~contourpy._contourpy.ContourGenerator`.

    Note:
        A maximum of one of ``chunk_size``, ``chunk_count`` and ``total_chunk_count`` may be
        specified.

    Warning:
        The ``name="mpl2005"`` algorithm does not implement chunking for contour lines.
    r      zInput z must be 2D, not Dr   r   z>Input z must be at least a (2, 2) shaped array, but has shape zNumber of dimensions of x (z	) and y (z) do not matchzLength of x (z%) must match number of columns in z ()zLength of y (z") must match number of rows in z (zShapes of x z and z z do not matchzShapes of y z+Inputs x and y must be None, 1D or 2D, not Nz=If mask is set it must be a 2D array with the same shape as zz%Unrecognised contour generator name: z4 contour generator does not support corner_mask=Truez. contour generator does not support line_type z. contour generator does not support fill_type z4 contour generator does not support quad_as_tri=Truez- contour generator does not support z_interp )r   r   z1 contour generator does not support thread_count )x_chunk_sizey_chunk_size)r   r   r"   r#   r!   r'   r(   r)   )r   r   r   r   ndim	TypeErrorshapeZarangeZmeshgridlen
ValueError_class_lookupr   Zsupports_corner_maskZdefault_line_typer   Zsupports_line_typeZdefault_fill_typer   Zsupports_fill_typeZsupports_quad_as_trir
   Linearr   Zsupports_z_interpZsupports_threads)xyr   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r   nynxr.   r-   clsargskwargsZcont_genr   r   r   r   0   s    =














r   )NNN)numpyr   Z
_contourpyr   r   r   r   r   r   r	   r
   r   _versionr   chunkr   Z	enum_utilr   r   r   __all__dictr4   r   r5   r   r   r   r   r   <module>   s    ,