# Combining multiple quarters of Kepler data¶

## Learning Goals¶

By the end of this tutorial, you will:

• Understand a Kepler Quarter.

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

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
6Kepler Quarter 062010Kepler1800kplr0069222440.0
7Kepler Quarter 072010Kepler1800kplr0069222440.0
8Kepler Quarter 082011Kepler1800kplr0069222440.0
9Kepler Quarter 092011Kepler1800kplr0069222440.0
10Kepler Quarter 102011Kepler1800kplr0069222440.0
11Kepler Quarter 112012Kepler1800kplr0069222440.0
12Kepler Quarter 122012Kepler1800kplr0069222440.0
13Kepler Quarter 132012Kepler1800kplr0069222440.0
14Kepler Quarter 142012Kepler1800kplr0069222440.0
15Kepler Quarter 152013Kepler1800kplr0069222440.0
16Kepler Quarter 162013Kepler1800kplr0069222440.0
17Kepler Quarter 172013Kepler1800kplr0069222440.0

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.

[3]:

lc_collection = search_result.download_all()
lc_collection

[3]:

LightCurveCollection of 18 objects:
KIC 6922244 (18 KeplerLightCurves) Quarters: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17


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 targetid=6922244 length=4116
electron / selectron / sdpixpixelectron / selectron / selectron / selectron / selectron / selectron / spixpixpixpixpixpixpixpixpixpix
objectfloat32float32int32float32float64float64int32float32float32float32float32float32float32int32float64float32float64float32float64float32float64float32float32float32
352.37632485035283nannan0-1.410670e-03682.69125190.13296119144.3689148e+046.6459765e+001.6722699e+034.6767941e-01nannan0682.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
352.51935724334915.2487070e+047.9990516e+000-1.413477e-03682.69073190.13307119214.3692590e+046.6460714e+001.6731461e+034.6760359e-015.2487070e+047.9990516e+000682.608807.8005593e-05190.368251.1757523e-04682.690731.8636670e-04190.133071.8304495e-049.8343305e-02-1.7184900e-01
352.539790343456845.2507734e+048.0051088e+0010000000-1.413877e-03682.68909190.13338119224.3712012e+046.6500912e+001.6725844e+034.6755314e-015.2507734e+048.0051088e+0010000000682.608297.7979123e-05190.368591.1755893e-04682.689091.8644832e-04190.133381.8299681e-049.8101854e-02-1.7161448e-01
352.560223643806245.2472902e+048.0007839e+000-1.414276e-03682.69022190.13343119234.3683984e+046.6457977e+001.6750397e+034.6755785e-015.2472902e+048.0007839e+000682.608247.7997676e-05190.368891.1760603e-04682.690221.8638840e-04190.133431.8307337e-049.7997010e-02-1.7128757e-01
...........................................................................
442.019594804136435.2471406e+047.9692073e+000-3.409159e-04682.49127190.34491163014.3153082e+046.6136584e+001.5008551e+034.6549889e-015.2471406e+047.9692073e+000682.422857.3334042e-05190.685359.3125935e-05682.491271.8501784e-04190.344911.8689032e-04-7.9899147e-021.3902473e-01
442.04002926944675.2484672e+047.9713697e+000-3.401506e-04682.49096190.34401163024.3162852e+046.6141791e+001.4984926e+034.6637267e-015.2484672e+047.9713697e+000682.423097.3324874e-05190.684949.3243980e-05682.490961.8510064e-04190.344011.8683969e-04-7.9640254e-021.3871230e-01
442.06046353487915.2490562e+047.9703860e+000-3.393851e-04682.49125190.34495163034.3167781e+046.6144958e+001.5003789e+034.6711573e-015.2490562e+047.9703860e+000682.423067.3320742e-05190.685269.3141578e-05682.491251.8497938e-04190.344951.8685836e-04-7.9665780e-021.3868718e-01
442.08089790042145.2474590e+047.9709330e+0010000000-3.386196e-04682.49142190.34449163044.3156332e+046.6142426e+001.5022838e+034.6630958e-015.2474590e+047.9709330e+0010000000682.422967.3331044e-05190.685099.3194321e-05682.491421.8501014e-04190.344491.8690975e-04-7.9900064e-021.3900562e-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();

[5]:

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


### 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/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)


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();

[7]:

<AxesSubplot:xlabel='Time - 2454833 [BKJD days]', ylabel='Normalized Flux'>


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();

[8]:

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


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 targetid=6922244 length=65504
dpixpixelectron / selectron / selectron / selectron / selectron / selectron / spixpixpixpixpixpixpixpixpixpix
objectfloat32float32int32float32float64float64int32float32float32float32float32float32float32int32float64float32float64float32float64float32float64float32float32float32
120.539794062067811.0002389e+001.7835133e-0401.641642e-03676.76061192.211025684.0029211e+047.1942086e+001.3501000e+036.9019127e-014.9790078e+048.8780060e+000nannannannan676.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+000nannannannan676.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+000nannannannan676.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+000nannannannan676.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+000nannannannan676.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+000nannannannan676.761702.4268354e-04192.208712.8930244e-04-4.2848983e-039.4073853e-03
120.662400329856619.9989384e-011.7951278e-0401.646410e-03676.76318192.209145743.9994105e+047.1914792e+001.3482495e+036.8812454e-014.9772902e+048.9358206e+000nannannannan676.763182.4266902e-04192.209142.8928166e-04-4.3740734e-039.1674784e-03
120.682834824161551.0001035e+001.7969948e-0401.647204e-03676.76312192.208495753.9999207e+047.1918936e+001.3490680e+036.8974006e-014.9783336e+048.9451141e+000nannannannan676.763122.4268078e-04192.208492.8929702e-04-4.1775936e-039.0572909e-03
120.703269118348541.0001053e+001.7944223e-0401.647998e-03676.76273192.207885763.9999398e+047.1918974e+001.3484713e+036.9063425e-014.9783430e+048.9323092e+000nannannannan676.762732.4269335e-04192.207882.8931847e-04-4.2246603e-038.9526922e-03
...........................................................................
1590.818264989.9976480e-011.8179227e-0401.015260e-03676.80111192.10133725223.7826906e+046.9083934e+001.2777081e+035.9248704e-014.8588645e+048.8351183e+000676.759271.4917154e-04192.318901.9156512e-04676.801112.5241618e-04192.101332.5272943e-04-3.9865761e-031.4864406e-02
1590.83869952436369.9977714e-011.8188541e-0401.016104e-03676.80109192.10132725233.7828023e+046.9085383e+001.2810897e+035.9335488e-014.8589242e+048.8396444e+000676.759171.4919229e-04192.318961.9155757e-04676.801092.5239991e-04192.101322.5271578e-04-4.0576421e-031.4865786e-02
1590.85913386883489.9998957e-011.8168797e-0401.016949e-03676.80133192.10114725243.7832582e+046.9087262e+001.2798925e+035.9355038e-014.8599566e+048.8300486e+000676.759191.4914903e-04192.318961.9151389e-04676.801332.5240114e-04192.101142.5271127e-04-4.0520453e-031.4725811e-02
1590.87956831319759.9989623e-011.8185582e-04100000100000001.017793e-03676.80167192.10122725253.7832602e+046.9091139e+001.2815891e+035.9373122e-014.8595031e+048.8382063e+0010000010000000676.759541.4915224e-04192.318981.9158589e-04676.801672.5239732e-04192.101222.5277122e-04-3.9305747e-031.5043449e-02
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();

[10]:

<AxesSubplot:xlabel='Time - 2454833 [BKJD days]', ylabel='Normalized Flux'>


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.

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: