Add lane formation order parameter - #572
Conversation
Implements the order parameter Phi for lane formation in bidirectional flow. Two pedestrians count as sharing a lane when their distance perpendicular to the walking direction is below a threshold gamma. Each pedestrian is assigned an individual order parameter: the difference between the number of same- and opposite-direction lane mates, divided by their sum, squared. This is zero when both directions are equally represented and one when the lane holds a single direction. Phi is the mean of the individual values over all pedestrians. The measure was introduced for pedestrian dynamics by Nowak and Schadschneider (2012), adapting an order parameter from colloidal suspensions, and extended to continuous space by von Kruechten (2019). Walking direction is taken from a species DataFrame as produced by compute_species, rather than computed internally, since the order parameter needs neither Voronoi cells nor a measurement line. Users working with simulation output, where the direction is known at spawn time, can supply the same two columns directly. The perpendicular coordinate is assumed to be y.
schroedtert
left a comment
There was a problem hiding this comment.
Just a quick note, without any real reviewing: Plesse also add a the new function to the user guide
Exactly, otherwise review is difficult. |
Ok, I'll add it soon! |
|
Done. Added a Lane order parameter subsection under Spatial Analysis, using I'd assumed I could use I also noticed that |
Implements the lane formation order parameter from #507.
compute_lane_order_parameterreturns Phi per frame from a trajectory and aspecies DataFrame. Seven unit tests cover the hand-computable cases.
A few decisions I'd like your view on:
Placement. I put it in
spatial_analysis.py, next to the pairdistribution function, since it is also a pairwise structural measure and
fits none of density/speed/flow/profiles. Happy to move it.
Species as an argument. The walking direction is passed in rather than
computed internally, since the order parameter needs neither Voronoi cells
nor a measurement line. Users with simulation output can build the two
columns directly.
Self-counting. Each pedestrian counts itself as a lane mate, so N_L >= 1
and the denominator cannot vanish; an isolated pedestrian scores 1. Neither
Nowak and Schadschneider nor von Krüchten state this explicitly, but the
alternative divides by zero. Four of the tests pin this down.
Perpendicular coordinate. Hard-coded to y, i.e. the corridor is assumed
parallel to the x-axis.
Not included: the reduced order parameter (Nowak and Schadschneider Eq.
12), which corrects for the density dependence of Phi. The docstring warns
about this. It needs a numerical baseline over shuffled species labels, so
it seemed better as a separate PR.