compute_features
Compute track features.
This module contains functions computing different features which will be used as input of the deep-learning network (for both training and testing).
- compute_features.compute_all_features(track_df)
Computes all features necessary for the inputs of the deep-learning network. The features are directly added to the dataframe of trajectories.
- Parameters:
track_df (pd.DataFrame) – All trajectories as a dataframe with keys: x, y, frame, data_folder, track_id.
- compute_features.compute_angles(displ_x, displ_y)
Computes angles using two consecutive displacements using x and y 1D-displacements.
- Parameters:
displ_x (np.array) – x displacements of a given track.
displ_y (np.array) – y displacements of a given track.
- Returns:
Angles computed along the track.
- Return type:
np.array
- compute_features.compute_displacements(track, delta)
Computes x and y displacements between each pair of points i and i+delta.
- Parameters:
track (pd.DataFrame) – Given track where displacements will be computed along its entire length.
delta (int) – Lag interval between frames.
- Returns:
Computed (x displacements, y displacements) along the track.
- Return type:
(np.array, np.array)
- compute_features.compute_dist(displ_x, displ_y)
Computes distances based on x and y displacements.
- Parameters:
displ_x (np.array) – x displacements of a given track.
displ_y (np.array) – y displacements of a given track.
- Returns:
Computed distances along the track.
- Return type:
np.array
- compute_features.compute_mean_distances(track, delta, num=1)
Computes a mean of distances from point i-num to point i+num.
- Parameters:
track (pd.DataFrame) – Given track where mean of distances will be computed along its entire length.
delta (int) – Lag interval between frames while measuring the displacements.
num (int) – Number of neighboring point for the average. [Defaults: +/- 1 close neighbors]
- Returns:
The mean of distances.
- Return type:
np.array