seeing-things/track

Alignment not ordering positions optimally

Closed this issue · 1 comments

align is supposed to visit a set of locations on the sky in a (nearly) optimum order, using a travelling salesman solver. I just ran align after some recent upgrades and it very clearly was not following the optimum path. It performed several meridian flips when only one meridian crossing should be necessary.

  • Investigate and fix.
  • Write a unit test for this functionality.

Related to this: Right now I'm using ortools or something from Google, however I recently learned that the networkx package may have similar functionality in case I need a replacement.

I root caused the bad behavior to the dtype of the distance_matrix Numpy array in tsp.solve_route(). The dtype of the array was left to the default which is a floating point type, but Google's OR-Tools expects integer distances. Apparently some older version of OR-Tools was able to coerce the floats to integers, but now passing a floating point distance (even if the value stored in the float is an integer) results in solutions that are clearly suboptimal.