當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。