ó
ßČ[c           @` sN  d  d l  m Z m Z m Z m Z d  d l m Z m Z d  d l Z d  d l	 Z
 d  d l m Z d d l m Z d d l m Z e j j d	 d" d# d$ d% d& e
 j d d  d d  f g  d    Z e j j d	 d' d( d) g  d    Z d   Z d   Z d   Z d   Z d d d d d d g Z e j j d  e  d!    Z d S(*   i    (   t   absolute_importt   unicode_literalst   divisiont   print_function(   t   cost   sinN(   t   assert_allclosei   (   t   modelsi   (   t   wcsu   inpi   gÂő(\4Ŕg     FŔg33333óF@iZ   iŚ˙˙˙i   i   c         C` s	  t  j   } d d g } | | j  _ d d g | j  _ d } t j   } t j | d | d |  } t j | d | d |  } | | B} | | j B} | j	 |  d |  d d  }	 | j
 |	 d |	 d d  }
 t | |    |	 d d	 t | |	   |
 d d	 d  S(
   NgŻ90oOi@gXĄLjG@u   RA---TANu   DEC--TANi´   i    i   t   atolgę-q=(   R   t   WCSt   crvalt   ctypeR   t   Pix2Sky_TANt   RotateNative2Celestialt   RotateCelestial2Nativet   inverset   wcs_pix2worldt   wcs_world2pixR   (   t   inpt   wR   t   lonpolet   tant   n2ct   c2nt   mt   minvt   radect   xy(    (    sD   lib/python2.7/site-packages/astropy/modeling/tests/test_rotations.pyt   test_against_wcslib   s    
i(   g     5@c         C` s   d \ } } } t  j | | |  } t  j | | |  } t | j | |      |  d d t | j | |      |  d d d  S(   Ni*   i+   i,   R	   gvIhÂ%<=(   i*   i+   i,   (   R   R   R   R   R   (   R   t   lont   latt   lon_poleR   R   (    (    sD   lib/python2.7/site-packages/astropy/modeling/tests/test_rotations.pyt   test_roundtrip_sky_rotaion&   s
    "c          C` sH   t  j d d d  }  |  d d  \ } } t | d  t | d  d  S(   Ni   iZ   i    iś   (   R   R   R   (   R   t   alphat   delta(    (    sD   lib/python2.7/site-packages/astropy/modeling/tests/test_rotations.pyt   test_native_celestial_lat90/   s    c          C` sJ   t  j d d  }  |  d d  \ } } t | | g d d g d d d  S(   Nt   angleiZ   i   i    R	   gť˝×Ůß|Ű=(   R   t
   Rotation2DR   (   t   modelt   xt   y(    (    sD   lib/python2.7/site-packages/astropy/modeling/tests/test_rotations.pyt   test_Rotation2D6   s    c          C` sS   t  j d d  }  |  j |  d d    \ } } t | | g d d g d d d  S(   NR%   gśä Gm@i   i    R	   gť˝×Ůß|Ű=(   R   R&   R   R   (   R'   R(   R)   (    (    sD   lib/python2.7/site-packages/astropy/modeling/tests/test_rotations.pyt   test_Rotation2D_inverse<   s    c          C` sľ   d }  d } d } d } d } t  j d d d d  } t | |   | d d t  j d d d d	  } t | |   | d d t  j d d d d
  } t | |    | d d d  S(   Ni    iZ   i´   iŚ˙˙˙u   zxzR	   i
   iô˙˙˙u   zyzu   yzy(   i    i    (   iZ   i    (   i    iZ   (   i´   i    (   iŚ˙˙˙i    gę-q=gę-q=gę-q=(   R   t   EulerAngleRotationR   (   R(   R)   t   zt   negxt   negyR'   (    (    sD   lib/python2.7/site-packages/astropy/modeling/tests/test_rotations.pyt   test_euler_angle_rotationsB   s    u   zxzu   zyzu   yzyu   yxyu   xyxu   xzxu
   axes_orderc      	   C` sç  t  j d  } t  j d  } t  j d  } t |  } t |  } t |  } t |  } t |  } t |  }	 i t  j | | | | |	 | |	 | | | | | g | | | | |	 | | | | |	 | | g | |	 | | | g g  d 6t  j | | | | |	 | | | | |	 | | g | |	 | | | | | | | |	 | | g | | | |	 | g g  d 6t  j | | | | |	 | | | | | | |	 g | | | | |	 g | |	 | | | | | | | | | |	 g g  d 6t  j | | | | |	 | | | |	 | | | g | |	 | | | g | | | | |	 | | | | | | |	 g g  d 6t  j | | |	 | | g | | | | | | |	 | |	 | | | g | | | | | | |	 | | | | |	 g g  d 6t  j | | | | |	 g | | | | | | |	 | | | | |	 g | | | |	 | | | | | | | |	 g g  d	 6}
 t j d d d |   } | j | | | |   } t | j	 |
 |   d
 S(   ug   
    Tests against all Euler sequences.
    The rotation matrices definitions come from Wikipedia.
    gffffff7@gffffff(@i"   u   zxzu   zyzu   yzyu   yxyu   xyxu   xzxN(
   t   npt   deg2radR   R   t   arrayR   R,   t   _create_matrixR   t   T(   t
   axes_ordert   phit   thetat   psit   c1t   c2t   c3t   s1t   s2t   s3t   matricesR'   t   mat(    (    sD   lib/python2.7/site-packages/astropy/modeling/tests/test_rotations.pyt   test_euler_anglesW   s<    :1707;6;1;1=(   i    i    (   i   gÂő(\4Ŕ(   g     FŔg33333óF@(   i    iZ   (   i    iŚ˙˙˙(   i    i    (   i(   gÂő(\4Ŕ(   g     5@g33333óF@(   t
   __future__R    R   R   R   t   mathR   R   t   pytestt   numpyR1   t   numpy.testingR   t    R   R   t   markt   parametrizet   mgridR   R!   R$   R*   R+   R0   t   euler_axes_orderRB   (    (    (    sD   lib/python2.7/site-packages/astropy/modeling/tests/test_rotations.pyt   <module>   s   "4'					