
[c           @` s  d  d l  m Z m Z 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 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 e j d e j f d e j d e j f g  d    Z d   Z d   Z d   Z e j j d d& d e j d e j d e j f d e j j e j  d e j j e j  d e j j e j  f g  d    Z d    Z d S('   i    (   t   absolute_importt   unicode_literalst   divisiont   print_functionN(   t   assert_allclosei   (   t   wcsi   (   t   models(   t   units(   t   assert_quantity_allcloseu   inpi  g(\4g     Fg33333F@iZ   ii   i   c         C` s3  t  j   } d d g } | | j  _ d d g | j  _ d } t j   } t j | d t j | d t j | t j  } t j	 | d t j | d t j | t j  } | | B} | | j
 B} | j |  d |  d d  }	 | j |	 d |	 d d  }
 t | |    |	 d d	 t | |	   |
 d d	 d  S(
   Ng90oOi@gXLjG@u   RA---TANu   DEC--TANi   i    i   t   atolg-q=(   R   t   WCSt   crvalt   ctypeR   t   Pix2Sky_TANt   RotateNative2Celestialt   ut   degt   RotateCelestial2Nativet   inverset   wcs_pix2worldt   wcs_world2pixR   (   t   inpt   wR   t   lonpolet   tant   n2ct   c2nt   mt   minvt   radect   xy(    (    sO   lib/python2.7/site-packages/astropy/modeling/tests/test_quantities_rotations.pyt   test_against_wcslib   s    22
i(   gv/g     5@c         C` s   d t  j d t  j j t  j  d t  j j t  j  } } } t j | | |  } t j | | |  } t | j	 | |      |  d d t  j t | j	 | |      |  d d t  j d  S(   Ni*   i+   i,   R	   gvIh%<=(
   R   R   t   tot   arcsect   radR   R   R   R   R   (   R   t   lont   latt   lon_poleR   R   (    (    sO   lib/python2.7/site-packages/astropy/modeling/tests/test_quantities_rotations.pyt   test_roundtrip_sky_rotaion&   s
    A)c          C` s   t  j d d t j  }  d t j d t j } } |  | |  \ } } t | | g d t j d t j g d d t j d  S(   Nt   angleiZ   i   i    R	   g|=(   R   t
   Rotation2DR   R   R   (   t   modelt   at   bt   xt   y(    (    sO   lib/python2.7/site-packages/astropy/modeling/tests/test_quantities_rotations.pyt   test_Rotation2D/   s    c          C` s}   t  j d d t j  }  |  j |  d t j d t j    \ } } t | | g d t j d t j g d d t j d  S(   NR'   g䠄Gm@i   i    R	   g|=(   R   R(   R   R   R   R   (   R)   R,   R-   (    (    sO   lib/python2.7/site-packages/astropy/modeling/tests/test_quantities_rotations.pyt   test_Rotation2D_inverse6   s    ,c          C` s   d t  j d t  j f }  d } d	 } t j d t  j t j d t  j d t  j d  } t | |   | d d
 t j d t  j d t  j d t  j d  } t | | t  j   |  d d t  j d  S(   NiZ   i    i   u   zxzR	   i
   i(   iZ   i    (   i    iZ   g-q=g-q=(	   R   R   R   t   EulerAngleRotationR"   t   npt   piR   R   (   t   ydegR-   t   zR)   (    (    sO   lib/python2.7/site-packages/astropy/modeling/tests/test_quantities_rotations.pyt   test_euler_angle_rotations<   s    4-u   paramsi<   i
   i   c   	      C` s  d t  j } d t  j } |  \ } } } t j | | | d d } | | j | j  \ } } t | | f d  | | |  \ } } t | | f d t  j d t  j f  | | j t  j  | j t  j   \ } } t | | f d t  j d t  j f  d  S(   Ni   t
   axes_orderu   xyzgfM7gwg3C#@(   gfM7gwg3C#@(	   R   R   R   R0   t   valueR   R   R    R"   (	   t   paramsR,   R-   t   phit   thetat   psit   urotR*   R+   (    (    sO   lib/python2.7/site-packages/astropy/modeling/tests/test_quantities_rotations.pyt   test_euler_rotations_with_unitsH   s    '-c          C` s~  t  j d t j d t j t j t j  }  t |  j	 j
 d  t |  j	 j d  t |  j j
 d  t |  j j d  t |  j j
 t j  t |  j j t j  |  j j t j d  k s t  |  j d d t j d  k s t  |  j	 j t j d	  k st  |  j d
 d t j d  k s3t  |  j j t j d  k sTt  |  j d d t j d  k szt  d  S(   Ni0N  g33333Rgi_ˡ0gm.׸?u   arcsecu   lonu   raw_unitu   radu   degu   latu   lon_pole(   R   R   R   R!   R   R1   R2   R"   R   R$   R7   t
   _raw_valueR#   R%   t   unitt   Unitt   AssertionErrort   _param_metrics(   R   (    (    sO   lib/python2.7/site-packages/astropy/modeling/tests/test_quantities_rotations.pyt   test_attributes[   s    -!&!&!(   i    i    (   i  g(\4(   g     Fg33333F@(   i    iZ   (   i    i(   i<   i
   i   (   t
   __future__R    R   R   R   t   pytestt   numpyR1   t   numpy.testingR   R   t    R   R   R   t   tests.helperR   t   markt   parametrizet   mgridR   R   R"   R!   R&   R.   R/   R5   R    R=   RC   (    (    (    sO   lib/python2.7/site-packages/astropy/modeling/tests/test_quantities_rotations.pyt   <module>   s&   "4L				!+