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


Python Orbit.from_body_ephem方法代码示例

本文整理汇总了Python中poliastro.twobody.orbit.Orbit.from_body_ephem方法的典型用法代码示例。如果您正苦于以下问题:Python Orbit.from_body_ephem方法的具体用法?Python Orbit.from_body_ephem怎么用?Python Orbit.from_body_ephem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在poliastro.twobody.orbit.Orbit的用法示例。


在下文中一共展示了Orbit.from_body_ephem方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_from_ephem_raises_warning_if_time_is_not_tdb_with_proper_time

# 需要导入模块: from poliastro.twobody.orbit import Orbit [as 别名]
# 或者: from poliastro.twobody.orbit.Orbit import from_body_ephem [as 别名]
def test_from_ephem_raises_warning_if_time_is_not_tdb_with_proper_time(recwarn):
    body = Earth
    epoch = Time("2017-09-29 07:31:26", scale="utc")
    expected_epoch_string = "2017-09-29 07:32:35.182"  # epoch.tdb.value

    Orbit.from_body_ephem(body, epoch)

    w = recwarn.pop(TimeScaleWarning)
    assert expected_epoch_string in str(w.message)
开发者ID:poliastro,项目名称:poliastro,代码行数:11,代码来源:test_orbit.py

示例2: test_plot_trajectory_sets_label

# 需要导入模块: from poliastro.twobody.orbit import Orbit [as 别名]
# 或者: from poliastro.twobody.orbit.Orbit import from_body_ephem [as 别名]
def test_plot_trajectory_sets_label():
    op = OrbitPlotter()
    earth = Orbit.from_body_ephem(Earth)
    mars = Orbit.from_body_ephem(Mars)
    trajectory = earth.sample()
    op.plot(mars, label="Mars")
    op.plot_trajectory(trajectory, label="Earth")
    legend = plt.gca().get_legend()
    assert legend.get_texts()[1].get_text() == "Earth"
开发者ID:aarribas,项目名称:poliastro,代码行数:11,代码来源:test_plotting.py

示例3: plot_solar_system

# 需要导入模块: from poliastro.twobody.orbit import Orbit [as 别名]
# 或者: from poliastro.twobody.orbit.Orbit import from_body_ephem [as 别名]
def plot_solar_system(outer=True, epoch=None):
    """
    Plots the whole solar system in one single call.

    .. versionadded:: 0.9.0

    Parameters
    ------------
    outer : bool, optional
        Whether to print the outer Solar System, default to True.
    epoch: ~astropy.time.Time, optional
        Epoch value of the plot, default to J2000.
    """
    bodies = [Mercury, Venus, Earth, Mars]
    if outer:
        bodies.extend([Jupiter, Saturn, Uranus, Neptune])

    op = OrbitPlotter()
    for body in bodies:
        orb = Orbit.from_body_ephem(body, epoch)
        op.plot(orb, label=str(body))

    # Sets frame to the orbit of the Earth by default
    # TODO: Wait until https://github.com/poliastro/poliastro/issues/316
    # op.set_frame(*Orbit.from_body_ephem(Earth, epoch).pqw())

    return op
开发者ID:aarribas,项目名称:poliastro,代码行数:29,代码来源:plotting.py

示例4: test_show_calls_prepare_plot

# 需要导入模块: from poliastro.twobody.orbit import Orbit [as 别名]
# 或者: from poliastro.twobody.orbit.Orbit import from_body_ephem [as 别名]
def test_show_calls_prepare_plot(mock_prepare_plot, mock_iplot):
    m = OrbitPlotter2D()
    earth = Orbit.from_body_ephem(Earth)
    m.plot(orbit=earth, label="Obj")
    m.show()

    assert mock_iplot.call_count == 1
    mock_prepare_plot.assert_called_once_with()
开发者ID:aarribas,项目名称:poliastro,代码行数:10,代码来源:test_plotting2d.py

示例5: test_savefig_calls_prepare_plot

# 需要导入模块: from poliastro.twobody.orbit import Orbit [as 别名]
# 或者: from poliastro.twobody.orbit.Orbit import from_body_ephem [as 别名]
def test_savefig_calls_prepare_plot(mock_prepare_plot, mock_export):
    m = OrbitPlotter2D()
    earth = Orbit.from_body_ephem(Earth)
    m.plot(orbit=earth, label="Obj")
    with tempfile.NamedTemporaryFile() as fp:
        m.savefig(filename=fp.name + ".jpeg")

    assert mock_export.call_count == 1
    mock_prepare_plot.assert_called_once_with()
开发者ID:aarribas,项目名称:poliastro,代码行数:11,代码来源:test_plotting2d.py

示例6: test_plot_trajectory_plots_a_trajectory

# 需要导入模块: from poliastro.twobody.orbit import Orbit [as 别名]
# 或者: from poliastro.twobody.orbit.Orbit import from_body_ephem [as 别名]
def test_plot_trajectory_plots_a_trajectory():
    frame = OrbitPlotter2D()
    assert len(frame._data) == 0

    earth = Orbit.from_body_ephem(Earth)
    trajectory = earth.sample()
    frame.set_attractor(Sun)
    frame.plot_trajectory(trajectory)
    assert len(frame._data) == 1
    assert frame._attractor == Sun
开发者ID:aarribas,项目名称:poliastro,代码行数:12,代码来源:test_plotting2d.py

示例7: test_orbit_from_ephem_is_in_icrs_frame

# 需要导入模块: from poliastro.twobody.orbit import Orbit [as 别名]
# 或者: from poliastro.twobody.orbit.Orbit import from_body_ephem [as 别名]
def test_orbit_from_ephem_is_in_icrs_frame(body):
    ss = Orbit.from_body_ephem(body)

    assert ss.frame.is_equivalent_frame(ICRS())
开发者ID:poliastro,项目名称:poliastro,代码行数:6,代码来源:test_orbit.py

示例8: test_from_ephem_raises_error_for_pluto_moon

# 需要导入模块: from poliastro.twobody.orbit import Orbit [as 别名]
# 或者: from poliastro.twobody.orbit.Orbit import from_body_ephem [as 别名]
def test_from_ephem_raises_error_for_pluto_moon(body):
    with pytest.raises(RuntimeError) as excinfo:
        Orbit.from_body_ephem(body)
    assert "To compute the position and velocity" in excinfo.exconly()
开发者ID:poliastro,项目名称:poliastro,代码行数:6,代码来源:test_orbit.py

示例9: test_orbit_from_ephem_with_no_epoch_is_today

# 需要导入模块: from poliastro.twobody.orbit import Orbit [as 别名]
# 或者: from poliastro.twobody.orbit.Orbit import from_body_ephem [as 别名]
def test_orbit_from_ephem_with_no_epoch_is_today():
    # This is not that obvious http://stackoverflow.com/q/6407362/554319
    body = Earth
    ss = Orbit.from_body_ephem(body)
    assert (Time.now() - ss.epoch).sec < 1
开发者ID:poliastro,项目名称:poliastro,代码行数:7,代码来源:test_orbit.py


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