Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python27
/
lib64
/
python2.7
/
site-packages
/
matplotlib
/
testing
/
jpl_units
/
File Content:
EpochConverter.pyo
� _�3Lc @ sZ d Z d d l j Z d d l j Z d d l m Z d g Z d e j f d � � YZ d S( s6 EpochConverter module containing class EpochConverter.i����N( t iterablet EpochConverterc B sn e Z d Z d Z e d � � Z e d � � Z e d � � Z e d � � Z e d � � Z e d � � Z RS( s : A matplotlib converter class. Provides matplotlib conversion functionality for Monte Epoch and Duration classes. g �QD:Ai c C s7 t j � } t j | � } t j d | d | d | � S( sV : Returns information on how to handle an axis that has Epoch data. = INPUT VARIABLES - unit The units to use for a axis with Epoch data. = RETURN VALUE - Returns a matplotlib AxisInfo data structure that contains minor/major formatters, major/minor locators, and default label information. t majloct majfmtt label( t date_tickert AutoDateLocatort AutoDateFormattert unitst AxisInfo( t unitt axisR R ( ( s^ /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyt axisinfo s c C sB d d l j j } | d | j d d � } | j | | t j � S( sK : 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 sepcified time system. i����Ng �@g �?t sec( t matplotlib.testing.jpl_unitst testingt jpl_unitst UnitDblt EpochR t jdRef( t valueR t Ut secPastRef( ( s^ /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyt float2epoch5 s c C s | j | � t j S( sT : Convert an Epoch value to a float suitible 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. ( t julianDateR R ( R R ( ( s^ /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyt epoch2floatH s c C s | j � S( s : Convert a Duration value to a float suitible 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. ( t days( R ( ( s^ /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyt duration2floatW s c C s d d l j j } t } t } t | � ry t | t � ry t | � d k rP g Sg | D] } t j | | | � ^ qW Sn t | | j � r� t } n t | | j � r� t } n | r� | r� t j j | � r� | S| d k r� t j | | � } n | rt j | � St j | | � Sd S( sX : Convert value using unit to a float. If value is a sequence, return the converted sequence. = INPUT VARIABLES - value The value or list of values 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. i����Ni ( R R R t Truet FalseR t isinstancet strt lenR t convertR t DurationR t ConversionInterfacet is_numliket Nonet default_unitsR R ( R R R R t isNotEpocht isDurationt x( ( s^ /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.pyR! e s&