The Lomb-Scargle periodogram was developed by Lomb [R255] and further
extended by Scargle [R256] to find, and test the significance of weak
periodic signals with uneven temporal sampling.

When normalize is False (default) the computed periodogram
is unnormalized, it takes the value (A**2)*N/4 for a harmonic
signal with amplitude A for sufficiently large N.

When normalize is True the computed periodogram is is normalized by
the residuals of the data around a constant reference model (at zero).

Input arrays should be one-dimensional and will be cast to float64.

Parameters:

x : array_like

Sample times.

y : array_like

Measurement values.

freqs : array_like

Angular frequencies for output periodogram.

precenter : bool, optional

Pre-center amplitudes by subtracting the mean.

normalize : bool, optional

Compute normalized periodogram.

Returns:

pgram : array_like

Lomb-Scargle periodogram.

Raises:

ValueError

If the input arrays x and y do not have the same shape.

Notes

This subroutine calculates the periodogram using a slightly
modified algorithm due to Townsend [R257] which allows the
periodogram to be calculated using only a single pass through
the input arrays for each frequency.

The algorithm running time scales roughly as O(x * freqs) or O(N^2)
for a large number of samples and frequencies.