Skip to content

Commit

Permalink
Merge pull request #450 from dirac-institute/fixes/simple
Browse files Browse the repository at this point in the history
Fixes/simple
  • Loading branch information
DinoBektesevic authored Feb 2, 2024
2 parents 10d61fb + e4a4a08 commit 21bc87a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/kbmod/trajectory_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/test_regression_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit 21bc87a

Please sign in to comment.