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

```
[1]:
```

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

```
[2]:
```

```
%matplotlib inline
lc.scatter();
```

```
[2]:
```

```
<AxesSubplot:xlabel='Time - 2454833 [BKJD days]', ylabel='Flux [$\\mathrm{e^{-}\\,s^{-1}}$]'>
```

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.

```
[3]:
```

```
pg = lc.to_periodogram(oversample_factor=1)
```

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

```
[4]:
```

```
pg.plot();
```

```
[4]:
```

```
<AxesSubplot:xlabel='Frequency [$\\mathrm{\\frac{1}{d}}$]', ylabel='Power [$\\mathrm{\\frac{e^{-}}{s}}$]'>
```

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.

```
[5]:
```

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

```
[5]:
```

```
<AxesSubplot:xlabel='Period [$\\mathrm{d}$]', ylabel='Power [$\\mathrm{\\frac{e^{-}}{s}}$]'>
```

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

```
[6]:
```

```
pg.period
```

```
[6]:
```

```
[7]:
```

```
pg.power
```

```
[7]:
```

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:

```
[8]:
```

```
pg.period_at_max_power
```

```
[8]:
```

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

```
[9]:
```

```
lc.fold(period=pg.period_at_max_power).scatter();
```

```
[9]:
```

```
<AxesSubplot:xlabel='Phase [JD]', ylabel='Flux [$\\mathrm{e^{-}\\,s^{-1}}$]'>
```

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.

```
[10]:
```

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

```
[10]:
```

```
<AxesSubplot:xlabel='Phase [JD]', ylabel='Flux [$\\mathrm{e^{-}\\,s^{-1}}$]'>
```

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:

```
[11]:
```

```
import astropy.units as u
pg = lc.to_periodogram(minimum_period=0.9*u.day, maximum_period=1.2*u.day, oversample_factor=10)
pg.period_at_max_power
```

```
[11]:
```

```
[12]:
```

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

```
[12]:
```

```
<AxesSubplot:xlabel='Phase [JD]', ylabel='Flux [$\\mathrm{e^{-}\\,s^{-1}}$]'>
```

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