The Lomb-Scargle periodogram is a frequency spectrum estimation method that fits sines to data, and it is frequently used with unevenly sampled data. The method is named after Nicholas R. Lomb and Jeffrey D. Scargle. The algorithm was published around 1976 and has been improved since then. Scargle introduced a time delay parameter, which separates the sine and cosine waveforms. The following equations define the time delay (6.7) and periodogram (6.8).
The imports are as follows:
from scipy import signal import numpy as np import matplotlib.pyplot as plt import dautil as dl import statsmodels.api as sm from IPython.display import HTML
Load the sunspots data as follows:
df = sm.datasets.sunspots.load_pandas().data sunspots = df['SUNACTIVITY'].values size = len(sunspots) t = np.linspace(-2 * np.pi, 2 * np.pi, size) sine = dl.ts.sine_like(sunspots) f = np.linspace(0.01, 2, 10 * size)
Plot a sine waveform as follows:
sp = dl.plotting.Subplotter(2, 2...