From ea0dee6a5e12600dc5df9649431f8d3d163b17bc Mon Sep 17 00:00:00 2001 From: DinoBektesevic Date: Fri, 2 Feb 2024 12:14:00 -0800 Subject: [PATCH 1/2] Skip regression test when no GPU exists. --- tests/test_regression_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_regression_test.py b/tests/test_regression_test.py index fe8a08e0..56c099a6 100644 --- a/tests/test_regression_test.py +++ b/tests/test_regression_test.py @@ -511,6 +511,7 @@ def run_full_test(): # The unit test runner class test_regression_test(unittest.TestCase): + @unittest.skipIf(not HAS_GPU, "Skipping test (no GPU detected)") def test_run_test(self): self.assertTrue(run_full_test()) From e4a4a089a85e85ac1ab0f715caf9e6267f3855e5 Mon Sep 17 00:00:00 2001 From: DinoBektesevic Date: Fri, 2 Feb 2024 12:38:20 -0800 Subject: [PATCH 2/2] Fix trajectory position predictions in results. --- src/kbmod/trajectory_utils.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/kbmod/trajectory_utils.py b/src/kbmod/trajectory_utils.py index e05fde48..0459e137 100644 --- a/src/kbmod/trajectory_utils.py +++ b/src/kbmod/trajectory_utils.py @@ -67,16 +67,23 @@ def trajectory_predict_skypos(trj, wcs, times): times : `list` or `numpy.ndarray` The times at which to predict the positions. + .. note:: + The motion is approximated as linear and will be approximately correct + only for small temporal range and spatial region. In essence, the new + coordinates are calculated as: + :math: x_new = x_old + v * (t_new - t_old) + Returns ------- result : `astropy.coordinates.SkyCoord` A SkyCoord with the transformed locations. """ - np_times = np.array(times) + dt = np.array(times) + dt -= dt[0] # Predict locations in pixel space. - x_vals = trj.x + trj.vx * np_times - y_vals = trj.y + trj.vy * np_times + x_vals = trj.x + trj.vx * dt + y_vals = trj.y + trj.vy * dt result = wcs.pixel_to_world(x_vals, y_vals) return result