Skip to content

Add a neighbour cutoff to compute_individual_distances #585

Open

Description

@chraibi

compute_individual_distances (method_utils, added in #279) builds the full pair matrix of every frame with a self-merge on frame, and compute_avoidance does the same for the velocity pairs. That is N² rows per frame: for the Waiting trajectories of Cordes et al. 2024 (506 pedestrians per frame) it is 255,000 rows per frame, and the whole recording cannot be processed in one call. Running it in chunks of a dozen frames works but should not be the user's job.

The intrusion number only needs pairs within 3 * r_soc; the avoidance number has no cutoff in the paper, but a generous radius still removes most pairs in a large crowd. A max_distance argument on compute_individual_distances, backed by a per-frame spatial query (shapely STRtree or scipy.spatial.cKDTree.query_pairs), would bound the matrix. compute_intrusion would pass 3 * r_soc; compute_avoidance could expose the cutoff as an optional argument and default to all pairs to stay faithful to the paper.

Acceptance: results identical to the current all-pairs version for all pairs inside the cutoff (regression test on the user-guide data), and the six Waiting runs of the paper's supplementary data processable in one call each.

Follow-up to #279.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions