pedpy.methods.method_utils module#
Helper functions for the analysis methods.
- pedpy.methods.method_utils.compute_frame_range_in_area(*, traj_data: DataFrame, measurement_line: LineString, width: float) Tuple[DataFrame, Polygon][source]#
Compute the frame ranges for each pedestrian inside the measurement area.
Note
Only pedestrians passing the complete measurement area will be considered. Meaning they need to cross measurement_line and the line with the given offset in one go. If leaving the area between two lines through the same line will be ignored.
As passing we define the frame the pedestrians enter the area and then moves through the complete area without leaving it. Hence, doing a closed analysis of the movement area with several measuring ranges underestimates the actual movement time.
- Parameters
traj_data (pd.DataFrame) – trajectory data
measurement_line (shapely.LineString) – measurement line
width (float) – distance to the second measurement line
- Returns
DataFrame containing the columns – ‘ID’, ‘frame_start’, ‘frame_end’ and the created measurement area
- Return type
Tuple[DataFrame, Polygon]
- pedpy.methods.method_utils.compute_individual_voronoi_polygons(*, traj_data: DataFrame, geometry: Geometry, cut_off: Optional[Tuple[float, int]] = None, use_blind_points: bool = False) DataFrame[source]#
Compute the individual voronoi cells for each person and frame.
- Parameters
traj_data (pd.DataFrame) – trajectory data
geometry (Geometry) – bounding area, where pedestrian are supposed to be
cut_off (Tuple[float, int]) – radius of max extended voronoi cell (in m), number of linear segments in the approximation of circular arcs, needs to be divisible by 4!
use_blind_points (bool) – adds extra 4 points outside the geometry to also compute voronoi cells when less than 4 peds are in the geometry
- Returns
DataFrame containing the columns – ‘ID’, ‘frame’ and ‘individual voronoi’.
- Return type
DataFrame
- pedpy.methods.method_utils.compute_intersecting_polygons(individual_voronoi_data: DataFrame, measurement_area: Polygon) DataFrame[source]#
Compute the intersection of the voronoi cells with the measurement area.
- Parameters
individual_voronoi_data (pd.DataFrame) – individual voronoi data, needs to contain a column ‘individual voronoi’ which holds shapely.Polygon information
measurement_area (shapely.Polygon) –
- Returns
DataFrame containing the columns – ‘ID’, ‘frame’ and ‘intersection voronoi’.
- Return type
DataFrame
- pedpy.methods.method_utils.compute_neighbors(individual_voronoi_data: DataFrame) DataFrame[source]#
Compute the neighbors of each pedestrian based on the Voronoi cells.
Computation of the neighborhood of each pedestrian per frame. Every other pedestrian is a neighbor if the Voronoi cells of both pedestrian intersect and some point.
- Parameters
individual_voronoi_data (pd.DataFrame) – individual voronoi data, needs to contain a column ‘individual voronoi’, which holds shapely.Polygon information
- Returns
DataFrame containing the columns – ‘ID’, ‘frame’ and ‘neighbors’, where neighbors are a list of the neighbor’s IDs
- Return type
DataFrame
- pedpy.methods.method_utils.get_invalid_trajectory(*, traj: TrajectoryData, geometry: Geometry) DataFrame[source]#
Returns all trajectory data points outside the given geometry.
- Parameters
traj (TrajectoryData) – trajectory data
geometry (Geometry) – geometry
- Returns
DataFrame showing all data points outside the given geometry
- Return type
DataFrame
- pedpy.methods.method_utils.is_trajectory_valid(*, traj: TrajectoryData, geometry: Geometry) bool[source]#
Checks if all trajectory data points lie within the given geometry.
- Parameters
traj (TrajectoryData) – trajectory data
geometry (Geometry) – geometry
- Returns
All points lie within geometry
- Return type