Combining multiple quarters of Kepler data#

Learning Goals#

By the end of this tutorial, you will:

  • Understand a Kepler Quarter.

  • Understand how to download multiple quarters of data at once.

  • Learn how to normalize Kepler data.

  • Understand how to combine multiple quarters of data.

Introduction#

The Kepler, K2, and TESS telescopes observe stars for long periods of time. These long, time series observations are broken up into separate chunks, called quarters for the Kepler mission, campaigns for K2, and sectors for TESS.

Building light curves with as much data as is available is useful when searching for small signals, such as planetary transits or stellar pulsations. In this tutorial, we will learn how to use Lightkurve’s tools to download and stitch together multiple quarters of Kepler observations.

It is recommended to first read the tutorial discussing how to use Kepler light curve products with Lightkurve. That tutorial will introduce you to some specifics of how Kepler, K2, and TESS make observations, and how these are displayed as light curves. It also introduces some important terms and concepts that are referred to in this tutorial.

This tutorial demonstrates how to access and combine multiple quarters of data from the Kepler space telescope, using the Lightkurve package.

When accessing Kepler data through MAST, it will be stored in three-month chunks, corresponding to a quarter of observations. By combining and normalizing these separate observations, you can form a single light curve that spans all observed quarters. Utilizing all of the data available is especially important when looking at repeating signals, such as planet transits and stellar oscillations.

We will use the Kepler mission as an example, but these tools are extensible to TESS and K2 as well.

Imports#

This tutorial requires the Lightkurve package, which in turn uses matplotlib for plotting.

[1]:
import lightkurve as lk
%matplotlib inline

1. What is a Kepler Quarter?#

In order to search for planets around other stars, the Kepler space telescope performed near-continuous monitoring of a single field of view, from an Earth-trailing orbit. However, this posed a challenge. If the space telescope is trailing Earth and maintaining steady pointing, its solar panels would slowly receive less and less sunlight.

In order to make sure the solar panels remained oriented towards the Sun, Kepler performed quarterly rolls, one every 93 days. The infographic below helps visualize this, and shows the points in the orbit where the rolls took place.

After each roll, Kepler retained its fine-pointing at the same field of view. Because the camera rotated by 90 degrees, all of the target stars fell on different parts of the charge-coupled device (CCD) camera. This had an effect on the amount of flux recorded for the same star, because different CCD pixels have different sensitivities. The way in which the flux from the same stars was distributed on the CCD (called the point spread function or PSF) also changed after each roll, due to focus changes and other instrumental effects. As a result, the aperture mask set for a star had to be recomputed after each roll, and may capture slightly different amounts of flux.

The data obtained between rolls is referred to as a quarter. While there are changes to the flux systematics, not much else changes quarter to quarter, and the majority of the target list remains identical. This means that, after removing systematic trends (such as was done for the presearch data conditioning simple aperture photometry (PDCSAP) flux), multiple quarters together can form one continuous observation.

c3735fd9d33f4e5cad18bf80cf95f076

Figure: Infographic showcasing the necessity of Kepler’s quarterly rolls and its Earth-trailing orbit. Source: Kepler Science Center.

Note: Observations by K2 and TESS are also broken down into chunks of a month or more, called campaigns (for K2) and sectors (for TESS). While not discussed in this tutorial, the tools below work for these data products as well.

2. Downloading Multiple KeplerLightCurve Objects at Once#

To start, we can use Lightkurve’s search_lightcurve() function to see what data are available for our target star on the Mikulski Archive for Space Telescopes (MAST) archive. We will use the star Kepler-8, a star somewhat larger than the Sun, and the host of a hot Jupiter planet.

[2]:
search_result = lk.search_lightcurve("Kepler-8", author="Kepler", cadence="long")
search_result
[2]:
SearchResult containing 18 data products.
#missionyearauthorexptimetarget_namedistance
sarcsec
0Kepler Quarter 002009Kepler1800kplr0069222440.0
1Kepler Quarter 012009Kepler1800kplr0069222440.0
2Kepler Quarter 022009Kepler1800kplr0069222440.0
3Kepler Quarter 032009Kepler1800kplr0069222440.0
4Kepler Quarter 042010Kepler1800kplr0069222440.0
5Kepler Quarter 052010Kepler1800kplr0069222440.0
.....................
11Kepler Quarter 112012Kepler1800kplr0069222440.0
12Kepler Quarter 122012Kepler1800kplr0069222440.0
13Kepler Quarter 132012Kepler1800kplr0069222440.0
14Kepler Quarter 142012Kepler1800kplr0069222440.0
15Kepler Quarter 162013Kepler1800kplr0069222440.0
16Kepler Quarter 152013Kepler1800kplr0069222440.0
17Kepler Quarter 172013Kepler1800kplr0069222440.0
Length = 18 rows

In this list, each row represents a different observing quarter, for a total of 18 quarters across four years. The observation column lists the Kepler Quarter. The target_name represents the Kepler Input Catalogue (KIC) ID of the target, and the productFilename column is the name of the FITS files downloaded from MAST. The distance column shows the separation on the sky between the searched coordinates and the downloaded objects — this is only relevant when searching for specific coordinates in the sky, and not when looking for individual objects.

Instead of downloading a single quarter using the download() function, we can use the download_all() function to access all 18 quarters at once (this might take a while).

[3]:
lc_collection = search_result.download_all()
lc_collection
[3]:
LightCurveCollection of 18 objects:
    0: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=0 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    1: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=1 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    2: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=2 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    3: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=3 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    4: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=4 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    5: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=5 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    6: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=6 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    7: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=7 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    8: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=10 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    9: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=8 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    10: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=9 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    11: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=11 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    12: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=12 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    13: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=13 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    14: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=14 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    15: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=16 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    16: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=15 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>
    17: <KeplerLightCurve LABEL="KIC 6922244" QUARTER=17 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux>

All of the downloaded data are stored in a LightCurveCollection. This object acts as a wrapper for 18 separate KeplerLightCurve objects, listed above.

We can access the KeplerLightCurve objects and interact with them as usual through the LightCurveCollection.

[4]:
lc_Q4 = lc_collection[4]
lc_Q4
[4]:
KeplerLightCurve length=4116 LABEL="KIC 6922244" QUARTER=4 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux
timefluxflux_errqualitytimecorrcentroid_colcentroid_rowcadencenosap_fluxsap_flux_errsap_bkgsap_bkg_errpdcsap_fluxpdcsap_flux_errsap_qualitypsf_centr1psf_centr1_errpsf_centr2psf_centr2_errmom_centr1mom_centr1_errmom_centr2mom_centr2_errpos_corr1pos_corr2
electron / selectron / sdpixpixelectron / selectron / selectron / selectron / selectron / selectron / spixpixpixpixpixpixpixpixpixpix
Timefloat32float32int32float32float64float64int32float32float32float32float32float32float32int32float64float32float64float32float64float32float64float32float32float32
352.37632485035283——————0-1.410670e-03682.69125190.13296119144.3689148e+046.6459765e+001.6722699e+034.6767941e-01——————0682.609277.8001787e-05190.368141.1752916e-04682.691251.8638317e-04190.132961.8306405e-049.8764673e-02-1.7217098e-01
352.39675804848965.2490750e+048.0003128e+0010000000000000-1.411072e-03682.69084190.13270119154.3698070e+046.6462421e+001.6698400e+034.6764868e-015.2490750e+048.0003128e+0010000000000000682.609007.7997785e-05190.367771.1751152e-04682.690841.8633612e-04190.132701.8303936e-049.8700106e-02-1.7229939e-01
352.43762444557075.2484055e+047.9999790e+0010000-1.411874e-03682.69038190.13302119174.3694105e+046.6461620e+001.6731306e+034.6705514e-015.2484055e+047.9999790e+0010000682.608627.7994831e-05190.368481.1754913e-04682.690381.8634219e-04190.133021.8301954e-049.8306537e-02-1.7180158e-01
352.458057644638765.2491809e+048.0006199e+000-1.412275e-03682.69084190.13257119184.3698316e+046.6463132e+001.6741406e+034.6687824e-015.2491809e+048.0006199e+000682.608727.7998680e-05190.367921.1751390e-04682.690841.8635279e-04190.132571.8304381e-049.8410256e-02-1.7202987e-01
352.47849084393245.2478277e+047.9992733e+000-1.412676e-03682.68949190.13304119194.3687648e+046.6459165e+001.6723815e+034.6764576e-015.2478277e+047.9992733e+000682.608297.7993544e-05190.368141.1756293e-04682.689491.8641398e-04190.133041.8308057e-049.8039381e-02-1.7183834e-01
352.49892404346615.2475855e+047.9986620e+000-1.413077e-03682.69036190.13318119204.3686480e+046.6458707e+001.6734375e+034.6817183e-015.2475855e+047.9986620e+000682.608527.7998702e-05190.368751.1761812e-04682.690361.8637831e-04190.133181.8304847e-049.8102726e-02-1.7151666e-01
...........................................................................
442.10133236614645.2484648e+047.9707704e+000-3.378539e-04682.49086190.34446163054.3164066e+046.6142449e+001.4996798e+034.6686992e-015.2484648e+047.9707704e+000682.422957.3321760e-05190.684979.3209848e-05682.490861.8497877e-04190.344461.8690305e-04-7.9818368e-021.3874538e-01
442.12176673195795.2479809e+047.9702587e+0010000000000000-3.370880e-04682.49145190.34413163064.3160660e+046.6141462e+001.4999071e+034.6648329e-015.2479809e+047.9702587e+0010000000000000682.423127.3320341e-05190.685169.3171802e-05682.491451.8498853e-04190.344131.8685416e-04-7.9732254e-021.3886212e-01
442.14220099791425.2475605e+047.9712372e+000-3.363221e-04682.49124190.34487163074.3157629e+046.6139336e+001.4981315e+034.6694338e-015.2475605e+047.9712372e+000682.422827.3328265e-05190.685569.3097420e-05682.491241.8495553e-04190.344871.8686226e-04-7.9895072e-021.3914314e-01
442.162635463981135.2475305e+047.9707313e+000-3.355560e-04682.49104190.34460163084.3155801e+046.6138582e+001.4982946e+034.6778497e-015.2475305e+047.9707313e+000682.422887.3337091e-05190.685009.3226627e-05682.491041.8501762e-04190.344601.8689682e-04-7.9854071e-021.3877387e-01
442.18306983020015.2465984e+047.9693055e+000-3.347898e-04682.49114190.34490163094.3148465e+046.6134605e+001.4987802e+034.6625513e-015.2465984e+047.9693055e+000682.422677.3346317e-05190.685429.3117917e-05682.491141.8503764e-04190.344901.8691395e-04-7.9959184e-021.3906266e-01
442.203504096527475.2471043e+047.9698005e+000-3.340235e-04682.49069190.34464163104.3151559e+046.6137042e+001.4977747e+034.6697757e-015.2471043e+047.9698005e+000682.422727.3345473e-05190.685289.3169489e-05682.490691.8501126e-04190.344641.8690964e-04-7.9990946e-021.3905971e-01
[5]:
lc_Q4.plot();
../../_images/tutorials_2-creating-light-curves_2-1-combining-multiple-quarters_16_0.png

Note:#

The example given above also works for downloading target pixel files (TPFs). This will produce a TargetPixelFileCollection object instead.

3. Investigating the Data#

Let’s first have a look at how these observations differ from one another. We can plot the simple aperture photometry (SAP) flux of all of the observations in the `LightCurveCollection <https://docs.lightkurve.org/reference/api/lightkurve.collections.LightCurveCollection.html#lightkurve.collections.LightCurveCollection>`__ to see how they compare.

[6]:
ax = lc_collection[0].plot(column='sap_flux', label=None)
for lc in lc_collection[1:]:
    lc.plot(ax=ax, column='sap_flux', label=None)
../../_images/tutorials_2-creating-light-curves_2-1-combining-multiple-quarters_20_0.png

In the figure above, each quarter of data looks strikingly different, with global patterns repeating every four quarters as Kepler has made a full rotation.

The change in flux within each quarter is in part driven by changes in the telescope focus, which are caused by changes in the temperature of Kepler’s components as the spacecraft orbits the Sun. The changes are also caused by an effect called differential velocity aberration (DVA), which causes stars to drift over the course of a quarter, depending on their distance from the center of Kepler’s field of view.

While the figure above looks messy, all the systematic effects mentioned above are well understood, and have been detrended in the PDCSAP flux. For a more detailed overview, see the Kepler Data Characteristics Handbook, specifically: Section 5. Ongoing Phenomena.

4. Normalizing a Light Curve#

If we want to see the actual variation of the targeted object over the course of these observations, the plot above isn’t very useful to us. It is also not useful to have flux expressed in physical units, because it is affected by the observing conditions such as telescope focus and pointing (see above).

Instead, it is a common practice to normalize light curves by dividing by their median value. This means that the median of the newly normalized light curve will be equal to 1, and that the relative size of signals in the observation (such as transits) will be maintained.

A normalization can be performed using the normalize() method of a KeplerLightCurve, for example:

[7]:
lc_collection[4].normalize().plot();
../../_images/tutorials_2-creating-light-curves_2-1-combining-multiple-quarters_24_0.png

In the figure above, we have plotted the normalized PDCSAP flux for Quarter 4. The median normalized flux is at 1, and the transit depths lie around 0.991, indicating a 0.9% dip in brightness due to the planet transiting the star.

The LightCurveCollection also has a plot() method. We can use it to plot the PDCSAP flux. The method automatically normalizes the flux in same way we did for a single quarter above.

[8]:
lc_collection.plot();
../../_images/tutorials_2-creating-light-curves_2-1-combining-multiple-quarters_27_0.png

As you can see above, because we have normalized the data, all of the observations form a single consistent light curve.

5. Combining Multiple Observations into a Single Light Curve#

Finally, we can combine these different light curves into a single KeplerLightCurve object. This is done using the stitch() method. This method concatenates all quarters in our LightCurveCollection together, and normalizes them at the same time, in the manner we saw above.

[9]:
lc_stitched = lc_collection.stitch()
lc_stitched
[9]:
KeplerLightCurve length=65504 LABEL="KIC 6922244" QUARTER=17 AUTHOR=Kepler FLUX_ORIGIN=pdcsap_flux
timefluxflux_errqualitytimecorrcentroid_colcentroid_rowcadencenosap_fluxsap_flux_errsap_bkgsap_bkg_errpdcsap_fluxpdcsap_flux_errsap_qualitypsf_centr1psf_centr1_errpsf_centr2psf_centr2_errmom_centr1mom_centr1_errmom_centr2mom_centr2_errpos_corr1pos_corr2
dpixpixelectron / selectron / selectron / selectron / selectron / selectron / spixpixpixpixpixpixpixpixpixpix
Timefloat32float32int32float32float64float64int32float32float32float32float32float32float32int32float64float32float64float32float64float32float64float32float32float32
120.539794062067811.0002389e+001.7835133e-0401.641642e-03676.76061192.211025684.0029211e+047.1942086e+001.3501000e+036.9019127e-014.9790078e+048.8780060e+000————————————676.760612.4257520e-04192.211022.8915040e-04-6.1361594e-031.2139007e-02
120.560228456954061.0000123e+001.7952095e-0401.642437e-03676.76010192.210025694.0014566e+047.1924801e+001.3488469e+036.8939346e-014.9778801e+048.9362278e+000————————————676.760102.4263318e-04192.210022.8926603e-04-6.3053877e-031.1505429e-02
120.580662751723149.9970073e-011.7981241e-0401.643232e-03676.76146192.209885704.0000406e+047.1918778e+001.3513733e+036.8988037e-014.9763289e+048.9507360e+000————————————676.761462.4270279e-04192.209882.8932444e-04-5.5118860e-031.1369802e-02
120.601097246370051.0002698e+001.7900635e-0401.644026e-03676.76139192.209385714.0018668e+047.1936789e+001.3461132e+036.8999070e-014.9791617e+048.9106121e+000————————————676.761392.4260787e-04192.209382.8922342e-04-5.5788676e-031.0246177e-02
120.621531641023471.0001223e+001.7974019e-0401.644821e-03676.76213192.208985724.0008617e+047.1923513e+001.3499850e+036.9054097e-014.9784277e+048.9471407e+000————————————676.762132.4259168e-04192.208982.8918759e-04-4.6821944e-031.0072310e-02
120.64196593544339.9984479e-011.7990815e-0401.645615e-03676.76170192.208715733.9994742e+047.1914024e+001.3490905e+036.8729931e-014.9770461e+048.9555016e+000————————————676.761702.4268354e-04192.208712.8930244e-04-4.2848983e-039.4073853e-03
...........................................................................
1590.9000028575619.9988633e-011.8179342e-0401.018638e-03676.80148192.10108725263.7831559e+046.9085450e+001.2787664e+035.9414190e-014.8594551e+048.8351736e+000676.759301.4916631e-04192.318961.9152595e-04676.801482.5232948e-04192.101082.5263420e-04-4.0509203e-031.4821382e-02
1590.92043720179949.9999821e-011.8173133e-0401.019482e-03676.80166192.10131725273.7836602e+046.9087906e+001.2786053e+035.9385866e-014.8599988e+048.8321562e+000676.759461.4911903e-04192.318991.9154462e-04676.801662.5230341e-04192.101312.5262410e-04-4.0993756e-031.4611045e-02
1590.94087174616299.9969560e-011.8179418e-0401.020326e-03676.80144192.10146725283.7825430e+046.9083652e+001.2797456e+035.9316140e-014.8585281e+048.8352108e+000676.759531.4916577e-04192.319081.9160371e-04676.801442.5239564e-04192.101462.5271456e-04-3.9369571e-031.4928485e-02
1590.96130619040929.9994302e-011.8176372e-0401.021170e-03676.80124192.10091725293.7834938e+046.9087672e+001.2764705e+035.9434044e-014.8597305e+048.8337307e+000676.759141.4914536e-04192.318841.9145805e-04676.801242.5227590e-04192.100912.5260207e-04-4.1014180e-031.4680510e-02
1590.98174053464751.0001228e+001.8151020e-0401.022015e-03676.80224192.10165725303.7828816e+046.9086733e+001.2774485e+035.9289569e-014.8606039e+048.8214092e+000676.759811.4909096e-04192.319801.9197758e-04676.802242.5231845e-04192.101652.5264811e-04-3.6829417e-031.6025381e-02
1591.00217507877829.9999636e-011.8174112e-0401.022859e-03676.80192192.10123725313.7825363e+046.9084020e+001.2774999e+035.9428430e-014.8599898e+048.8326321e+000676.759641.4915710e-04192.318871.9161010e-04676.801922.5232456e-04192.101232.5267553e-04-3.9303382e-031.5094034e-02

This returns a single KeplerLightCurve! It is in all ways identical to KeplerLightCurve of a single quarter, just longer. We can plot it the usual way.

[10]:
lc_stitched.plot();
../../_images/tutorials_2-creating-light-curves_2-1-combining-multiple-quarters_33_0.png

In this final normalized light curve, the interesting observational features of the star are more clear. Specifically: repeating transits that can be used to characterize planets and a noisy stellar flux that can be used to study brightness variability through asteroseismology.

Normalizing individual Kepler Quarters before combining them to form a single light curve isn’t the only way to make sure different quarters are consistent with one another. For a breakdown of other available methods and their benefits, see Section 6. Stitching Kepler Quarters Together in Kinemuchi et al. 2012.

About this Notebook#

Authors: Oliver Hall (oliver.hall@esa.int), Geert Barentsen

Updated On: 2020-09-15

Citing Lightkurve and Astropy#

If you use lightkurve or astropy for published research, please cite the authors. Click the buttons below to copy BibTeX entries to your clipboard.

[11]:
lk.show_citation_instructions()
[11]:

When using Lightkurve, we kindly request that you cite the following packages:

  • lightkurve
  • astropy
  • astroquery — if you are using search_lightcurve() or search_targetpixelfile().
  • tesscut — if you are using search_tesscut().

Space Telescope Logo