physped.preprocessing package

Submodules

physped.preprocessing.trajectories module

physped.preprocessing.trajectories.add_trajectory_index(df: DataFrame, config: DictConfig) DataFrame[source]

Add a column with the observation/step numbers of each trajectory.

Parameters:
  • df – The DataFrame to add the trajectory step/observation to.

  • config – The configuration object.

Returns:

The DataFrame with the trajectory step/observation added.

physped.preprocessing.trajectories.compute_velocity_from_positions(df: DataFrame, config: DictConfig) DataFrame[source]

Add velocity to dataframe with trajectories.

This function calculates the velocity of each pedestrian in the input DataFrame based on their position data. The velocity is calculated using the Savitzky-Golay filter with a polynomial order of 1.

Parameters:

df – The input DataFrame with the trajectories.

Returns:

The trajectories DataFrame with velocity columns added.

physped.preprocessing.trajectories.preprocess_trajectories(trajectories: DataFrame, config: DictConfig) DataFrame[source]

Preprocess trajectories.

Parameters:

trajectories – The DataFrame with the trajectories.

Keyword Arguments:

config – The configuration object.

Returns:

The preprocessed DataFrame with the trajectories.

physped.preprocessing.trajectories.prune_short_trajectories(trajectories: DataFrame, config: DictConfig) DataFrame[source]

Remove short trajectories that are most likely noise.

The threshold for the minimum trajectory length is set in the configuration object under the key config.params.minimum_trajectory_length.

Parameters:
  • trajectories – The DataFrame containing the trajectories.

  • config – The configuration object.

Returns:

The DataFrame without short trajectories.

physped.preprocessing.trajectories.rename_columns(df: DataFrame, config: DictConfig) DataFrame[source]

Rename columns of a DataFrame.

Parameters:
  • df – The DataFrame to rename the columns of.

  • colnames – A dictionary with the old column names as keys and the new

  • values. (column names as)

Returns:

The DataFrame with the columns renamed.

physped.preprocessing.trajectories.save_preprocessed_trajectories(df: DataFrame, config: DictConfig) None[source]

Save the preprocessed trajectories to a file.

The file is saved if the configuration object has the key ‘save.preprocessed_trajectories’ set to True.

Parameters:
  • df – The DataFrame with the preprocessed trajectories.

  • config – The configuration object.

Returns:

The DataFrame with the preprocessed trajectories.

physped.preprocessing.trajectories.transform_fast_velocity_to_polar_coordinates(df: DataFrame, config: DictConfig) DataFrame[source]

Add columns with the velocity in polar coordinates to the DataFrame.

Requires the columns ‘uf’ and ‘vf’ for the velocity in x and y direction, respectively.

Parameters:

df – The trajectory DataFrame to add polar coordinates to.

Returns:

The DataFrame with additional columns ‘rf’ and ‘thetaf’ for the fast velocity in polar coordinates.

physped.preprocessing.trajectories.transform_slow_velocity_to_polar_coordinates(df: DataFrame, config: DictConfig) DataFrame[source]

Add columns with the velocity in polar coordinates to the DataFrame.

Requires the columns ‘us’ and ‘vs’ for the velocity in x and y direction, respectively.

Parameters:

df – The trajectory DataFrame to add polar coordinates to.

Returns:

The DataFrame with additional columns ‘rs’ and ‘thetas’ for the slow velocity in polar coordinates.

Module contents