What are Periodogram objects?#

Lightkurve has a class specifically for dealing with periodograms of time series data. This can be useful for finding the periods of variable stars. Below is a quick example of how to find the period of an eclipsing binary star.

First, let’s grab a light curve file from the Kepler data archive. We’ll use the object named KIC 10264202, which is an eclipsing binary observed by the original Kepler mission. We’re just going to use one quarter of data for this demo.

from lightkurve import search_lightcurve
lc = search_lightcurve('KIC 10264202', author="Kepler", quarter=10, cadence="long").download().remove_nans()

Let’s plot the light curve to see what we’re working with.

%matplotlib inline

This light curve looks like it has some structure in it! Let’s use the periodogram class to find the rotation period. You can create a periodogram from the KeplerLightCurve object by using the to_periodogram method.

pg = lc.to_periodogram(oversample_factor=1)

Now we can plot the periodogram in the same way that we plot the original light curve.


This looks like there is a huge signal at a certain frequency! Let’s plot it in period space, so that we can see what period the oscillation is occurring at.

pg.plot(view='period', scale='log');

This looks like a very fast period. We can access the full period and power data as follows:

$[93.401949,~46.700974,~31.133983,~\dots,~0.040911936,~0.040894023,~0.040876126] \; \mathrm{d}$
$[3.0812345,~4.0491002,~1.1168632,~\dots,~0.38587616,~0.17210997,~0.42668004] \; \mathrm{\frac{e^{-}}{s}}$

In this case we simply want to know the period that corresponds to the highest peak in the periodogram. We can directly access this value using the convenient period_at_max_power property:

$0.25873116 \; \mathrm{d}$

We can then use this period to fold our light curve:


Oops, the eclipses do not line up nicely. This does not look like the correct period of this eclipsing binary!

As is quite common for eclipsing binaries with deep secondary eclipses, we have found a harmonic of the period of the eclipsing binary. Let’s plot it again with quadruple the period.

lc.fold(period=4*pg.period_at_max_power, wrap_phase=0.2).scatter();

That looks better, but the eclipses still don’t seem to line up as well as they could.

Let’s try to get a more precise period by increasing the number of points in our periodogram using the oversample_factor parameter and by constraining the range of the period value:

import astropy.units as u
pg = lc.to_periodogram(minimum_period=0.9*u.day, maximum_period=1.2*u.day, oversample_factor=10)
$1.0350972 \; \mathrm{d}$
lc.fold(period=pg.period_at_max_power, wrap_phase=0.2).scatter();

This has improved our fit. It looks like this eclipsing binary has a period of approximately 1 day.