Ë
    ¨ehn(  ã                   óF  — d Z ddlmZ ddlZddlmZ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 ej(                  d	   Zd
„ Z G d„ de«      Z e e«       «      Z e«       j5                  e«        ee«      Z ee«      Z ej:                  ddd¬«      dd„«       Zd„ Zy)a|  
Builtin colormaps, colormap handling utilities, and the `ScalarMappable` mixin.

.. seealso::

  :doc:`/gallery/color/colormap_reference` for a list of builtin colormaps.

  :ref:`colormap-manipulation` for examples of how to make
  colormaps.

  :ref:`colormaps` an in-depth discussion of choosing
  colormaps.

  :ref:`colormapnorms` for more details about data normalization.
é    )ÚMappingN)Ú_apiÚcolors)Ú_ScalarMappable)Údatad)Úcmaps)Úcmap_familiesz	image.lutc                  ó  — i t         ¥} t        j                  «       D ]i  \  }}d|v rt        j                  ||t
        «      nAd|v rt        j                  |d   |«      n$t        j                  j                  ||t
        «      | |<   Œk dddddœ}|j                  «       D ]$  \  }}| |   j                  «       }||_	        || |<   Œ& t        | j                  «       «      D ]!  }|j                  «       }|| |j                  <   Œ# | S )zw
    Generate a dict mapping standard colormap names to standard colormaps, as
    well as the reversed colormaps.
    ÚredÚlistedÚgrayÚ	gist_grayÚ	gist_yargÚGreys)ÚgreyÚ	gist_greyÚ	gist_yergÚGrays)Úcmaps_listedr   Úitemsr   ÚLinearSegmentedColormapÚ_LUTSIZEÚListedColormapÚ	from_listÚcopyÚnameÚlistÚvaluesÚreversed)Úcmap_dr   ÚspecÚaliasesÚaliasÚoriginal_nameÚcmapÚrmaps           úK/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/matplotlib/cm.pyÚ_gen_cmap_registryr(       s  € ð
 ”Ð€FÜ—k‘k“mò L‰
ˆˆdð ˜‰}ô ×*Ñ*¨4°´xÔ@ð ˜4Ñô ×!Ñ! $ x¡.°$Ô7ä×*Ñ*×4Ñ4°T¸4ÄÓJð 	ˆtŠðLð Ø Ø Øñ€Gð !(§¡£ò Ñˆˆ}Ø�mÑ$×)Ñ)Ó+ˆØˆŒ	ØˆˆuŠðô �V—]‘]“_Ó%ò !ˆØ�}‰}‹ˆØ ˆˆt�y‰yÒð!ð €Mó    c                   óN   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dd	d
œd„Z
d„ Zd„ Zy)ÚColormapRegistryaç  
    Container for colormaps that are known to Matplotlib by name.

    The universal registry instance is `matplotlib.colormaps`. There should be
    no need for users to instantiate `.ColormapRegistry` themselves.

    Read access uses a dict-like interface mapping names to `.Colormap`\s::

        import matplotlib as mpl
        cmap = mpl.colormaps['viridis']

    Returned `.Colormap`\s are copies, so that their modification does not
    change the global definition of the colormap.

    Additional colormaps can be added via `.ColormapRegistry.register`::

        mpl.colormaps.register(my_colormap)

    To get a list of all registered colormaps, you can do::

        from matplotlib import colormaps
        list(colormaps)
    c                 ó2   — || _         t        |«      | _        y ©N)Ú_cmapsÚtupleÚ_builtin_cmaps)Úselfr   s     r'   Ú__init__zColormapRegistry.__init__Z   s   € ØˆŒÜ# E›lˆÕr)   c                 óv   — 	 | j                   |   j                  «       S # t        $ r t        |›d�«      d ‚w xY w)Nz is not a known colormap name)r.   r   ÚKeyError)r1   Úitems     r'   Ú__getitem__zColormapRegistry.__getitem__^   sF   € ð	OØ—;‘;˜tÑ$×)Ñ)Ó+Ð+øÜò 	OÜ˜d˜XÐ%BÐCÓDÈ$ÐNð	Oús   ‚ Ÿ8c                 ó,   — t        | j                  «      S r-   )Úiterr.   ©r1   s    r'   Ú__iter__zColormapRegistry.__iter__d   s   € Ü�D—K‘KÓ Ð r)   c                 ó,   — t        | j                  «      S r-   )Úlenr.   r9   s    r'   Ú__len__zColormapRegistry.__len__g   s   € Ü�4—;‘;ÓÐr)   c                 ó8   — ddj                  d„ | D «       «      z   S )Nz'ColormapRegistry; available colormaps:
z, c              3   ó(   K  — | ]
  }d |› d �–— Œ y­w)ú'N© )Ú.0r   s     r'   ú	<genexpr>z+ColormapRegistry.__str__.<locals>.<genexpr>l   s   è ø€ Ò7¨$˜A˜d˜V 1œ+Ñ7ùs   ‚)Újoinr9   s    r'   Ú__str__zColormapRegistry.__str__j   s!   € Ø:Ø—	‘	Ñ7°$Ô7Ó7ñ8ð 	9r)   c                 ó   — t        | «      S )zü
        Return a list of the registered colormap names.

        This exists only for backward-compatibility in `.pyplot` which had a
        ``plt.colormaps()`` method. The recommended way to get this list is
        now ``list(colormaps)``.
        )r   r9   s    r'   Ú__call__zColormapRegistry.__call__n   s   € ô �D‹zÐr)   NF)r   Úforcec                ó   — t        j                  t        j                  |¬«       |xs |j                  }|| v rG|st        d|› d�«      ‚|| j                  v rt        d|›d�«      ‚t        j                  d|›d�«       |j                  «       | j                  |<   | j                  |   j                  |k7  r|| j                  |   _        yy)	a¦  
        Register a new colormap.

        The colormap name can then be used as a string argument to any ``cmap``
        parameter in Matplotlib. It is also available in ``pyplot.get_cmap``.

        The colormap registry stores a copy of the given colormap, so that
        future changes to the original colormap instance do not affect the
        registered colormap. Think of this as the registry taking a snapshot
        of the colormap at registration.

        Parameters
        ----------
        cmap : matplotlib.colors.Colormap
            The colormap to register.

        name : str, optional
            The name for the colormap. If not given, ``cmap.name`` is used.

        force : bool, default: False
            If False, a ValueError is raised if trying to overwrite an already
            registered name. True supports overwriting registered colormaps
            other than the builtin colormaps.
        ©r%   zA colormap named "z" is already registered.z Re-registering the builtin cmap z is not allowed.zOverwriting the cmap z" that was already in the registry.N)
r   Úcheck_isinstancer   ÚColormapr   Ú
ValueErrorr0   Úwarn_externalr   r.   )r1   r%   r   rH   s       r'   ÚregisterzColormapRegistry.registerx   sâ   € ô2 	×ÑœfŸo™o°DÕ9àÒ �t—y‘yˆØ�4‰<Ùô !Ø(¨¨Ð.FÐGóIð Ià˜×,Ñ,Ñ,ä Ð!CØ$( 8Ð+;ð"=ó >ð >ô ×ÑÐ!6°t°hð ?Cð  Cô Dð !ŸI™I›Kˆ�‰�DÑð �;‰;�tÑ×!Ñ! TÒ)Ø%)ˆD�K‰K˜ÑÕ"ð *r)   c                 óv   — || j                   v rt        d|›d�«      ‚| j                  j                  |d«       y)a  
        Remove a colormap from the registry.

        You cannot remove built-in colormaps.

        If the named colormap is not registered, returns with no error, raises
        if you try to de-register a default colormap.

        .. warning::

            Colormap names are currently a shared namespace that may be used
            by multiple packages. Use `unregister` only if you know you
            have registered that name before. In particular, do not
            unregister just in case to clean the name before registering a
            new colormap.

        Parameters
        ----------
        name : str
            The name of the colormap to be removed.

        Raises
        ------
        ValueError
            If you try to remove a default built-in colormap.
        zcannot unregister z which is a builtin colormap.N)r0   rM   r.   Úpop)r1   r   s     r'   Ú
unregisterzColormapRegistry.unregisterª   sB   € ð6 �4×&Ñ&Ñ&ÜÐ1°$°ð :)ð )ó *ð *à�‰�‰˜˜dÕ#r)   c           	      ó  — |€| t         j                  d      S t        |t        j                  «      r|S t        |t
        «      r)t        j                  t        t        «      |¬«       | |   S t        dd|›dt        |«      › �z   «      ‚)a€  
        Return a color map specified through *cmap*.

        Parameters
        ----------
        cmap : str or `~matplotlib.colors.Colormap` or None

            - if a `.Colormap`, return it
            - if a string, look it up in ``mpl.colormaps``
            - if None, return the Colormap defined in :rc:`image.cmap`

        Returns
        -------
        Colormap
        ú
image.cmaprJ   z<get_cmap expects None or an instance of a str or Colormap . zyou passed z	 of type )ÚmplÚrcParamsÚ
isinstancer   rL   Ústrr   Úcheck_in_listÚsortedÚ
_colormapsÚ	TypeErrorÚtype)r1   r%   s     r'   Úget_cmapzColormapRegistry.get_cmapÊ   s„   € ð" ˆ<ØœŸ™ \Ñ2Ñ3Ð3ô �dœFŸO™OÔ,ØˆKÜ�dœCÔ Ü×Ñœv¤jÓ1¸Õ=à˜‘:ÐÜØJØ˜$˜ ¬4°«:¨,Ð7ñ8ó
ð 	
r)   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r2   r6   r:   r=   rE   rG   rO   rR   r^   rA   r)   r'   r+   r+   B   s>   „ ñò.+òOò!ò ò9òð &*°ô 0*òd$ó@
r)   r+   z3.7z3.11z^``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap()`` or ``pyplot.get_cmap()``)ÚremovalÚalternativec                 óò   — | €t         j                  d   } t        | t        j                  «      r| S t        j                  t        t        «      | ¬«       |€	t        |    S t        |    j                  |«      S )ah  
    Get a colormap instance, defaulting to rc values if *name* is None.

    Parameters
    ----------
    name : `~matplotlib.colors.Colormap` or str or None, default: None
        If a `.Colormap` instance, it will be returned. Otherwise, the name of
        a colormap known to Matplotlib, which will be resampled by *lut*. The
        default, None, means :rc:`image.cmap`.
    lut : int or None, default: None
        If *name* is not already a Colormap instance and *lut* is not None, the
        colormap will be resampled to have *lut* entries in the lookup table.

    Returns
    -------
    Colormap
    rT   )r   )
rU   rV   rW   r   rL   r   rY   rZ   r[   Ú	resampled)r   Úluts     r'   r^   r^   ù   se   € ð0 €|Ü�|‰|˜LÑ)ˆÜ�$œŸ™Ô(ØˆÜ×Ñ”vœjÓ)°Õ5Ø
€{Ü˜$ÑÐä˜$Ñ×)Ñ)¨#Ó.Ð.r)   c                 óæ   — t        | t        j                  «      r| S | �| nt        j                  d   }|t
        vr$t        j                  t        t
        «      |¬«       t        j                  |   S )ao  
    Ensure that we have a `.Colormap` object.

    For internal use to preserve type stability of errors.

    Parameters
    ----------
    cmap : None, str, Colormap

        - if a `Colormap`, return it
        - if a string, look it up in mpl.colormaps
        - if None, look up the default color map in mpl.colormaps

    Returns
    -------
    Colormap

    rT   rJ   )
rW   r   rL   rU   rV   r[   r   rY   rZ   Ú	colormaps)r%   Ú	cmap_names     r'   Ú_ensure_cmaprk     sZ   € ô& �$œŸ™Ô(ØˆØÐ(‘¬c¯l©l¸<Ñ.H€Ið œ
Ñ"Ü×Ñœ6¤*Ó-°IÕ>Ü�=‰=˜Ñ#Ð#r)   )NN) rb   Úcollections.abcr   Ú
matplotlibrU   r   r   Úmatplotlib.colorizerr   ÚScalarMappableÚmatplotlib._cmr   Úmatplotlib._cm_listedr   r   Úmatplotlib._cm_multivarr	   Úmultivar_cmapsÚmatplotlib._cm_bivarÚbivar_cmapsrV   r   r(   r+   r[   ÚglobalsÚupdateÚ_multivar_colormapsÚ_bivar_colormapsÚ
deprecatedr^   rk   rA   r)   r'   ú<module>r{      s®   ðñõ  $ã ß #å BÝ  Ý 7Ý CÝ 5ð �<‰<˜Ñ$€òôDf
�wô f
ñX Ñ0Ó2Ó3€
Ù ƒ	× Ñ �Ô á& ~Ó6Ð á# KÓ0Ð ð €‡�Ø	Øð,ôò/óð/ó:$r)   