Sorting¶
sorting ¶
sort_spatially ¶
sort_spatially(
trajectory: Trajectory,
sorting_settings: SortingSettings = SortingSettings(),
inplace: bool = True,
) -> Trajectory
Sorts the trajectory spatially. This is only useful for trajectories that describe a closed loop without intersections.
Parameters:
-
trajectory(Trajectory) –Trajectory to sort.
-
sorting_settings(SortingSettings, default:SortingSettings()) –Sorting settings.
-
inplace(bool, default:True) –Whether to sort the trajectory in-place. Defaults to True.
Returns:
-
Trajectory(Trajectory) –Sorted trajectory.
Source code in trajectopy\processing\sorting.py
divide_into_laps ¶
divide_into_laps(
trajectory: Trajectory,
sorting_settings: SortingSettings = SortingSettings(),
return_lap_indices: bool = False,
) -> Union[
List[Trajectory], Tuple[List[Trajectory], ndarray]
]
Divides the trajectory into laps. This is only useful for trajectories that describe a closed loop without intersections.
Parameters:
-
trajectory(Trajectory) –Trajectory to divide.
-
sorting_settings(SortingSettings, default:SortingSettings()) –Sorting settings.
-
return_lap_indices(bool, default:False) –Whether to return lap indices. Defaults to False.
Returns:
-
Union[List[Trajectory], Tuple[List[Trajectory], ndarray]]–List[Trajectory]: List of trajectories, each representing a lap.