ó
 m[c           @` s   d  Z  d d l m Z m Z m Z m Z d d l Z d d l j Z d d l	 j
 Z d d l m Z d g Z d e j f d     YZ d S(   u6   EpochConverter module containing class EpochConverter.i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   iterableu   EpochConvertert   EpochConverterc           B` sn   e  Z d  Z d	 Z e d    Z e d    Z e d    Z e d    Z e d    Z	 e d    Z
 RS(
   u   : A matplotlib converter class.  Provides matplotlib conversion
        functionality for Monte Epoch and Duration classes.
   g   QD:Ai   c         C` s7   t  j   } t  j |  } t j d | 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.
      t   majloct   majfmtt   label(   t   date_tickert   AutoDateLocatort   AutoDateFormattert   unitst   AxisInfo(   t   unitt   axisR   R   (    (    sJ   lib/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyt   axisinfo&   s
    c         C` sB   d d l  j j } |  d | j d d  } | j | | t j  S(   uK  : Convert a matplotlib floating-point date into an Epoch of the
           specified units.

      = INPUT VARIABLES
      - value    The matplotlib floating-point date.
      - unit     The unit system to use for the Epoch.

      = RETURN VALUE
      - Returns the value converted to an Epoch in the specified time system.
      i    Ng     ő@g      đ?u   sec(   t   matplotlib.testing.jpl_unitst   testingt	   jpl_unitst   UnitDblt   EpochR   t   jdRef(   t   valueR   t   Ut
   secPastRef(    (    sJ   lib/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyt   float2epoch;   s    c         C` s   |  j  |  t j S(   uT  : Convert an Epoch value to a float suitible for plotting as a
           python datetime object.

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

      = RETURN VALUE
      - Returns the value parameter converted to floats.
      (   t
   julianDateR   R   (   R   R   (    (    sJ   lib/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyt   epoch2floatN   s    c         C` s   |  j    d S(   u  : Convert a Duration value to a float suitible for plotting as a
           python datetime object.

      = INPUT VARIABLES
      - value   A Duration or list of Durations that need to be converted.

      = RETURN VALUE
      - Returns the value parameter converted to floats.
      g     ő@(   t   seconds(   R   (    (    sJ   lib/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyt   duration2float]   s    c         C` s  d d l  j j } t } t } t |   r| t |  t j  r| t	 |   d k rS g  Sg  |  D] } t
 j | | |  ^ qZ Sn  t |  | j  r t } n t |  | j  r˛ t } n  | rŐ | rŐ t j j |   rŐ |  S| d k rö t
 j |  |  } n  | r	t
 j |   St
 j |  |  Sd S(   uX  : 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 an axis with Epoch data.

      = RETURN VALUE
      - Returns the value parameter converted to floats.
      i    N(   R   R   R   t   Truet   FalseR   t
   isinstancet   sixt   string_typest   lenR   t   convertR   t   DurationR   t   ConversionInterfacet
   is_numliket   Nonet   default_unitsR   R   (   R   R   R   R   t
   isNotEpocht
   isDurationt   x(    (    sJ   lib/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyR%   k   s&    )		c         C` sI   d } t |   r9 t |  t j  r9 t j |  d |  S|  j   } | 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.
      i    N(   R)   R   R!   R"   R#   R   R*   t   frame(   R   R   R.   (    (    sJ   lib/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyR*      s
    
g   PD:A(   t   __name__t
   __module__t   __doc__R   t   staticmethodR   R   R   R   R%   R*   (    (    (    sJ   lib/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyR      s   *(   R1   t
   __future__R    R   R   R   R"   t   matplotlib.unitsR   t   matplotlib.datest   datesR	   t   matplotlib.cbookR   t   __all__R'   R   (    (    (    sJ   lib/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyt   <module>   s   "	