How to use
lightkurve’s river plot function¶
When we are looking for periodic signals, sometimes it can be useful to see how they evolve overtime. You can do that using the
plot_river on a
FoldedLightCurve object. Let’s look at how to do that now
% load_ext autoreload % autoreload 2
import lightkurve as lk
The first thing we are going to do is download some data. We’ll use the target
KIC 6185476, which is also known as
KOI-227. This object exhibits strong Transit Timing Variations (TTVs), where the planet candidate changes its transit time, and is not exactly periodic.
We can use
search_lightcurvefile function to get all of the light curves from MAST and stitch them together.
lc = lk.search_lightcurvefile('KIC 6185476').download_all().PDCSAP_FLUX.stitch()
<matplotlib.axes._subplots.AxesSubplot at 0x12311aa58>
When we plot the data, we see that there is a long term trend, likely from starspots. We can remove this with a simple Savitzky-Golay filter using
clc = lc.flatten(21) clc.plot()
<matplotlib.axes._subplots.AxesSubplot at 0x1231a3630>
The light curve is now flat, let’s fold the light curve and plot it.
# Period and t0 from NASA Exoplanet Archive p, t0 = 17.660114, 136.57258
folded_lc = clc.fold(p, t0) folded_lc.scatter()
<matplotlib.axes._subplots.AxesSubplot at 0x127a37f60>
It looks like there is a concentration of points that are around phase of
0, but they don’t seem to line up nicely. Let’s use
river to plot the light curve in a more legible way.
<matplotlib.axes._subplots.AxesSubplot at 0x12b0532e8>
The river shows the same plot as the
fold method, but each time the light curve is folded, a new row is started in the plot. The colorbar then shows the flux in each part of the light curve.
In this case we see a beautiful trend as the planet candidate orbit changes. In some cases, the signal won’t be this obvious. We can also use the
river method to bin in time to increase the signal to noise in any bin.
<matplotlib.axes._subplots.AxesSubplot at 0x12a911ef0>
Finally we can also use
plot_river to look at the folded light curve in terms of standard deviation. This is useful when looking for signals that are of high significance.
<matplotlib.axes._subplots.AxesSubplot at 0x124634a20>
We see in the above river plot that there is a signal around phase zero (our planet candidate) that is always \(< -3\sigma\) from the mean, showing that it is a significant detection.