o
    g                     @   s\   d Z ddlZddlmZ ddlmZ ddlm  m	Z	 dgZ
dddZG dd dejZdS )	z:UnitDblConverter module containing class UnitDblConverter.    N)cbookUnitDblConverterc                 C   sf   t | tj d d }|dkrt| S |dkrdS |dkrdS |d dkr-d|d  d	S d| d
S )zRadian function formatter.g       @g      ?r      z$\pi/2$   z$\pi$$z\pi$z\pi/2$)intnppistr)xposn r   k/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/matplotlib/testing/jpl_units/UnitDblConverter.pyrad_fn   s   r   c                   @   s@   e Zd ZdZddddZedd Zedd	 Zed
d ZdS )r   zS
    Provides Matplotlib conversion functionality for the Monte UnitDbl class.
    kmdegsec)distanceangletimec                 C   sn   dd l m  m} | rt| tr| n|  }nd }|dkr*t|jtjr*tj	 }n|j
dd}tj||dS )Nr   r   F)	useOffset)majfmtlabel)matplotlib.testing.jpl_unitstesting	jpl_units
isinstancer
   r   axespolar	PolarAxesThetaFormatterUnitDblFormatterunitsAxisInfo)unitaxisUr   r   r   r   r   axisinfo)   s   zUnitDblConverter.axisinfoc                    sp   t | s fdd| D S tj| r| S d u r!t|  t jt	j
r3|  dkr3| dS | S )Nc                    s   g | ]	}t | qS r   )r   convert).0r   r&   r%   r   r   
<listcomp>D   s    z,UnitDblConverter.convert.<locals>.<listcomp>r   rad)r   is_scalar_or_stringr#   ConversionInterface
is_numliker   default_unitsr   r   r   r    typer)   )valuer%   r&   r   r+   r   r)   @   s   


zUnitDblConverter.convertc                 C   s(   t | rtj|   S t| d |S )Nr   )r   r.   r   defaultsr2   r1   )r3   r&   r   r   r   r1   S   s   
zUnitDblConverter.default_unitsN)	__name__
__module____qualname____doc__r4   staticmethodr(   r)   r1   r   r   r   r   r      s    

)N)r8   numpyr   
matplotlibr   matplotlib.unitsr#   matplotlib.projections.polarprojectionsr   __all__r   r/   r   r   r   r   r   <module>   s    
