当前位置: 首页>>代码示例>>Python>>正文


Python jpl_units.Epoch方法代码示例

本文整理汇总了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 )

   #----------------------------------------------------------------------- 
开发者ID:Solid-Mechanics,项目名称:matplotlib-4-abaqus,代码行数:24,代码来源:Duration.py

示例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 )

   #------------------------------------------------------------------------ 
开发者ID:Solid-Mechanics,项目名称:matplotlib-4-abaqus,代码行数:22,代码来源:EpochConverter.py

示例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 )

   #------------------------------------------------------------------------ 
开发者ID:Solid-Mechanics,项目名称:matplotlib-4-abaqus,代码行数:20,代码来源:EpochConverter.py

示例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) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:19,代码来源:test_axes.py

示例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) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:19,代码来源:test_axes.py

示例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)

    # ---------------------------------------------------------------------- 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:24,代码来源:Duration.py

示例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)

    # ----------------------------------------------------------------------- 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:20,代码来源:EpochConverter.py

示例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)

    # ----------------------------------------------------------------------- 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:20,代码来源:EpochConverter.py

示例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) 
开发者ID:boris-kz,项目名称:CogAlg,代码行数:22,代码来源:Duration.py

示例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) 
开发者ID:boris-kz,项目名称:CogAlg,代码行数:18,代码来源:EpochConverter.py

示例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) 
开发者ID:boris-kz,项目名称:CogAlg,代码行数:18,代码来源:EpochConverter.py

示例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 )

   #------------------------------------------------------------------------ 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:20,代码来源:EpochConverter.py

示例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

   #------------------------------------------------------------------------ 
开发者ID:Solid-Mechanics,项目名称:matplotlib-4-abaqus,代码行数:16,代码来源:EpochConverter.py

示例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 )

   #------------------------------------------------------------------------ 
开发者ID:Solid-Mechanics,项目名称:matplotlib-4-abaqus,代码行数:43,代码来源:EpochConverter.py

示例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() 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:40,代码来源:test_axes.py


注:本文中的matplotlib.testing.jpl_units.Epoch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。