本文整理汇总了Python中matplotlib.testing.jpl_units.Epoch方法的典型用法代码示例。如果您正苦于以下问题:Python jpl_units.Epoch方法的具体用法?Python jpl_units.Epoch怎么用?Python jpl_units.Epoch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.testing.jpl_units
的用法示例。
在下文中一共展示了jpl_units.Epoch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __add__
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def __add__( self, rhs ):
"""Add two Durations.
= ERROR CONDITIONS
- If the input rhs is not in the same frame, an error is thrown.
= INPUT VARIABLES
- rhs The Duration to add.
= RETURN VALUE
- Returns the sum of ourselves and the input Duration.
"""
# Delay-load due to circular dependencies.
import matplotlib.testing.jpl_units as U
if isinstance( rhs, U.Epoch ):
return rhs + self
self.checkSameFrame( rhs, "add" )
return Duration( self._frame, self._seconds + rhs._seconds )
#-----------------------------------------------------------------------
示例2: axisinfo
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def axisinfo( unit, axis ):
""": 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.
"""
majloc = date_ticker.AutoDateLocator()
majfmt = date_ticker.AutoDateFormatter( majloc )
return units.AxisInfo( majloc = majloc,
majfmt = majfmt,
label = unit )
#------------------------------------------------------------------------
示例3: float2epoch
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def float2epoch( value, unit ):
""": 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.
"""
# Delay-load due to circular dependencies.
import matplotlib.testing.jpl_units as U
secPastRef = value * 86400.0 * U.UnitDbl( 1.0, 'sec' )
return U.Epoch( unit, secPastRef, EpochConverter.jdRef )
#------------------------------------------------------------------------
示例4: test_axvspan_epoch
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def test_axvspan_epoch():
from datetime import datetime
import matplotlib.testing.jpl_units as units
units.register()
# generate some data
t0 = units.Epoch("ET", dt=datetime(2009, 1, 20))
tf = units.Epoch("ET", dt=datetime(2009, 1, 21))
dt = units.Duration("ET", units.day.convert("sec"))
fig = plt.figure()
plt.axvspan(t0, tf, facecolor="blue", alpha=0.25)
ax = plt.gca()
ax.set_xlim(t0 - 5.0*dt, tf + 5.0*dt)
示例5: test_axhspan_epoch
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def test_axhspan_epoch():
from datetime import datetime
import matplotlib.testing.jpl_units as units
units.register()
# generate some data
t0 = units.Epoch("ET", dt=datetime(2009, 1, 20))
tf = units.Epoch("ET", dt=datetime(2009, 1, 21))
dt = units.Duration("ET", units.day.convert("sec"))
fig = plt.figure()
plt.axhspan(t0, tf, facecolor="blue", alpha=0.25)
ax = plt.gca()
ax.set_ylim(t0 - 5.0*dt, tf + 5.0*dt)
示例6: __add__
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def __add__(self, rhs):
"""Add two Durations.
= ERROR CONDITIONS
- If the input rhs is not in the same frame, an error is thrown.
= INPUT VARIABLES
- rhs The Duration to add.
= RETURN VALUE
- Returns the sum of ourselves and the input Duration.
"""
# Delay-load due to circular dependencies.
import matplotlib.testing.jpl_units as U
if isinstance(rhs, U.Epoch):
return rhs + self
self.checkSameFrame(rhs, "add")
return Duration(self._frame, self._seconds + rhs._seconds)
# ----------------------------------------------------------------------
示例7: axisinfo
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def axisinfo(unit, axis):
""": 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.
"""
majloc = date_ticker.AutoDateLocator()
majfmt = date_ticker.AutoDateFormatter(majloc)
return units.AxisInfo(majloc=majloc, majfmt=majfmt, label=unit)
# -----------------------------------------------------------------------
示例8: float2epoch
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def float2epoch(value, unit):
""": 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.
"""
# Delay-load due to circular dependencies.
import matplotlib.testing.jpl_units as U
secPastRef = value * 86400.0 * U.UnitDbl(1.0, 'sec')
return U.Epoch(unit, secPastRef, EpochConverter.jdRef)
# -----------------------------------------------------------------------
示例9: __add__
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def __add__(self, rhs):
"""Add two Durations.
= ERROR CONDITIONS
- If the input rhs is not in the same frame, an error is thrown.
= INPUT VARIABLES
- rhs The Duration to add.
= RETURN VALUE
- Returns the sum of ourselves and the input Duration.
"""
# Delay-load due to circular dependencies.
import matplotlib.testing.jpl_units as U
if isinstance(rhs, U.Epoch):
return rhs + self
self.checkSameFrame(rhs, "add")
return Duration(self._frame, self._seconds + rhs._seconds)
示例10: axisinfo
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def axisinfo(unit, axis):
""": 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.
"""
majloc = date_ticker.AutoDateLocator()
majfmt = date_ticker.AutoDateFormatter(majloc)
return units.AxisInfo(majloc=majloc, majfmt=majfmt, label=unit)
示例11: float2epoch
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def float2epoch(value, unit):
""": 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.
"""
# Delay-load due to circular dependencies.
import matplotlib.testing.jpl_units as U
secPastRef = value * 86400.0 * U.UnitDbl(1.0, 'sec')
return U.Epoch(unit, secPastRef, EpochConverter.jdRef)
示例12: float2epoch
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def float2epoch( value, unit ):
""": 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.
"""
# Delay-load due to circular dependencies.
import matplotlib.testing.jpl_units as U
secPastRef = value * 86400.0 * U.UnitDbl( 1.0, 'sec' )
return U.Epoch( unit, secPastRef, EpochConverter.jdRef )
#------------------------------------------------------------------------
示例13: epoch2float
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def epoch2float( value, unit ):
""": 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.
"""
return value.julianDate( unit ) - EpochConverter.jdRef
#------------------------------------------------------------------------
示例14: convert
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def convert( value, unit, axis ):
""": 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.
"""
# Delay-load due to circular dependencies.
import matplotlib.testing.jpl_units as U
isNotEpoch = True
isDuration = False
if ( iterable(value) and not isinstance(value, str) ):
if ( len(value) == 0 ):
return []
else:
return [ EpochConverter.convert( x, unit, axis ) for x in value ]
if ( isinstance(value, U.Epoch) ):
isNotEpoch = False
elif ( isinstance(value, U.Duration) ):
isDuration = True
if ( isNotEpoch and not isDuration and
units.ConversionInterface.is_numlike( value ) ):
return value
if ( unit == None ):
unit = EpochConverter.default_units( value, axis )
if ( isDuration ):
return EpochConverter.duration2float( value )
else:
return EpochConverter.epoch2float( value, unit )
#------------------------------------------------------------------------
示例15: test_fill_units
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import Epoch [as 别名]
def test_fill_units():
from datetime import datetime
import matplotlib.testing.jpl_units as units
units.register()
# generate some data
t = units.Epoch("ET", dt=datetime(2009, 4, 27))
value = 10.0 * units.deg
day = units.Duration("ET", 24.0 * 60.0 * 60.0)
fig = plt.figure()
# Top-Left
ax1 = fig.add_subplot(221)
ax1.plot([t], [value], yunits='deg', color='red')
ax1.fill([733525.0, 733525.0, 733526.0, 733526.0],
[0.0, 0.0, 90.0, 0.0], 'b')
# Top-Right
ax2 = fig.add_subplot(222)
ax2.plot([t], [value], yunits='deg', color='red')
ax2.fill([t, t, t+day, t+day],
[0.0, 0.0, 90.0, 0.0], 'b')
# Bottom-Left
ax3 = fig.add_subplot(223)
ax3.plot([t], [value], yunits='deg', color='red')
ax3.fill([733525.0, 733525.0, 733526.0, 733526.0],
[0*units.deg, 0*units.deg, 90*units.deg, 0*units.deg], 'b')
# Bottom-Right
ax4 = fig.add_subplot(224)
ax4.plot([t], [value], yunits='deg', color='red')
ax4.fill([t, t, t+day, t+day],
[0*units.deg, 0*units.deg, 90*units.deg, 0*units.deg],
facecolor="blue")
fig.autofmt_xdate()