How to combine lightcurves from different Kepler quarters¶
The Kepler mission took 17 quarters of continuous observations on the
same targets. For applications such as finding long period planets or
asteroseismology it is useful to be able to turn these quarters into one
long light curve. We can do this using lightkurve’s
The append function is called by doing
stitched_lc = lc1.append(lc2)
It works in the same way as appending a list in python.
Below is an example of how to stitch together all the quarters for the exoplanet target Kepler-8b. (Note: We’ll use the jupyter notebook magic command ``%%capture`` to supress the output for the cell so that it doesn’t print a long download message)
from lightkurve import search_lightcurvefile, log target = 'Kepler-8b'
log.setLevel("WARNING") # Ignore download messages lc = search_lightcurvefile(target, quarter=1).download().PDCSAP_FLUX for q in range(2,17): lc = lc.append(search_lightcurvefile(target, quarter=q).download().PDCSAP_FLUX)
Above we have created a
KeplerLightCurve object from the first
quarter of the data, choosing to use the PDCSAP_FLUX. Then we have
looped through all the quarters, appending each new light curve to the
fist one. We can plot this new
KeplerLightCurve using the
function (and all the other functions from previous tutorials will work
Unfortunately, as the light fell on difference pixels in each quarter
and the spacecraft changed temperature during observation, these light
curves all have difference offsets. We can remove them by normalizing
each light curve before we append it. We can do this with the lightkurve
lc = search_lightcurvefile(target, quarter=1).download().PDCSAP_FLUX.normalize() for q in range(2,8): lc = lc.append(search_lightcurvefile(target, quarter=q).download().PDCSAP_FLUX.normalize())
Now that the light curves are normalized they don’t have significant
offsets. However, there are clear long term trends in some of the early
quarters of the data. We can remove this using lightkurve’s
method before appending each object.
lc = search_lightcurvefile(target, quarter=1).download().PDCSAP_FLUX.normalize().flatten(window_length=401) for q in range(2,8): lc = lc.append(search_lightcurvefile(target, quarter=q).download().PDCSAP_FLUX.normalize().flatten(window_length=401))
Now all of the light curves stitch together with no visible join. We can
bin methods to form a planet transit out of all
of the data for Kepler-8b.