- astropy.stats.circstd(data, axis=None, weights=None, method='angular')¶
Computes the circular standard deviation of an array of circular data.
Two methods are implemented: ‘angular’ and ‘circular’. The former is defined as sqrt(2 * (1 - R)) and it is bounded in [0, 2*Pi]. The latter is defined as sqrt(-2 * ln(R)) and it is bounded in [0, inf].
Following ‘CircStat’ the default method used to obtain the standard deviation is ‘angular’.
Array of circular (directional) data, which is assumed to be in radians whenever
numpy.ndarray. If quantity, must be dimensionless.
Axis along which circular variances are computed. The default is to compute the variance of the flattened array.
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.
The method used to estimate the standard deviation:
‘angular’ : obtains the angular deviation
‘circular’ : obtains the circular deviation
P. Berens. “CircStat: A MATLAB Toolbox for Circular Statistics”. Journal of Statistical Software, vol 31, issue 10, 2009.
C. Agostinelli, U. Lund. “Circular Statistics from ‘Topics in Circular Statistics (2001)’”. 2015. <https://cran.r-project.org/web/packages/CircStats/CircStats.pdf>
S. R. Jammalamadaka, A. SenGupta. “Topics in Circular Statistics”. Series on Multivariate Analysis, Vol. 5, 2001.
>>> import numpy as np >>> from astropy.stats import circstd >>> from astropy import units as u >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg >>> circstd(data) <Quantity 0.57195022>
Alternatively, using the ‘circular’ method:
>>> import numpy as np >>> from astropy.stats import circstd >>> from astropy import units as u >>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg >>> circstd(data, method='circular') <Quantity 0.59766999>