astropy.stats.circstats.circmoment(data, p=1.0, centered=False, axis=None, weights=None)[source]

Computes the p-th trigonometric circular moment for an array of circular data.

datandarray or Quantity

Array of circular (directional) data, which is assumed to be in radians whenever data is numpy.ndarray.

pfloat, optional

Order of the circular moment.

centeredbool, optional

If True, central circular moments are computed. Default value is False.

axisint, optional

Axis along which circular moments are computed. The default is to compute the circular moment of the flattened array.

weightsnumpy.ndarray, optional

In case of grouped data, the i-th element of weights represents a weighting factor for each group such that sum(weights, axis) equals the number of observations. See [1], remark 1.4, page 22, for detailed explanation.

circmomentndarray or Quantity

The first and second elements correspond to the direction and length of the p-th circular moment, respectively.



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. <>


>>> import numpy as np
>>> from astropy.stats import circmoment
>>> from astropy import units as u
>>> data = np.array([51, 67, 40, 109, 31, 358])*u.deg
>>> circmoment(data, p=2) 
(<Quantity 90.99263082432564 deg>, <Quantity 0.48004283892950717>)