
    zYHh                     T    d Z ddlmZmZ ddlmZ dgZ G d dej                        Z	y)z6EpochConverter module containing class EpochConverter.    )cbookunitsNEpochConverterc                   t    e Zd ZdZdZed        Zed        Zed        Zed        Z	ed        Z
ed        Zy	)
r   z`
    Provides Matplotlib conversion functionality for Monte Epoch and Duration
    classes.
    g   QD:Ac                     t        j                         }t        j                  |      }t        j                  |||       S )N)majlocmajfmtlabel)date_tickerAutoDateLocatorAutoDateFormatterr   AxisInfo)unitaxisr   r	   s       d/var/www/html/planif/env/lib/python3.12/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyaxisinfozEpochConverter.axisinfo   s5     ,,...v6~~VF$GG    c                     ddl mc m} | dz  |j                  dd      z  }|j	                  ||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
secPastRefs       r   float2epochzEpochConverter.float2epoch   s<     	10W_qyye'<<
wwtZ)=)=>>r   c                 F    | j                  |      t        j                  z
  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   s     r   epoch2floatzEpochConverter.epoch2float+   s      %(<(<<<r   c                 (    | j                         dz  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   s    r   duration2floatzEpochConverter.duration2float:   s     }}((r   c                 D   dd l mc m} t        j                  |       s%| D cg c]  }t
        j                  |||       c}S |t
        j                  | |      }t        | |j                        rt
        j                  |       S t
        j                  | |      S c c}w Nr   )r   r   r   r   is_scalar_or_stringr   convertdefault_units
isinstanceDurationr&   r#   )r   r   r   r   xs        r   r*   zEpochConverter.convertH   s    
 	10((/CHIaN**1dD9II<!//t<DeQZZ(!0077!--eT:: Js   Bc                 ~    t        j                  |       r| j                         S t        j	                  | d   |      S r(   )r   r)   framer   r+   )r   r   s     r   r+   zEpochConverter.default_unitsX   s5     $$U+;;= !//a$??r   N)__name__
__module____qualname____doc__r   staticmethodr   r    r#   r&   r*   r+    r   r   r   r   	   s    
 EH H ? ?$ = = ) ) ; ; @ @r   )
r4   
matplotlibr   r   matplotlib.datesdatesr   __all__ConversionInterfacer   r6   r   r   <module>r<      s,    < # &
U@U.. U@r   