
    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mZmZmZ g dZ G d dee j        	          Z G d
 de          Z G d dee j        	          Z G d dee j        	          ZdS )    N)Path)	Transform)units)BaseCoordinateFrameSkyCoordUnitSphericalRepresentationframe_transform_graph)CurvedTransformCoordinateTransformWorld2PixelTransformPixel2WorldTransformc                   4    e Zd ZdZdZdZdZd ZeZd Z	d Z
dS )r
   z?
    Abstract base class for non-affine curved transforms.
       Fc                 \    t          |                     |j                  |j                  S )a  
        Transform a Matplotlib Path.

        Parameters
        ----------
        path : :class:`~matplotlib.path.Path`
            The path to transform

        Returns
        -------
        path : :class:`~matplotlib.path.Path`
            The resulting path
        )r   	transformverticescodes)selfpaths     Hlib/python3.11/site-packages/astropy/visualization/wcsaxes/transforms.pytransform_pathzCurvedTransform.transform_path(   s$     DNN4=114:>>>    c                      t          d          N NotImplementedError)r   inputs     r   r   zCurvedTransform.transform:       !"%%%r   c                      t          d          r   r   r   s    r   invertedzCurvedTransform.inverted=   r   r   N)__name__
__module____qualname____doc__
input_dimsoutput_dimsis_separabler   transform_path_non_affiner   r"    r   r   r
   r
      sd          JKL? ? ?  !/& & && & & & &r   r
   )	metaclassc                   h     e Zd ZdZ fdZed             Zej        d             Zd ZeZ	d Z
 xZS )r   Tc                    t                                                       || _        || _        t	          | j        t
                    rCt          j        | j                  }|t          d| j         d           |            | _	        n6t	          | j        t                    r| j        | _	        nt          d          t	          | j        t
                    rCt          j        | j                  }|t          d| j         d           |            | _        n6t	          | j        t                    r| j        | _        nt          d          | j        | j	        k    r	d| _        d S d| _        d S )NzFrame z
 not foundzMinput_system should be a WCS instance, string, or a coordinate frame instancezNoutput_system should be a WCS instance, string, or a coordinate frame instanceTF)super__init___input_system_name_output_system_name
isinstancestrr	   lookup_name
ValueErrorinput_systemr   	TypeErroroutput_systemsame_frames)r   r7   r9   	frame_cls	__class__s       r   r0   zCoordinateTransform.__init__D   s   ".#0 d-s33 	-9$:QRRI  !M$*A!M!M!MNNN$-IKK!!/1DEE 	 $ 7D  
 d.44 	-9$:RSSI  !N$*B!N!N!NOOO%.Y[[""02EFF 	!%!9D  
 !222#D$Dr   c                     | j         S N_same_framesr!   s    r   r:   zCoordinateTransform.same_framesk   s      r   c                     || _         d S r>   r?   )r   r:   s     r   r:   zCoordinateTransform.same_frameso   s    'r   c                    | j         r|S |t          j        z  }|dddf         |dddf         }}t          t	          ||          | j                  }t          j        d          5  |                    | j	                  }ddd           n# 1 swxY w Y   |j
        j        j        }|j
        j        j        }t          j        |ddt          j        f         |ddt          j        f         fd          S )z>
        Transform one set of coordinates to another.
        Nr      )frameignore)all)axis)r:   udegr   r   r7   nperrstatetransform_tor9   	sphericallonlatconcatenatenewaxis)r   input_coordsx_iny_inc_inc_outrN   rO   s           r   r   zCoordinateTransform.transforms   s>     	 #ae+!!!!Q$'aaad);d'd334;L
 
 
 [X&&& 	: 	:%%d&899E	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: o!%o!%~s111bj=13qqq"*}3EFQOOOOs   *BBBc                 6    t          | j        | j                  S )6
        Return the inverse of the transform.
        )r   r2   r1   r!   s    r   r"   zCoordinateTransform.inverted   s     #4#;T=TUUUr   )r#   r$   r%   has_inverser0   propertyr:   setterr   transform_non_affiner"   __classcell__)r<   s   @r   r   r   A   s        K%% %% %% %% %%N ! ! X! ( ( (P P P2 %V V V V V V Vr   r   c                       e Zd ZdZdZdZeej        d                         Z	ej        d             Z
ej        d             ZdS )r   z>
    Base transformation from world to pixel coordinates.
    TNc                     dS )z7
        The number of input world dimensions.
        Nr+   r!   s    r   r'   zWorld2PixelTransform.input_dims         r   c                     dS )z
        Transform world to pixel coordinates. You should pass in a NxM array
        where N is the number of points to transform, and M is the number of
        dimensions. This then returns the (x, y) pixel coordinates
        as a Nx2 array.
        Nr+   )r   worlds     r   r   zWorld2PixelTransform.transform   r`   r   c                     dS rX   Nr+   r!   s    r   r"   zWorld2PixelTransform.inverted   r`   r   )r#   r$   r%   r&   rY   frame_inrZ   abcabstractmethodr'   r   r"   r+   r   r   r   r      s          KH   X
 	   	    r   r   c                       e Zd ZdZdZdZeej        d                         Z	ej        d             Z
ej        d             ZdS )r   z>
    Base transformation from pixel to world coordinates.
    TNc                     dS )z8
        The number of output world dimensions.
        Nr+   r!   s    r   r(   z Pixel2WorldTransform.output_dims   r`   r   c                     dS )z
        Transform pixel to world coordinates. You should pass in a Nx2 array
        of (x, y) pixel coordinates to transform to world coordinates. This
        will then return an NxM array where M is the number of dimensions.
        Nr+   )r   pixels     r   r   zPixel2WorldTransform.transform   r`   r   c                     dS rd   r+   r!   s    r   r"   zPixel2WorldTransform.inverted   r`   r   )r#   r$   r%   r&   rY   	frame_outrZ   rf   rg   r(   r   r"   r+   r   r   r   r      s          KI   X
 	   	    r   r   )rf   numpyrJ   matplotlib.pathr   matplotlib.transformsr   astropyr   rH   astropy.coordinatesr   r   r   r	   __all__ABCMetar
   r   r   r   r+   r   r   <module>ru      s~   


                 + + + + + +                   & & & & &i3; & & & &DQV QV QV QV QV/ QV QV QVh    ?ck    >    ?ck      r   