knn_for_traj