Repository navigation
Add spatial randomization and rate-of-approach pair distribution functions - #598
Open
M-Colley wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #327
Fixes #333
Extends
pedpy.methods.spatial_analysis(and top-levelpedpyexports) with uniform spatial randomization for static/semi-static crowds and rate-of-approach pair-distribution analysis:PairNormalizationMethod(TIME_RANDOMIZATIONdefault,SPATIAL_RANDOMIZATION) and optionalwalkable_area/seedparameters tocompute_pair_distribution_function. UnderSPATIAL_RANDOMIZATION, non-interacting reference positions are sampled uniformly insidewalkable_area.polygon(respecting interior obstacles/holes), avoiding the degenerate self-overlap of frame shuffling in dense static or semi-static crowds.compute_approach_rate_pair_distributionevaluating pairwise approach rate {ij} = -\frac{dr_{ij}}{dt} = -\frac{(\vec{x}_i - \vec{x}_j) \cdot (\vec{v}_i - \vec{v}_j)}{|\vec{x}i - \vec{x}j|}$ following Karamouzas et al. (2014,doi:10.1103/PhysRevLett.113.238701) and Cordes et al. (2024,doi:10.1093/pnasnexus/pgae120), supporting both the 1D distribution (v) = P(v) / P{\mathrm{NI}}(v)$ and the 2D distance / approach-rate distribution (r, v) = P(r, v) / P{\mathrm{NI}}(r, v)$ with eitherTIME_RANDOMIZATIONorSPATIAL_RANDOMIZATION.warnings.filterwarnings(default)resets withnp.errstate+ explicit zero-bin warning checks so caller warning filters are preserved.