pedpy.methods.velocity_calculator module#

Module containing functions to compute velocities.

pedpy.methods.velocity_calculator.compute_individual_velocity(*, traj_data: DataFrame, frame_rate: float, frame_step: int, movement_direction: Optional[ndarray[Any, dtype[float64]]] = None, x_y_components: bool = True) DataFrame[source]#

Compute the individual velocity for each pedestrian.

Note: when using a movement direction the velocity may be negative!

Parameters
  • traj_data (TrajectoryData) – trajectory data

  • frame_rate (float) – frame rate of the trajectory

  • frame_step (int) – gives the size of time interval for calculating the velocity.

  • movement_direction (np.ndarray) – main movement direction on which the actual movement is projected (default: None, when the un-projected movement should be used)

  • x_y_components (bool) – compute the x and y components of the speed

Returns

DataFrame containing the columns ‘ID’, ‘frame’, and ‘speed’ in m/s, ‘v_x’ and ‘v_y’ with the speed components in x and y direction if x_y_components is True

Return type

DataFrame

pedpy.methods.velocity_calculator.compute_mean_velocity_per_frame(*, traj_data: DataFrame, individual_velocity: DataFrame, measurement_area: Polygon) Tuple[DataFrame, DataFrame][source]#

Compute mean velocity per frame.

Note: when using a movement direction the velocity may be negative!

Parameters
  • traj_data (pd.DataFrame) – trajectory data

  • individual_velocity (pd.DataFrame) – individual velocity data

  • measurement_area (shapely.Polygon) – measurement area for which the velocity is computed

Returns

DataFrame containing the columns ‘frame’ and ‘speed’

Return type

Tuple[DataFrame, DataFrame]

pedpy.methods.velocity_calculator.compute_passing_speed(*, frames_in_area: DataFrame, frame_rate: float, distance: float) DataFrame[source]#

Compute the individual speed of the pedestrian who pass the area.

Parameters
  • frames_in_area (pd.DataFrame) – information for each pedestrian in the area, need to contain the following columns: ‘ID’, ‘start’, ‘end’, ‘frame_start’, ‘frame_end’

  • frame_rate (float) – frame rate of the trajectory

  • distance (float) – distance between the two measurement lines

Returns

DataFrame containing the columns – ‘ID’, ‘speed’ which is the speed in m/s

Return type

DataFrame

pedpy.methods.velocity_calculator.compute_voronoi_velocity(*, traj_data: DataFrame, individual_velocity: DataFrame, individual_voronoi_intersection: DataFrame, measurement_area: Polygon) Series[source]#

Compute the voronoi velocity per frame.

Note: when using a movement direction the velocity may be negative!

Parameters
  • traj_data (pd.DataFrame) – trajectory data

  • individual_velocity (pd.DataFrame) – individual velocity data

  • individual_voronoi_intersection (pd.DataFrame) – intersections of the individual with the measurement area of each pedestrian

  • measurement_area (shapely.Polygon) – area in which the voronoi velocity should be computed

Returns

DataFrame containing the columns ‘frame’ and ‘voronoi speed’

Return type

Series