From 98edde5ee8067026739cae56ac40202814ddcf4b Mon Sep 17 00:00:00 2001 From: David A Minton Date: Fri, 15 Sep 2023 17:24:29 -0400 Subject: [PATCH 1/2] Fixed typo in unit test --- tests/test_swiftest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_swiftest.py b/tests/test_swiftest.py index ad15189fa..8f06cae1e 100755 --- a/tests/test_swiftest.py +++ b/tests/test_swiftest.py @@ -228,7 +228,8 @@ def test05_gr(self): integrators= ["whm","helio","rmvs","symba"] # Initialize the simulation object as a variable. Define the directory in which the output will be placed. - sim = swiftest.Simulation(tstop=1000.0, dt=0.005, tstep_out=10.0, dump_cadence=0,general_relativity=True) + tstep_out = 10.0 + sim = swiftest.Simulation(tstop=1000.0, dt=0.005, tstep_out=tstep_out, dump_cadence=0,general_relativity=True) sim.add_solar_system_body(["Sun","Mercury","Venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune"]) # Get the start and end date of the simulation so we can compare with the real solar system. @@ -250,7 +251,7 @@ def test05_gr(self): for i in integrators: sim.run(integrator=i) varpi_sim = sim.data['varpi'].sel(name="Mercury") - dvarpi_gr = np.diff(varpi_sim) / sim.param['tstep_out'] + dvarpi_gr = np.diff(varpi_sim) / tstep_out dvarpi_err = np.mean(dvarpi_obs - dvarpi_gr) / dvarpi_obs_mean self.assertLess(np.abs(dvarpi_err),msg=f'Mercury precession rate error of of {dvarpi_err:.2e} "/{sim.TU_name} higher than threshold value of {dvarpi_limit:.2e} "/{sim.TU_name}') From 4192711e15612c7b78c8eaf9f1609ec963ab0c77 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Fri, 15 Sep 2023 17:25:53 -0400 Subject: [PATCH 2/2] Added missing argument --- tests/test_swiftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_swiftest.py b/tests/test_swiftest.py index 8f06cae1e..e6d1cf4c9 100755 --- a/tests/test_swiftest.py +++ b/tests/test_swiftest.py @@ -253,7 +253,7 @@ def test05_gr(self): varpi_sim = sim.data['varpi'].sel(name="Mercury") dvarpi_gr = np.diff(varpi_sim) / tstep_out dvarpi_err = np.mean(dvarpi_obs - dvarpi_gr) / dvarpi_obs_mean - self.assertLess(np.abs(dvarpi_err),msg=f'Mercury precession rate error of of {dvarpi_err:.2e} "/{sim.TU_name} higher than threshold value of {dvarpi_limit:.2e} "/{sim.TU_name}') + self.assertLess(np.abs(dvarpi_err),dvarpi_limit,msg=f'Mercury precession rate error of of {dvarpi_err:.2e} "/{sim.TU_name} higher than threshold value of {dvarpi_limit:.2e} "/{sim.TU_name}') return