# mmgrobis/Rotation_v_Polarization

R, Python, and Julia functions for calculating global rotation and global polarization for a group of animals, given their x-, y-coordinates and orientations.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
 Failed to load latest commit information. CODE_OF_CONDUCT.md CONTRIBUTING.md README.md Rot_v_Pol.R Rot_v_Pol.jl Rot_v_Pol.py

# Calculating global rotation and polarization

The R, Python, and Julia code in this repository will calculate global rotation and global polarization for a group of animals, given their x-, y-coordinates and orientations. Global polarization describes the alignment within the group. Global rotation describes movement around the center of the group's mass. Equations for global rotation and polarization come from Couzin et al. 2002 (Journal of Theoretical Biology, ) with empirical validation in Tunstrøm et al. 2013 (PLoS Computational Biology). The equations are given below:

### Group rotation:

is an individual's unit vector orientation, consisting of the x- and y-components. The components can range from -1 (left/down) to +1 (right/up).

is the unit vector from the group centroid pointing towards individual i.

Group polarization and rotation each take on values between 0 and 1. Three distinct group "states" exist and are well-characterized by different combinations of global polarization and rotation:

• The swarm state (rotation < 0.35, polarization < 0.35) consists of disordered movement.
• The milling state (rotation > 0.65, polarization < 0.35) consists of rotation around the group center, i.e. a torus configuration.
• The polarized state (rotation < 0.35, polarization > 0.65) consists of directed movement.