ó
 m[c           @` s£   d  Z  d d l m Z m Z m Z m Z d d l Z d d l Z d d l	 j
 Z
 d d l j j Z d d l m Z d g Z d d  Z d e
 j f d     YZ d S(	   u:   UnitDblConverter module containing class UnitDblConverter.i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   iterableu   UnitDblConverterc         C` s   t  |  t j d d  } | d k r1 t |   S| d k rA d S| d k rQ d S| d d k rp d | d f Sd	 | f Sd
 S(   u   Radian function formatter.g       @g      Š?i    i   u   $\pi/2$i   u   $\pi$u   $%s\pi$u	   $%s\pi/2$N(   t   intt   npt   pit   str(   t   xt   post   n(    (    sL   lib/python2.7/site-packages/matplotlib/testing/jpl_units/UnitDblConverter.pyt   rad_fn!   s    
t   UnitDblConverterc           B` sV   e  Z d  Z i d d 6d d 6d d 6Z e d    Z e d    Z e d	    Z RS(
   uv   : A matplotlib converter class.  Provides matplotlib conversion
        functionality for the Monte UnitDbl class.
   u   kmu   distanceu   degu   angleu   secu   timec         C` s£   d d l  j j } |  rB t |  t j  r3 |  } qH |  j   } n d } | d k r{ t | j t	 j
  r{ t	 j
 j   } n | j d t  } t j d | d |  S(   uV  : Returns information on how to handle an axis that has Epoch data.

      = INPUT VARIABLES
      - unit    The units to use for a axis with Epoch data.

      = RETURN VALUE
      - Returns a matplotlib AxisInfo data structure that contains
        minor/major formatters, major/minor locators, and default
        label information.
      i    Nu   degt	   useOffsett   majfmtt   label(   t   matplotlib.testing.jpl_unitst   testingt	   jpl_unitst
   isinstancet   sixt   string_typesR   t   Nonet   axest   polart	   PolarAxest   ThetaFormattert   UnitDblFormattert   Falset   unitst   AxisInfo(   t   unitt   axist   UR   R   (    (    sL   lib/python2.7/site-packages/matplotlib/testing/jpl_units/UnitDblConverter.pyt   axisinfo=   s    	!c         C` s  d d l  j j } t } t |   rv t |  t j  rv t |   d k rM g  Sg  |  D] } t	 j
 | | |  ^ qT Sn  t |  | j  r t } n  | r­ t j j |   r­ |  S| d k rĪ t	 j |  |  } n  t | j t j  r|  j   d k r|  j
 d  S|  j
 |  S(   uW  : Convert value using unit to a float.  If value is a sequence, return
      the converted sequence.

      = INPUT VARIABLES
      - value   The value or list of values that need to be converted.
      - unit    The units to use for a axis with Epoch data.

      = RETURN VALUE
      - Returns the value parameter converted to floats.
      i    Nu   angleu   rad(   R   R   R   t   TrueR   R   R   R   t   lenR   t   convertt   UnitDblR   R   t   ConversionInterfacet
   is_numlikeR   t   default_unitsR   R   R   t   type(   t   valueR    R!   R"   t   isNotUnitDblR	   (    (    sL   lib/python2.7/site-packages/matplotlib/testing/jpl_units/UnitDblConverter.pyR&   `   s    )	'c         C` sH   t  |   r3 t |  t j  r3 t j |  d |  St j |  j   Sd S(   u  : Return the default unit for value, or None.

      = INPUT VARIABLES
      - value   The value or list of values that need units.

      = RETURN VALUE
      - Returns the default units to use for value.
      Return the default unit for value, or None.
      i    N(   R   R   R   R   R   R*   t   defaultsR+   (   R,   R!   (    (    sL   lib/python2.7/site-packages/matplotlib/testing/jpl_units/UnitDblConverter.pyR*      s    (   t   __name__t
   __module__t   __doc__R.   t   staticmethodR#   R&   R*   (    (    (    sL   lib/python2.7/site-packages/matplotlib/testing/jpl_units/UnitDblConverter.pyR   0   s   
#.(   R1   t
   __future__R    R   R   R   R   t   numpyR   t   matplotlib.unitsR   t   matplotlib.projections.polart   projectionsR   t   matplotlib.cbookR   t   __all__R   R   R(   R   (    (    (    sL   lib/python2.7/site-packages/matplotlib/testing/jpl_units/UnitDblConverter.pyt   <module>   s   "	