
    IR-e                        d dl 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mZ d dlmZ dd	gZej        j                            d
d          ej        _        ej        j                            dd          ej        _        ej        j                            d
d          ej        _        ej        j                            dd          ej        _        d Z G d d	e          Z G d de          ZdS )    N)Polygon)units)SkyCoord)rotation_matrix)SphericalRepresentationUnitSphericalRepresentation)AstropyUserWarning
QuadrangleSphericalCirclez`.CapStyle`z``matplotlib._enums.CapStyle``z`.JoinStyle`z``matplotlib._enums.JoinStyle``c                 >   t          | |          }t          | d          t          dt          j        z  t          j        z  |z
   d          z  }|                                }|                    |          }t          j        |          }|j	        |j
        fS )a&  
    Given a polygon with vertices defined by (lon, lat), rotate the polygon
    such that the North pole of the spherical coordinates is now at (lon0,
    lat0). Therefore, to end up with a polygon centered on (lon0, lat0), the
    polygon should initially be drawn around the North pole.
    )lonlatz)axis      ?y)r   r   nppiuradianto_cartesian	transformfrom_cartesianr   r   )r   r   lon0lat0polygontransform_matrixs         Elib/python3.11/site-packages/astropy/visualization/wcsaxes/patches.py_rotate_polygonr   $   s     *cs;;;G 'u3777/
+
 4
'(s; ; ; 
 ""$$G 011G)8AAG;##    c                   2     e Zd ZdZdej        f fd	Z xZS )r   a8  
    Create a patch representing a spherical circle - that is, a circle that is
    formed of all the points that are within a certain angle of the central
    coordinates on a sphere. Here we assume that latitude goes from -90 to +90.

    This class is needed in cases where the user wants to add a circular patch
    to a celestial image, since otherwise the circle will be distorted, because
    a fixed interval in longitude corresponds to a different angle on the sky
    depending on the latitude.

    Parameters
    ----------
    center : tuple or `~astropy.units.Quantity` ['angle']
        This can be either a tuple of two `~astropy.units.Quantity` objects, or
        a single `~astropy.units.Quantity` array with two elements
        or a `~astropy.coordinates.SkyCoord` object.
    radius : `~astropy.units.Quantity` ['angle']
        The radius of the circle
    resolution : int, optional
        The number of points that make up the circle - increase this to get a
        smoother circle.
    vertex_unit : `~astropy.units.Unit`
        The units in which the resulting polygon should be defined - this
        should match the unit that the transformation (e.g. the WCS
        transformation) expects as input.

    Notes
    -----
    Additional keyword arguments are passed to `~matplotlib.patches.Polygon`
    d   c                    t          |t                    rZ|j        }t          |t          t
          f          st          j        d| dt                     |j	        j
        |j	        j        }}n|\  }}t          j        ddt          j        z  |dz             d d         t          j        z  }	t          j        dt          j        z  |                    t          j                  z
  |          t          j        z  }
t'          |	|
||          \  }	}
|	                    |          }	|
                    |          }
t          j        |	|
g                                          } t-                      j        |fi | d S )Nz)Received `center` of representation type z. will be converted to SphericalRepresentation g              r   )
isinstancer   representation_type
issubclassr   r   warningswarnr	   	sphericalr   r   r   linspacer   r   r   repeatto_valuer   array	transposesuper__init__)selfcenterradius
resolutionvertex_unitkwargsrep_type	longitudelatituder   r   vertices	__class__s               r   r3   zSphericalCircle.__init__\   st    fh'' 	)1H24OP   D D D D&  
 #)"2"68H8LxII"(Ix k#q25y*q.99#2#>Iibefooah&?&??LLqxW"3YAAS ll;''ll;'' 8S#J''1133,,V,,,,,r    __name__
__module____qualname____doc__r   degreer3   __classcell__r>   s   @r   r   r   <   sP         > 3618 - - - - - - - - - -r    c                   2     e Zd ZdZdej        f fd	Z xZS )r
   a  
    Create a patch representing a latitude-longitude quadrangle.

    The edges of the quadrangle lie on two lines of constant longitude and two
    lines of constant latitude (or the equivalent component names in the
    coordinate frame of interest, such as right ascension and declination).
    Note that lines of constant latitude are not great circles.

    Unlike `matplotlib.patches.Rectangle`, the edges of this patch will render
    as curved lines if appropriate for the WCS transformation.

    Parameters
    ----------
    anchor : tuple or `~astropy.units.Quantity` ['angle']
        This can be either a tuple of two `~astropy.units.Quantity` objects, or
        a single `~astropy.units.Quantity` array with two elements.
    width : `~astropy.units.Quantity` ['angle']
        The width of the quadrangle in longitude (or, e.g., right ascension)
    height : `~astropy.units.Quantity` ['angle']
        The height of the quadrangle in latitude (or, e.g., declination)
    resolution : int, optional
        The number of points that make up each side of the quadrangle -
        increase this to get a smoother quadrangle.
    vertex_unit : `~astropy.units.Unit` ['angle']
        The units in which the resulting polygon should be defined - this
        should match the unit that the transformation (e.g. the WCS
        transformation) expects as input.

    Notes
    -----
    Additional keyword arguments are passed to `~matplotlib.patches.Polygon`
    r"   c           
      T   t          j        |                              |          \  }}|                    |          }|                    |          }|t          j        d||dz             z   }	|t          j        d||dz             z   }
t          j        |	d d         t          j        |	d         |          t          j        |	dd                    t          j        |	d         |          g          }t          j        t          j        |
d         |          |
d d         t          j        |
d         |          t          j        |
dd                    g          }t          j        ||g          	                                } t                      j        |fi | d S )Nr   r%   r&   )r   Quantityr/   r   r-   concatenater.   flipr0   r1   r2   r3   )r4   anchorwidthheightr7   r8   r9   r;   r<   lon_seqlat_seqr   r   r=   r>   s                 r   r3   zQuadrangle.__init__   s   
  j0099+FF	8 {++-- bk!UJNCCCR[FJNCCC n	'"+z22$$	'!*j11	
 
 n	'!*j11	'"+z22$$	
 
 8S#J''1133,,V,,,,,r    r?   rF   s   @r   r
   r
   ~   sQ         D 14$- $- $- $- $- $- $- $- $- $-r    )r*   numpyr   matplotlib.patchesr   astropyr   r   astropy.coordinatesr   $astropy.coordinates.matrix_utilitiesr   "astropy.coordinates.representationr   r   astropy.utils.exceptionsr	   __all__r3   rC   replaceset_capstyleset_joinstyler   r   r
    r    r   <module>r]      s        & & & & & &       ( ( ( ( ( ( @ @ @ @ @ @        8 7 7 7 7 7*
+ #+3;;3    #+3;;5     '3;CC3      !( 5 = E E5! !  
$ $ $0?- ?- ?- ?- ?-g ?- ?- ?-DF- F- F- F- F- F- F- F- F- F-r    