Пример #1
0
# print("################################################################")
# print("Percent Differences (as compared to JPL values)")
# print("a: " + str(perDiff(a, aJPL)) + "%")
# print("e: " + str(perDiff(e, eJPL)) + "%")
# print("i: " + str(perDiff(i, iJPL)) + "%")
# print("Lon ascending node: " + str(perDiff(lOmega[0], lOmegaJPL)) + "%")
# print("Perihelion: " + str(perDiff(aPerihelion, omegaJPL)) + "%")
# print("M: " + str(perDiff(M, MJPL)) + "%")
"""
PLOT ORBITS
"""

a = a * units.AU
ecc = e * units.one
inc = i * pi / 180 * units.deg
raan = lOmega[0] * units.deg
argp = aPerihelion * units.deg
nu = v * units.deg
epoch = time.Time(t2, format='jd', scale='utc')

asteroid_orbit = Orbit.from_sbdb('2018ez2')
asteroid_orbit = asteroid_orbit.propagate(epoch.tdb, rtol=1e-10)
estimated_orbit = Orbit.from_classical(Sun, a, ecc, inc, raan, argp, nu,
                                       epoch.tdb)
frame = OrbitPlotter3D(plane=Planes.EARTH_ECLIPTIC)
# frame._layout=dict(scene=dict(aspectmode='manual', aspectratio=dict(x=1, y=1, z=1), xaxis=dict(range=[-300e+6, 300e+6]), yaxis=dict(range=[-300e+6, 300e+6]), zaxis=dict(range=[-300e+6, 300e+6]) ))
frame.plot_body_orbit(Earth, epoch.tdb, label='Earth')
frame.plot(asteroid_orbit, label='2018ez2')
frame.plot(estimated_orbit, label='Estimated')
Пример #2
0
def test_apply_manuever_correct_plane():
    ceres = Orbit.from_sbdb("Ceres")
    imp = Maneuver.impulse([0, 0, 0] * u.km / u.s)
    new_ceres = ceres.apply_maneuver(imp)
    assert ceres.plane == Planes.EARTH_ECLIPTIC
    assert new_ceres.plane == ceres.plane
from poliastro.plotting.misc import plot_solar_system
from poliastro.util import time_range

EPOCH = Time("2017-09-01 12:05:50", scale="tdb")
C_FLORENCE = "#000"
C_MOON = "#999"

# In[5]:

Earth.plot(EPOCH)

# Our first option to retrieve the orbit of the Florence asteroid is to use `Orbit.from_sbdb`, which gives us the osculating elements at a certain epoch:

# In[6]:

florence_osc = Orbit.from_sbdb("Florence")
florence_osc

# However, the epoch of the result is not close to the time of the close approach we are studying:

# In[7]:

florence_osc.epoch.iso

# Therefore, if we `propagate` this orbit to `EPOCH`, the results will be a bit different from the reality. Therefore, we need to find some other means.
#
# Let's use the `Ephem.from_horizons` method as an alternative, sampling over a period of 6 months:

# In[8]:

from poliastro.ephem import Ephem
print("################################################################")
print("Percent Differences (as compared to JPL values)")
print("a: " + str(perDiff(a, aJPL)) + "%")
print("e: " + str(perDiff(e, eJPL)) + "%")
print("i: " + str(perDiff(i, iJPL)) + "%")
print("Lon ascending node: " + str(perDiff(lOmega[0], lOmegaJPL)) + "%")
print("Perihelion: " + str(perDiff(aPerihelion, omegaJPL)) + "%")
print("M: " + str(perDiff(M, MJPL)) + "%")
"""
PLOT ORBITS
"""

a = a * units.AU
ecc = e * units.one
inc = i * pi / 180 * units.deg
raan = lOmega[0] * units.deg
argp = aPerihelion * units.deg
nu = v * units.deg
epoch = time.Time(t2, format='jd', scale='utc')

asteroid_orbit = Orbit.from_sbdb('magellan')
asteroid_orbit = asteroid_orbit.propagate(epoch.tdb, rtol=1e-10)
estimated_orbit = Orbit.from_classical(Sun, a, ecc, inc, raan, argp, nu,
                                       epoch.tdb)
frame = OrbitPlotter3D(plane=Planes.EARTH_ECLIPTIC)
# frame._layout=dict(scene=dict(aspectmode='manual', aspectratio=dict(x=1, y=1, z=1), xaxis=dict(range=[-300e+6, 300e+6]), yaxis=dict(range=[-300e+6, 300e+6]), zaxis=dict(range=[-300e+6, 300e+6]) ))
frame.plot_body_orbit(Earth, epoch.tdb, label='Earth')
frame.plot(asteroid_orbit, label='Magellan')
frame.plot(estimated_orbit, label='Estimated')