*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 using *lightkurve*.

Firstly lets grab a light curve file from mast. We’ll use KIC 10030943, which is an eclipsing binary observed by the original Kepler mission. We’re just going to use one quarter for this demo.

```
[1]:
```

```
import astropy.units as u # We'll need this later.
```

```
[2]:
```

```
# Obtain the data
from lightkurve import search_lightcurvefile
lc = search_lightcurvefile('10264202', quarter=10).download().PDCSAP_FLUX.remove_nans()
```

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

```
[3]:
```

```
lc.scatter();
```

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

method.

```
[4]:
```

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

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

```
[5]:
```

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

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.

```
[6]:
```

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

This looks like a very fast period. Let’s find the period with the highest power and fold out light curve.

```
[7]:
```

```
period = pg.period_at_max_power
print('Best period: {}'.format(period))
lc.fold(period.value).scatter();
```

```
Best period: 0.2587311606278735 d
```

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.

```
[8]:
```

```
period = pg.period_at_max_power * 4
print('Best period: {}'.format(period))
lc.fold(period.value).scatter();
```

```
Best period: 1.034924642511494 d
```

It looks like we could probably get a better fit than this. Let’s try increasing the number of points in our periodogram.

```
[9]:
```

```
# I've set min_period and max_period to slightly reduce the computational time
pg = lc.to_periodogram(min_period=0.9*u.day, max_period=1.2*u.day, oversample_factor=10)
```

```
[10]:
```

```
period = pg.period_at_max_power
print('Best period: {}'.format(period))
lc.fold(period.value).scatter();
```

```
Best period: 1.0350971683913832 d
```

That’s improved our fit! It looks like this eclipsing binary has a period of approximately 1 day.

Created with ♥ by the Lightkurve developers. Join us on GitHub.