def test_long_propagations_kepler_agrees_mean_motion(): tof = 100 * u.year r_mm, v_mm = iss.propagate(tof, method=mean_motion).rv() r_k, v_k = iss.propagate(tof, method=kepler).rv() assert_quantity_allclose(r_mm, r_k) assert_quantity_allclose(v_mm, v_k) r_halleys = [-9018878.63569932, -94116054.79839276, 22619058.69943215] # km v_halleys = [-49.95092305, -12.94843055, -4.29251577] # km/s halleys = Orbit.from_vectors(Sun, r_halleys * u.km, v_halleys * u.km / u.s) r_mm, v_mm = halleys.propagate(tof, method=mean_motion).rv() r_k, v_k = halleys.propagate(tof, method=kepler).rv() assert_quantity_allclose(r_mm, r_k) assert_quantity_allclose(v_mm, v_k)
def test_time_to_anomaly(expected_nu): tof = iss.time_to_anomaly(expected_nu) iss_propagated = iss.propagate(tof) assert_quantity_allclose(iss_propagated.nu, expected_nu, atol=1e-12 * u.rad)
def test_propagate_long_times_keeps_geometry(method): # See https://github.com/poliastro/poliastro/issues/265 time_of_flight = 100 * u.year res = iss.propagate(time_of_flight, method=method) assert_quantity_allclose(iss.a, res.a) assert_quantity_allclose(iss.ecc, res.ecc) assert_quantity_allclose(iss.inc, res.inc) assert_quantity_allclose(iss.raan, res.raan) assert_quantity_allclose(iss.argp, res.argp) assert_quantity_allclose((res.epoch - iss.epoch).to(time_of_flight.unit), time_of_flight)
ss = Orbit.from_classical(Sun, a, ecc, inc, raan, argp, nu) ss.state.period.to(u.day) ss.state.v #plot (ss) from poliastro.examples import iss iss #plot (iss) iss.epoch iss.nu.to(u.deg) iss.n.to(u.deg / u.min) iss_30m = iss.propagate(30 * u.min) iss_30m.epoch iss_30m.nu.to(u.deg) #plot (iss_30m) earth = Orbit.from_body_ephem(Earth) #plot(earth) earth_30d = earth.propagate(30 * u.day) #plot(earth_30d) from poliastro.maneuver import Maneuver dv = [5, 0, 0] * u.m / u.s man = Maneuver.impulse(dv) man = Maneuver((0 * u.s, dv))
# $ numba --annotate-html numba_test.py from poliastro.examples import iss print(iss.propagate(iss.period))
# In[10]: rtol = 1e-13 full_periods = 2 # In[11]: u0 = state_to_vector(iss) tf = ((2 * full_periods + 1) * iss.period / 2) u0, tf # In[12]: iss_f_kep = iss.propagate(tf, rtol=1e-18) # In[13]: r, v = cowell(iss.attractor.k, iss.r, iss.v, [tf] * u.s, rtol=rtol) # In[14]: iss_f_num = Orbit.from_vectors(Earth, r[0], v[0], iss.epoch + tf) # In[15]: iss_f_num.r, iss_f_kep.r # In[16]:
def time_propagate_iss_one_period(): iss.propagate(iss.period)