Skip to content

Commit 91b4c10

Browse files
authored
Fix naming ofi compute_pair_distribution_function (#371)
1 parent 0de4831 commit 91b4c10

3 files changed

Lines changed: 18 additions & 16 deletions

File tree

notebooks/user_guide.ipynb

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2905,9 +2905,9 @@
29052905
"cell_type": "code",
29062906
"execution_count": null,
29072907
"metadata": {
2908-
"tags": [
2909-
"hide-input"
2910-
]
2908+
"tags": [
2909+
"hide-input"
2910+
]
29112911
},
29122912
"outputs": [],
29132913
"source": [
@@ -3544,7 +3544,8 @@
35443544
"cell_type": "markdown",
35453545
"metadata": {},
35463546
"source": [
3547-
"### Pair-distibution function (PDF)\n",
3547+
"### Pair-distribution function (PDF)\n",
3548+
"\n",
35483549
"This method is inspired from condensed matter description and used in the work of [Cordes et al. (2023)](https://doi.org/10.1093/pnasnexus/pgae120) following [Karamousas et al. (2014)](https://doi.org/10.1103/PhysRevLett.113.238701).\n",
35493550
"The pair-distribution function (PDF): \n",
35503551
"\n",
@@ -3563,10 +3564,10 @@
35633564
"metadata": {},
35643565
"outputs": [],
35653566
"source": [
3566-
"from pedpy import compute_pair_distibution_function\n",
3567+
"from pedpy import compute_pair_distribution_function\n",
35673568
"\n",
35683569
"# Compute pair distribution function\n",
3569-
"radius_bins, pair_distribution = compute_pair_distibution_function(\n",
3570+
"radius_bins, pair_distribution = compute_pair_distribution_function(\n",
35703571
" traj_data=traj, radius_bin_size=0.1, randomisation_stacking=1\n",
35713572
")"
35723573
]
@@ -3598,7 +3599,8 @@
35983599
"source": [
35993600
"#### Parameters of the PDF\n",
36003601
"\n",
3601-
"The function `compute_pair_distibution_function` has two main parameters:\n",
3602+
"The function `compute_pair_distribution_function` has two main parameters:\n",
3603+
"\n",
36023604
"- `radius_bin_size` is the size of the radius bins for which probability will be computed. On one hand a larger bin size results in smoother pdf but decreases the accuracy of the description, as more individuals can be detected in each bin. On the other hand, a smaller bin will increase the accuracy of the description but may lead to noisy or `Nan` values as each bin may not be populated (leading to invalid divisions). We suggest using a bin size value between 0.1 and 0.3 m as these values are close to order of magniture of a chest depth.\n",
36033605
"- `randomisation_stacking` is the number of time the data stacked before being shuffled in order to compute the probability $P_{Ni}$ of measuring given pair-wise distances for pedestrians that do not interact. Stacking the data multiple times helps harmonize the random positions more effectively, ensuring that the PDF converges to results that are independent of the randomization method."
36043606
]
@@ -3616,14 +3618,14 @@
36163618
"metadata": {},
36173619
"outputs": [],
36183620
"source": [
3619-
"from pedpy import compute_pair_distibution_function\n",
3621+
"from pedpy import compute_pair_distribution_function\n",
36203622
"\n",
36213623
"radius_bin_sizes = [0.05, 0.1, 0.25, 0.5]\n",
36223624
"\n",
36233625
"varying_radius_bin_sizes = [\n",
36243626
" (\n",
36253627
" i,\n",
3626-
" compute_pair_distibution_function(\n",
3628+
" compute_pair_distribution_function(\n",
36273629
" traj_data=traj,\n",
36283630
" radius_bin_size=radius_bin_size,\n",
36293631
" randomisation_stacking=1,\n",
@@ -3646,7 +3648,7 @@
36463648
"metadata": {},
36473649
"outputs": [],
36483650
"source": [
3649-
"from pedpy import compute_pair_distibution_function\n",
3651+
"from pedpy import compute_pair_distribution_function\n",
36503652
"from time import time\n",
36513653
"\n",
36523654
"randomisation_stackings = [1, 3, 5]\n",
@@ -3656,7 +3658,7 @@
36563658
"for i, randomisation_stacking in enumerate(randomisation_stackings):\n",
36573659
" begin_time = time()\n",
36583660
"\n",
3659-
" pdf = compute_pair_distibution_function(\n",
3661+
" pdf = compute_pair_distribution_function(\n",
36603662
" traj_data=traj,\n",
36613663
" radius_bin_size=0.15,\n",
36623664
" randomisation_stacking=randomisation_stacking,\n",
@@ -4428,7 +4430,7 @@
44284430
"name": "python",
44294431
"nbconvert_exporter": "python",
44304432
"pygments_lexer": "ipython3",
4431-
"version": "3.11.4"
4433+
"version": "3.12.4"
44324434
}
44334435
},
44344436
"nbformat": 4,

pedpy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
compute_speed_profile,
5555
get_grid_cells,
5656
)
57-
from .methods.spatial_analysis import compute_pair_distibution_function
57+
from .methods.spatial_analysis import compute_pair_distribution_function
5858
from .methods.speed_calculator import (
5959
SpeedCalculation,
6060
compute_individual_speed,
@@ -112,7 +112,7 @@
112112
"compute_time_distance_line",
113113
"get_invalid_trajectory",
114114
"is_trajectory_valid",
115-
"compute_pair_distibution_function",
115+
"compute_pair_distribution_function",
116116
"DensityMethod",
117117
"SpeedMethod",
118118
"compute_density_profile",

pedpy/methods/spatial_analysis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from pedpy.data.trajectory_data import TrajectoryData
1616

1717

18-
def compute_pair_distibution_function(
18+
def compute_pair_distribution_function(
1919
*,
2020
traj_data: TrajectoryData,
2121
radius_bin_size: float,
@@ -66,7 +66,7 @@ def compute_pair_distibution_function(
6666
## Create the bin for data
6767
radius_bins = np.arange(0, pairwise_dist_array.max(), radius_bin_size)
6868

69-
# Calculate pair distibution: g(r)
69+
# Calculate pair distribution: g(r)
7070
## Actual distribution
7171
pd_bins = pandas.cut(pairwise_dist_array, radius_bins)
7272
pd_bins_normalised = (pd_bins.value_counts().sort_index().to_numpy()) / len(

0 commit comments

Comments
 (0)