Ejemplo n.º 1
0
    def test_eccentric_to_mean(self):
        E = np.linspace(0, 2.0 * np.pi, num=100, dtype=np.float64)
        M = kep.eccentric_to_mean(E, 0.0)
        nt.assert_array_almost_equal(E, M, decimal=7)

        e = np.linspace(0, 0.9, num=100, dtype=np.float64)
        M = kep.eccentric_to_mean(np.pi, e)
        M0 = np.ones(e.shape, dtype=np.float64) * np.pi
        nt.assert_array_almost_equal(M0, M, decimal=7)
Ejemplo n.º 2
0
    def test_mean_eccentric_inverse_float(self):
        M = np.linspace(0.0, 2.0 * np.pi, num=100, dtype=np.float64)
        e = np.linspace(0, 0.99, num=100, dtype=np.float64)

        for eit in e:
            for Mit in M:
                E_test = kep.mean_to_eccentric(Mit, eit)
                M_test = kep.eccentric_to_mean(E_test, eit)
                nt.assert_almost_equal(M_test, Mit, decimal=7)
Ejemplo n.º 3
0
    def test_mean_eccentric_inverse_array(self):
        M = np.linspace(0.0, 2.0 * np.pi, num=100, dtype=np.float64)
        e = np.linspace(0, 0.99, num=100, dtype=np.float64)

        Mv, ev = np.meshgrid(M, e)

        E_test = kep.mean_to_eccentric(Mv, ev)
        M_test = kep.eccentric_to_mean(E_test, ev)
        nt.assert_array_almost_equal(M_test, Mv, decimal=7)
Ejemplo n.º 4
0
    def test_laguerre_solve_kepler(self):
        E = np.linspace(0.0, 2.0 * np.pi, num=300, dtype=np.float64)
        e = np.linspace(0, 0.99, num=500, dtype=np.float64)

        for I, eit in enumerate(e):
            for J, Eit in enumerate(E):
                M = kep.eccentric_to_mean(Eit, eit)

                E0 = kep.kepler_guess(M, eit)
                E_calc, it = kep.laguerre_solve_kepler(E0, M, eit, tol=1e-12)
                fun_err = np.abs(M - E_calc + eit * np.sin(E_calc))

                nt.assert_almost_equal(Eit, E_calc, decimal=1e-9)
                assert fun_err < 1e-11
Ejemplo n.º 5
0
    def test_kepler_guess(self):
        E = np.linspace(0.0, 2.0 * np.pi, num=100, dtype=np.float64)
        e = np.linspace(0, 0.99, num=100, dtype=np.float64)

        Ev, ev = np.meshgrid(E, e)

        Mv = kep.eccentric_to_mean(Ev, ev)

        E0 = kep.kepler_guess(Mv, ev)

        #the initial guess SHOULD be at least 30 degrees to true
        test_accuracy = np.abs(E0 - Ev) * 180.0 / np.pi < 30.0
        nt.assert_array_equal(test_accuracy, np.full(test_accuracy.shape,
                                                     True))