o
    g]                     @   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majfmtlabel)date_tickerAutoDateLocatorAutoDateFormatterunitsAxisInfo)unitaxisr   r    r   i/home/ubuntu/cloudmapper/venv/lib/python3.10/site-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      ?sec)matplotlib.testing.jpl_unitstesting	jpl_unitsUnitDblEpochr   jdRef)valuer   U
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.
        )
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   )seconds)r   r   r   r   duration2float=   s   zEpochConverter.duration2floatc                    sv   dd l m  m} t| s fdd| D S tj| r | S d u r*t	|  t
| |jr5t| 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
   ConversionInterface
is_numliker   default_units
isinstance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    




)r0   
matplotlibr   matplotlib.unitsr
   matplotlib.datesdatesr   __all__r'   r   r   r   r   r   <module>   s    