We present a generalised estimator for the autocorrelation function, S-ACF,
which is an extended version of the standard estimator of the autocorrelation
function (ACF). S-ACF is a versatile definition that can robustly and
efficiently extract periodicity and signal shape information from a time
series, independent of the time sampling and with minimal assumptions about the
underlying process. Calculating the autocorrelation of irregularly sampled time
series becomes possible by generalising the lag of the standard estimator of
the ACF to a real parameter and introducing the notion of selection and weight
functions. We show that the S-ACF reduces to the standard ACF estimator for
regularly sampled time series. Using a large number of synthetic time series we
demonstrate that the performance of the S-ACF is as good or better than
commonly used Gaussian and rectangular kernel estimators, and is comparable to
a combination of interpolation and the standard estimator. We apply the S-ACF
to astrophysical data by extracting rotation periods for the spotted star KIC
5110407, and compare our results to Gaussian process (GP) regression and
Lomb-Scargle (LS) periodograms. We find that the S-ACF periods typically agree
better with those from GP regression than from LS periodograms, especially in
cases where there is evolution in the signal shape. The S-ACF has a wide range
of potential applications and should be useful in quantitative science
disciplines where irregularly sampled time series occur. A Python
implementation of the S-ACF is available under the MIT license