Skip to content

Commit 30c17aa

Browse files
committed
Fix minor documentation issues
- Add explanation of columns in returned data frames - Fix formatting of docstring for proper display on website - Fix wrong column name in return of compute_individual_voronoi_polygons
1 parent 89082ed commit 30c17aa

7 files changed

Lines changed: 36 additions & 26 deletions

File tree

pedpy/methods/acceleration_calculator.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Module containing functions to compute accelerations."""
22

3-
from typing import Optional, Tuple
3+
from typing import Optional
44

55
import numpy as np
66
import numpy.typing as npt
@@ -112,8 +112,8 @@ def compute_individual_acceleration(
112112
113113
Returns:
114114
DataFrame containing the columns 'id', 'frame', and 'acceleration' in
115-
'm/s^2', 'a_x' and 'a_y' with the speed components in x and y direction
116-
if :code:`compute_acceleration_components` is True
115+
:math:`m/s^2`, 'a_x' and 'a_y' with the acceleration components
116+
in x and y direction if :code:`compute_acceleration_components` is True
117117
"""
118118
df_movement = _compute_individual_movement_acceleration(
119119
traj_data=traj_data,
@@ -136,7 +136,7 @@ def compute_mean_acceleration_per_frame(
136136
traj_data: TrajectoryData,
137137
individual_acceleration: pd.DataFrame,
138138
measurement_area: MeasurementArea,
139-
) -> Tuple[pd.DataFrame, pd.DataFrame]:
139+
) -> pd.DataFrame:
140140
r"""Compute mean acceleration per frame inside a given measurement area.
141141
142142
Computes the mean acceleration :math:`a_{mean}(t)` inside the measurement
@@ -166,7 +166,8 @@ def compute_mean_acceleration_per_frame(
166166
acceleration is computed
167167
168168
Returns:
169-
DataFrame containing the columns 'frame' and 'acceleration' in 'm/s^2'
169+
DataFrame containing the columns 'frame' and 'acceleration' in
170+
:math:`m/s^2`
170171
"""
171172
if len(individual_acceleration.index) < len(traj_data.data.index):
172173
raise AccelerationError(
@@ -240,7 +241,8 @@ def compute_voronoi_acceleration(
240241
acceleration should be computed
241242
242243
Returns:
243-
DataFrame containing the columns 'frame' and 'acceleration' in 'm/s^2'
244+
DataFrame containing the columns 'frame' and 'acceleration' in
245+
:math:`m/s^2`
244246
"""
245247
if len(individual_acceleration.index) < len(
246248
individual_voronoi_intersection.index

pedpy/methods/density_calculator.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@ def compute_voronoi_density(
113113
Returns:
114114
DataFrame containing the columns 'id' and 'density' in :math:`1/m^2`,
115115
DataFrame containing the columns: 'id', 'frame', 'polygon' which
116-
contains the Voronoi polygon of the pedestrian, 'intersection' which
117-
contains the intersection area of the Voronoi polygon and the given
118-
measurement area.
116+
contains the Voronoi polygon of the pedestrian, 'density' in
117+
:math:`1/m^2` which contains the individual density of the pedestrian,
118+
'intersection' which contains the intersection area of the Voronoi
119+
polygon and the given measurement area.
119120
120121
"""
121122
df_intersecting = compute_intersecting_polygons(
@@ -265,7 +266,10 @@ def compute_line_density(
265266
the species of every pedestrian intersecting the line,
266267
result from :func:`~speed_calculator.compute_species`
267268
Returns:
268-
Dataframe containing columns 'frame', 'p_sp+1', 'p_sp-1', 'density'
269+
Dataframe containing columns 'frame', 'p_sp+1' which contains the
270+
density in :math:`1/m^2` for species +1, 'p_sp-1' which contains the
271+
density in :math:`1/m^2` for species -1, 'density' which contains the
272+
density at the line in :math:`1/m^2`.
269273
"""
270274
if not is_species_valid(
271275
species=species,

pedpy/methods/flow_calculator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ def compute_line_flow(
316316
species of every pedestrian intersecting the line,
317317
result from :func:`~speed_calculator.compute_species`
318318
Returns:
319-
Dataframe containing columns 'frame', 'j_sp+1', 'j_sp-1', 'flow'
319+
Dataframe containing columns 'frame', 'j_sp+1' which contains the flow
320+
in :math:`1/s` for species +1, 'j_sp-1' which contains the flow
321+
in :math:`1/s` for species -1, 'flow' which contains the total flow at
322+
the line in :math:`1/s`.
320323
"""
321324
_validate_inputs(
322325
individual_voronoi_polygons, measurement_line, individual_speed, species

pedpy/methods/method_utils.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,8 @@ def compute_time_distance_line(
483483
measurement_line (MeasurementLine): line which is crossed
484484
485485
Returns:
486-
DataFrame containing 'id', 'frame', 'time' (seconds until
487-
crossing), and 'distance' (meters to measurement line)
486+
DataFrame containing 'id', 'frame', 'distance' (meters to measurement
487+
line), and 'time' (seconds until crossing)
488488
"""
489489
df_distance_time = traj_data.data[[ID_COL, FRAME_COL, POINT_COL]].copy(
490490
deep=True
@@ -575,7 +575,7 @@ def compute_individual_voronoi_polygons(
575575
576576
Returns:
577577
DataFrame containing the columns 'id', 'frame','polygon' (
578-
:class:`shapely.Polygon`), and 'individual_density' in :math:`1/m^2`.
578+
:class:`shapely.Polygon`), and 'density' in :math:`1/m^2`.
579579
"""
580580
dfs = []
581581

@@ -1434,11 +1434,10 @@ def is_individual_speed_valid(
14341434
measurement_line (MeasurementLine): measurement line
14351435
14361436
Returns:
1437-
DATA_CORRECT if all needed data is provided
1438-
by the individual speed dataframe,
1439-
COLUMN_MISSING if there is a column missing,
1440-
ENTRY_MISSING if there is no matching entry
1441-
for a frame where polygon and line intersect.
1437+
DATA_CORRECT if all needed data is provided by the individual speed
1438+
dataframe, COLUMN_MISSING if there is a column missing, ENTRY_MISSING
1439+
if there is no matching entry for a frame where polygon and line
1440+
intersect.
14421441
"""
14431442
if not all(
14441443
column in individual_speed.columns

pedpy/methods/profile_calculator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,8 +920,8 @@ def compute_grid_cell_polygon_intersection_area(
920920
921921
Returns:
922922
Tuple containing first the grid cell-polygon intersection areas, and
923-
second the reordered data by 'frame', which needs to be used in
924-
the next steps.
923+
second the reordered data by 'frame', which needs to be used in
924+
the next steps.
925925
"""
926926
(
927927
grid_intersections_area,

pedpy/methods/spatial_analysis.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ def compute_pair_distribution_function(
4545
4646
4747
Returns:
48-
Tuple[np.ndarray, np.ndarray]: A tuple of two numpy arrays. The first
49-
array contains the bin edges (excluding the first bin edge), and
50-
the second array contains the values of the pair-distribution
51-
function :math:`g(r)` for each bin.
48+
A tuple of two numpy arrays. The first array contains the bin edges
49+
(excluding the first bin edge), and the second array contains the values
50+
of the pair-distribution function :math:`g(r)` for each bin.
5251
"""
5352
data_df = traj_data.data
5453

pedpy/methods/speed_calculator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,10 @@ def compute_line_speed(
560560
the species of every pedestrian intersecting the line,
561561
result from :func:`~speed_calculator.compute_species`
562562
Returns:
563-
Dataframe containing columns 'frame', 's_sp+1', 's_sp-1', 'speed'
563+
Dataframe containing columns 'frame', 's_sp+1' which contains the
564+
speed in :math:`m/s` for species +1, 's_sp-1' which contains the
565+
speed in :math:`m/s` for species -1, 'speed' which contains the
566+
density at the line in :math:`1/m^2`.
564567
"""
565568
_validate_inputs(
566569
individual_voronoi_polygons, measurement_line, individual_speed, species

0 commit comments

Comments
 (0)