o
    :a                     @   sD   d Z ddlmZ ddlmZ ddlmZ dgZG dd dej	Z
dS )z6EpochConverter module containing class EpochConverter.    )cbookNEpochConverterc                   @   s\   e Zd ZdZdZedd Zedd Zedd Zed	d
 Z	edd Z
edd ZdS )r   z`
    Provides Matplotlib conversion functionality for Monte Epoch and Duration
    classes.
    g   PD:Ac                 C   s"   t  }t |}tj||| dS )N)majlocmajfmtZlabel)date_tickerZAutoDateLocatorZAutoDateFormatterunitsZAxisInfo)unitaxisr   r    r
   M/usr/lib/python3/dist-packages/matplotlib/testing/jpl_units/EpochConverter.pyaxisinfo   s   
zEpochConverter.axisinfoc                 C   s6   ddl m  m} | d |dd }|||tjS )a]  
        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.
        r   N     @g      ?Zsec)matplotlib.testing.jpl_unitstesting	jpl_unitsZUnitDblZEpochr   jdRef)valuer   UZ
secPastRefr
   r
   r   float2epoch   s   zEpochConverter.float2epochc                 C   s   |  |tj S )af  
        Convert an Epoch value to a float suitable 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.
        )Z
julianDater   r   )r   r   r
   r
   r   epoch2float.   s   zEpochConverter.epoch2floatc                 C   s   |   d S )a,  
        Convert a Duration value to a float suitable 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.
        r   )Zseconds)r   r
   r
   r   duration2float=   s   zEpochConverter.duration2floatc                    sf   dd l m  m} t| s fdd| D S d u r"t|  t| |jr-t	| S t
| S )Nr   c                    s   g | ]	}t | qS r
   )r   convert).0xr	   r   r
   r   
<listcomp>S   s    z*EpochConverter.convert.<locals>.<listcomp>)r   r   r   r   is_scalar_or_stringr   default_units
isinstanceZDurationr   r   )r   r   r	   r   r
   r   r   r   K   s   

zEpochConverter.convertc                 C   s"   t | r	|  S t| d |S )Nr   )r   r   framer   r   )r   r	   r
   r
   r   r   [   s   
zEpochConverter.default_unitsN)__name__
__module____qualname____doc__r   staticmethodr   r   r   r   r   r   r
   r
   r
   r   r   
   s    




)r#   Z
matplotlibr   Zmatplotlib.unitsr   Zmatplotlib.datesZdatesr   __all__ZConversionInterfacer   r
   r
   r
   r   <module>   s    