spkit.agg_angles

spkit.agg_angles(thetas, agg='mean')

Aggregating Angles (Directional Arrows) (thetas)

Aggregating Directional Arrows (thetas)

Converting polar coordinates to cartesian aaverging there and converting back to polar

Parameters:
thetas: list/array of theta (angles)
agg: str {‘mean’, ‘median’}, default=’mean’
  • method to use averaging, mean or median

Returns:
theta_avg: scalar, aggregated angle value

See also

show_compass

# Show Compass

Notes

#TODO

References

  • wikipedia -

Examples

>>> import numpy as np
>>> import spkit as sp
>>> np.random.seed(2)
>>> N=8
>>> # +1 -1, direction, top left
>>> thetas= np.arctan2(np.random.randn(N)+1, np.random.randn(N)-1)
>>> thetas_avg = sp.agg_angles(thetas, agg='mean')
>>> print(thetas_avg)

2.9525995459333507