def test_ang_momentum(): r""" Test for Angular Momentum Function """ r_vector = [1, 2, 3] v_vector = [4, 5, 6] actual_out = RV2COE.ang_momentum(r_vector, v_vector) expected_out = [-3, 6, -3] np.testing.assert_allclose(actual_out, expected_out)
Line_0 = ['Line {}\n\t{}\n'.format(count+1,line)] r_i = float(line[0]) r_j = float(line[1]) r_k = float(line[2]) v_i = float(line[3]) v_j = float(line[4]) v_k = float(line[5]) r_input = [r_i, r_j, r_k] v_input = [v_i, v_j, v_k] Line_1 = ("The mu Constant: \n\t", str(mu), "\n", 'Radius {} (km)\n\t{}\n'.format(count+1,r_input)) Line_2 = ('Velocity {} (km/s)\n\t{}\n'.format(count+1,v_input)) r"""Inner Workings, Pulling outside functions""" h_input = RV2COE.ang_momentum(r_input, v_input) e_vector = RV2COE.eccentricity(mu, r_input, v_input, h_input) n_vector = RV2COE.line_of_nodes(RV2COE.unit_vector(h_input)) p = RV2COE.semi_latus_rectum(mu, h_input) theta = RV2COE.true_anom(r_input, h_input, e_vector) i = RV2COE.inclination(RV2COE.unit_vector(h_input)) a = RV2COE.semi_major_axis(p, np.linalg.norm(e_vector)) raan = RV2COE.R_A_A_N(n_vector)