o
    h                     @   s<   d Z ddlmZmZ ddlmZ dgZG dd dejZ	dS )z6EpochConverter module containing class EpochConverter.    )cbookunitsN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   QD:Ac                 C   s"   t  }t |}tj||| dS )N)majlocmajfmtlabel)date_tickerAutoDateLocatorAutoDateFormatterr   AxisInfo)unitaxisr   r    r   /var/www/html/construction_image-detection-poc/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                    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>P   s    z*EpochConverter.convert.<locals>.<listcomp>)r   r   r   r   is_scalar_or_stringr   default_units
isinstanceDurationr    r   )r   r   r   r   r   r$   r   r!   H   s   

zEpochConverter.convertc                 C   s"   t | r	|  S t| d |S )Nr   )r   r&   framer   r'   )r   r   r   r   r   r'   X   s   
zEpochConverter.default_unitsN)__name__
__module____qualname____doc__r   staticmethodr   r   r   r    r!   r'   r   r   r   r   r   	   s    




)
r.   
matplotlibr   r   matplotlib.datesdatesr   __all__ConversionInterfacer   r   r   r   r   <module>   s
    