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