def _compute_parameters(k, a_0, a_f, inc_0, inc_f): """Compute parameters of the model. """ delta_inc = abs(inc_f - inc_0) V_0 = circular_velocity(k, a_0) V_f = circular_velocity(k, a_f) beta_0_ = beta_0(V_0, V_f, inc_0, inc_f) return V_0, beta_0_, delta_inc
def plot_problem(k=398600.0, a_0=7000.0, a_f=42166.0, inc_0=np.radians(28.5), i_f=0.0, f=3.5e-7, t_f=200): """Plot interesting quantities. """ t_domain = np.linspace(0, t_f, num=2000) * 86400 # s V_0 = circular_velocity(k, a_0) V_f = circular_velocity(k, a_f) beta_0_ = beta_0(V_0, V_f, inc_0, i_f) _, ax_l1 = plt.subplots() ax_l1.set_xlabel("Time, days") ax_l1.plot(t_domain / 86400, np.degrees(beta( t_domain, V_0=V_0, f=f, beta_0=beta_0_ )), color='k', linestyle='solid') ax_l1.set_ylabel("Yaw, degrees") ax_r1 = ax_l1.twinx() ax_r1.plot(t_domain / 86400, 1e-3 * a( t_domain, k=k, V_0=V_0, f=f, beta_0=beta_0_ ), color='k', linestyle='dashed') ax_r1.set_ylabel("Semimajor axis, km (thousands)") _, ax_l2 = plt.subplots() ax_l2.set_xlabel("Time, days") ax_l2.plot(t_domain / 86400, V( t_domain, V_0=V_0, f=f, beta_0=beta_0_ ), color='k', linestyle='solid') ax_l2.set_ylabel("Velocity, km/s") ax_r2 = ax_l2.twinx() ax_r2.plot(t_domain / 86400, np.degrees(inc_0 - delta_inc( t_domain, V_0=V_0, f=f, beta_0=beta_0_ )), color='k', linestyle='solid') ax_r2.set_ylabel("Inclination, degrees") return ax_l1, ax_r1, ax_l2, ax_r2
def plot_problem(k=398600.0, a_0=7000.0, a_f=42166.0, inc_0=np.radians(28.5), i_f=0.0, f=3.5e-7, t_f=200): """Plot interesting quantities. """ t_domain = np.linspace(0, t_f, num=2000) * 86400 # s V_0 = circular_velocity(k, a_0) V_f = circular_velocity(k, a_f) beta_0_ = beta_0(V_0, V_f, inc_0, i_f) _, ax_l1 = plt.subplots() ax_l1.set_xlabel("Time, days") ax_l1.plot(t_domain / 86400, np.degrees(beta(t_domain, V_0=V_0, f=f, beta_0=beta_0_)), color='k', linestyle='solid') ax_l1.set_ylabel("Yaw, degrees") ax_r1 = ax_l1.twinx() ax_r1.plot(t_domain / 86400, 1e-3 * a(t_domain, k=k, V_0=V_0, f=f, beta_0=beta_0_), color='k', linestyle='dashed') ax_r1.set_ylabel("Semimajor axis, km (thousands)") _, ax_l2 = plt.subplots() ax_l2.set_xlabel("Time, days") ax_l2.plot(t_domain / 86400, V(t_domain, V_0=V_0, f=f, beta_0=beta_0_), color='k', linestyle='solid') ax_l2.set_ylabel("Velocity, km/s") ax_r2 = ax_l2.twinx() ax_r2.plot(t_domain / 86400, np.degrees(inc_0 - delta_inc(t_domain, V_0=V_0, f=f, beta_0=beta_0_)), color='k', linestyle='solid') ax_r2.set_ylabel("Inclination, degrees") return ax_l1, ax_r1, ax_l2, ax_r2
def test_simple_circular_velocity(): k = 398600 * u.km**3 / u.s**2 a = 7000 * u.km expected_V = 7.5460491 * u.km / u.s V = util.circular_velocity(k, a) assert_quantity_allclose(V, expected_V)
def extra_quantities(k, a, ecc, argp_0, argp_f, f, A=0.0): """Extra quantities given by the model. """ V = circular_velocity(k, a) delta_V_ = delta_V(V, ecc, argp_0, argp_f, f, A) t_f_ = delta_V_ / f return delta_V_, t_f_
def test_simple_circular_velocity(): k = 398600 * u.km ** 3 / u.s ** 2 a = 7000 * u.km expected_V = 7.5460491 * u.km / u.s V = util.circular_velocity(k, a) assert_quantity_allclose(V, expected_V)
def extra_quantities(k, a, ecc_0, ecc_f, f): """Extra quantities given by the model. """ V_0 = circular_velocity(k, a) delta_V_ = delta_V(V_0, ecc_0, ecc_f) t_f_ = delta_V_ / f return delta_V_, t_f_
def extra_quantities(k, a, ecc_0, ecc_f, inc_0, inc_f, argp, f): """Extra quantities given by the model. """ beta_ = beta(ecc_0, ecc_f, inc_0, inc_f, argp) V_0 = circular_velocity(k, a) delta_V_ = delta_V(V_0, ecc_0, ecc_f, beta_) t_f_ = delta_V_ / f return delta_V_, beta_, t_f_
def main(): # http://matplotlib.org/users/pgf.html#custom-preamble # http://sbillaudelle.de/2015/02/23/seamlessly-embedding-matplotlib-output-into-latex.html rc("pgf", rcfonts=False) rc("text", usetex=True) k = 398600 a = 42164 inc_domain = np.radians(np.linspace(0, 30)) fig1, ax = plt.subplots(figsize=(6, 6)) eccentricities = 0.1, 0.2, 0.4, 0.6, 0.8 beta_data = np.zeros((inc_domain.shape[0], len(eccentricities))) for ii, ecc in enumerate(eccentricities): beta_data[:, ii] = beta(ecc, 0.0, 0.0, inc_domain, 0.0) ax.plot(np.degrees(inc_domain), np.degrees(beta_data[:, ii]), label="$e = %.1f$" % ecc) ax.set_xlabel("Inclination change (deg)") ax.set_ylabel(r"Yaw angle $|\beta| (deg)$") ax.set_xlim(0, 30) ax.set_ylim(0, 90) ax.grid(True) ax.legend() fig1.savefig("combined_ei/chart_beta.pgf") fig2, ax = plt.subplots(figsize=(6, 6)) eccentricities = 0.1, 0.2, 0.4, 0.6, 0.8 delta_V_data = np.zeros((inc_domain.shape[0], len(eccentricities))) for ii, ecc in enumerate(eccentricities): delta_V_data[:, ii] = delta_V(circular_velocity(k, a), ecc, 0.0, beta_data[:, ii]) ax.plot(np.degrees(inc_domain), delta_V_data[:, ii], label="$e = %.1f$" % ecc) ax.set_xlabel("Inclination change (deg)") ax.set_ylabel(r"$\Delta V$ (km/s)") ax.set_xlim(0, 30) ax.set_ylim(0, 2.5) ax.grid(True) ax.legend() fig2.savefig("combined_ei/chart_dV.pgf") return fig1, fig2