circmean(data, axis=None, weights=None)¶
Computes the circular mean angle of an array of circular data.
- datanumpy.ndarray or Quantity
Array of circular (directional) data, which is assumed to be in radians whenever
- axisint, optional
Axis along which circular means are computed. The default is to compute the mean of the flattened array.
- weightsnumpy.ndarray, optional
In case of grouped data, the i-th element of
weightsrepresents a weighting factor for each group such that
sum(weights, axis)equals the number of observations. See , remark 1.4, page 22, for detailed explanation.
- circmeannumpy.ndarray or Quantity
S. R. Jammalamadaka, A. SenGupta. “Topics in Circular Statistics”. Series on Multivariate Analysis, Vol. 5, 2001.
C. Agostinelli, U. Lund. “Circular Statistics from ‘Topics in Circular Statistics (2001)’”. 2015. <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>
>>> import numpy as np >>> from astropy.stats import circmean >>> from astropy import units as u >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg >>> circmean(data) <Quantity 48.62718088722989 deg>