diff --git a/pykep/test_trajopt.py b/pykep/test_trajopt.py index 69d6a151..f4fff707 100644 --- a/pykep/test_trajopt.py +++ b/pykep/test_trajopt.py @@ -56,16 +56,15 @@ class gym_cassini1_tests(_ut.TestCase): def test_fitness(self): import pykep as pk udp = pk.trajopt.gym.cassini1 - # Three random values. Ground truth provided by a snapshot of the kep3 code validated agains the old pykep code - # (not identical, just validated ... as a the old pykep had a buggy jpl_lp eph method nhere fixed) + # Three random values. Ground truth provided by the old pykep code x = [-554.5189290104555, 103.27184879471751, 335.41655259663474, 80.50258543604521, 862.0950563689543, 2865.018040480413 ] f = udp.fitness(x)[0] - self.assertTrue(float_rel_error(f,80747.26667221037) < 1e-14) + self.assertTrue(float_rel_error(f,80400.08898184073) < 1e-14) x = [-932.0532394941108, 37.534681289972674, 162.5093144821548, 336.970139545233, 1743.2915882004586, 2527.8785180526465 ] f = udp.fitness(x)[0] - self.assertTrue(float_rel_error(f,216694.84791232392) < 1e-14) + self.assertTrue(float_rel_error(f,217105.875031613573) < 1e-14) x = [-583.0776694390058, 388.65047998036107, 334.9959782156864, 65.57508619540917, 1520.2982946551908, 2132.7771932619144 ] f = udp.fitness(x)[0] - self.assertTrue(float_rel_error(f,107787.63141728108) < 1e-14) \ No newline at end of file + self.assertTrue(float_rel_error(f,107218.08496509642) < 1e-14) \ No newline at end of file diff --git a/src/udpla/jpl_lp.cpp b/src/udpla/jpl_lp.cpp index e89e92d7..38429ea2 100644 --- a/src/udpla/jpl_lp.cpp +++ b/src/udpla/jpl_lp.cpp @@ -134,7 +134,7 @@ std::array jpl_lp::_f_elements(double mjd2000) const // algorithm from https://ssd.jpl.nasa.gov/planets/approx_pos.html accessed // 2023. std::array elements_updated{}, elements_f{}; - double dt = (mjd2000) / 36525.; // Number of centuries passed since J2000.0 + double dt = (mjd2000 - 0.5) / 36525.; // Number of centuries passed since J2000. T = (T_eph - 2451545.0)/36525 for (unsigned int i = 0; i < 6; ++i) { elements_updated[i] = (m_elements[i] + m_elements_dot[i] * dt); } @@ -221,7 +221,7 @@ std::string jpl_lp::get_extra_info() const std::ostream &operator<<(std::ostream &os, const kep3::udpla::jpl_lp &udpla) { - os << udpla.get_extra_info() << "/n"; + os << udpla.get_extra_info() << "\n"; return os; }