Using Light Curve Files with Lightkurve#

Learning Goals#

By the end of this tutorial, you will:

  • Understand how NASA’s Kepler Mission collected and released light curve data products.

  • Be able to download and plot light curve files from the data archive using Lightkurve.

  • Be able to access light curve metadata.

  • Understand the time and brightness units.

Introduction#

The Kepler, K2, and TESS telescopes observe stars for long periods of time, from just under a month to four years. By doing so they observe how the brightness of stars change over time. A series of these brightness observations is referred to as a light curve of a star.

Light curves of stars observed by the Kepler, K2, or TESS missions are created from the raw images collected by these telescopes using software built for this purpose by the mission teams. In this tutorial, we will learn how to use the Lightkurve package to download these preprocessed light curves from Kepler’s data archive, plot them, and understand their properties and units.

Much of the explanation below is inspired by Kinemuchi et al. (2012), an excellent paper introducing and explaining the terminology surrounding the Kepler mission and its data. You can find detailed information on the mission and its data products in the official Kepler Instrument Handbook and the Kepler Data Processing Handbook.

We will use the Kepler mission as the main example, but these tools are extensible to TESS and K2 as well. For example, while in this tutorial we will learn to work with Lightkurve’s KeplerLightCurve objects, there are also TessLightCurve objects that work in the same way.

Imports#

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

[1]:
import lightkurve as lk
%matplotlib inline

1. About NASA’s Photometric Space Telescopes#

In order to understand the data produced by NASA’s Kepler, K2, and TESS missions, it is useful to understand a little about how these data were obtained.

1.1. Kepler#

During its nominal mission, the Kepler telescope made observations using 21 pairs of rectangular charge-coupled device (CCD) camera chips (also called modules), each consisting of four 1100 x 2048 pixel channels. Each observed star fell on one of these 84 CCD channels. Recording the channel numbers for each star was important, because the Kepler spacecraft rotated by 90 degrees roughly four times a year. These rotations divide what are referred to as observing quarters. While the same star may be observed in multiple quarters, it may fall on a different CCD channel each time.

Kepler observed a single field in the sky, although not all stars in this field were recorded as light curves. Instead, pixels were selected around a predetermined list of target stars, which were then downloaded. These downloaded measurements are stored in target pixel files (TPFs). By adding up the flux (a measurement of an object’s brightness per unit time) measured by the pixels in which a target star appears, the total brightness of a star can be measured. If you make this measurement at different times, you obtain a light curve.

Kepler recorded the brightness measurements at two different cadences: a Short Cadence (SC, 58.85 seconds) and a Long Cadence (LC, 29.4 minutes). For more details, read: Kepler Instrument Handbook, Section 2.1. Mission Overview and 2.6. Pixels of Interest, and the Kepler Archive Manual Chapter 2: Kepler Data Products.

bf1bc9153e244d709ee125fc535f9fb9

Figure: The field of view of the Kepler mission. The rectangles represent the CCD modules described above.

1.2. K2#

The Kepler mission ended in 2013 following the loss of two reaction wheels, leaving the spacecraft unable to stay fixed on one portion of the sky. Instead, it changed its focus to the ecliptic plane, and performed 80-day observing campaigns of 19 separate fields. K2 data are very similar to Kepler data, but are subject to higher levels of instrument noise due to the increased instability of the spacecraft. For more details read the K2 Handbook, specifically Section 2: What’s New in K2.

1.3. TESS#

The Transiting Exoplanet Survey Satellite (TESS) succeeded Kepler in 2018. The data it collects are very similar to those from Kepler and K2, but TESS covers a much larger area of the sky at a lower resolution. TESS observes large sectors of the sky for 27 days at a time. The overlap of these sectors means that stars near the ecliptic poles will receive a year of uninterrupted data, while those near the ecliptic receive only ~27 days. Compared to Kepler, TESS observes in several different cadence modes, including 20 seconds, 120 seconds, 10 minutes, and 30 minutes. For more details, see the Mission Overview and the TESS Instrument Handbook, specifically Section 2: Introduction to TESS.

Some stars that have been observed by TESS will also have been observed by Kepler, and in some rare cases K2.

2. Downloading a Light Curve File#

The light curves of stars created by the Kepler mission are stored at the Mikulksi Archive for Space Telescopes (MAST) archive, along with metadata about the observations, such as which CCD channel was used at each time.

Lightkurve’s built-in tools allow us to search for light curve files in the archive, and download them and their metadata. In this example, we will start by downloading one quarter of Kepler data for a star named Kepler-8, a star somewhat larger than the Sun, and the host of a hot Jupiter planet.

Using Lightkurve’s search_lightcurve function, we can find an itemized list of different light curve file products available for Kepler-8:

[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 102011Kepler1800kplr0069222440.0
9Kepler Quarter 082011Kepler1800kplr0069222440.0
10Kepler Quarter 092011Kepler1800kplr0069222440.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

In this list, each row represents a different observing period. We find that Kepler recorded the maxmimum of 18 quarters of data for this target 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 you pass a radius argument to the search_lightcurve function to search for targets within a given search radius around a set of coordinates.

The search_lightcurve function takes several additional arguments, such as the quarter number or the mission name.

The search function returns a SearchResult object which has several convenient operations. For example, we can select the fourth data product in the list as follows:

[3]:
search_result[4]
[3]:
SearchResult containing 1 data products.
#missionyearauthorexptimetarget_namedistance
sarcsec
0Kepler Quarter 042010Kepler1800kplr0069222440.0

We can download this data product using the download() method:

[4]:
klc = search_result[4].download()

This instruction is identical to the following line:

[5]:
klc = lk.search_lightcurve("Kepler-8", author="Kepler", cadence="long", quarter=4).download()

The klc variable we have obtained in this way is a KeplerLightCurve object. This object contains time, flux, and flux error information, as well as a whole lot of data about spacecraft systematics. We can view all of them by calling the object by itself:

[6]:
klc
[6]:
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
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
352.58065684450415.2490586e+048.0011005e+000-1.414675e-03682.69067190.13353119244.3696762e+046.6464057e+001.6747676e+034.6741170e-015.2490586e+048.0011005e+000682.608587.7987701e-05190.368671.1758389e-04682.690671.8633297e-04190.133531.8302842e-049.8154068e-02-1.7160916e-01
352.60108994554325.2484711e+048.0012350e+000-1.415074e-03682.69027190.13306119254.3693148e+046.6461196e+001.6724357e+034.6762615e-015.2484711e+048.0012350e+000682.608497.7995923e-05190.368711.1761376e-04682.690271.8637281e-04190.133061.8304559e-049.8116107e-02-1.7139660e-01
352.62152324682395.2479773e+048.0013390e+0010000000000000-1.415473e-03682.69014190.13359119264.3691348e+046.6462650e+001.6751807e+034.6757978e-015.2479773e+048.0013390e+0010000000000000682.607957.7985074e-05190.369361.1769431e-04682.690141.8639400e-04190.133591.8310899e-049.7724356e-02-1.7103195e-01
352.641956448453135.2499305e+048.0007114e+000-1.415872e-03682.69019190.13330119274.3703137e+046.6466208e+001.6736156e+034.6751177e-015.2499305e+048.0007114e+000682.608417.7987228e-05190.368871.1764505e-04682.690191.8633960e-04190.133301.8302450e-049.8125741e-02-1.7140007e-01
352.66238965030795.2484117e+048.0014248e+000-1.416270e-03682.69002190.13337119284.3692902e+046.6462936e+001.6730603e+034.6794355e-015.2484117e+048.0014248e+000682.608147.7984361e-05190.369151.1766269e-04682.690021.8636827e-04190.133371.8306459e-049.7747400e-02-1.7097178e-01
352.682822852402755.2487891e+048.0007782e+000-1.416668e-03682.68996190.13380119294.3696273e+046.6464286e+001.6735245e+034.6725965e-015.2487891e+048.0007782e+000682.608137.7983277e-05190.369191.1766609e-04682.689961.8634208e-04190.133801.8304669e-049.7714014e-02-1.7095777e-01
352.703256054846865.2454434e+047.9984565e+000-1.417065e-03682.69014190.13340119304.3666207e+046.6449828e+001.6736576e+034.6680400e-015.2454434e+047.9984565e+000682.608327.8020654e-05190.368831.1766910e-04682.690141.8649764e-04190.133401.8317846e-049.7894058e-02-1.7119597e-01
352.72368925751655.2472621e+048.0009689e+000-1.417462e-03682.69021190.13375119314.3683391e+046.6457801e+001.6753048e+034.6682772e-015.2472621e+048.0009689e+000682.607977.7995486e-05190.369511.1772667e-04682.690211.8640491e-04190.133751.8307207e-049.7682953e-02-1.7075481e-01
352.74412246054275.2482875e+048.0009794e+000-1.417859e-03682.69041190.13349119324.3691410e+046.6464067e+001.6762039e+034.6761668e-015.2482875e+048.0009794e+000682.607987.7983212e-05190.369281.1769098e-04682.690411.8641083e-04190.133491.8309223e-049.7745605e-02-1.7083719e-01
352.764555663801735.2493121e+048.0009432e+000-1.418256e-03682.68944190.13347119334.3701473e+046.6466613e+001.6743618e+034.6796089e-015.2493121e+048.0009432e+000682.607657.7968449e-05190.369081.1763493e-04682.689441.8634081e-04190.133471.8304866e-049.7519584e-02-1.7081630e-01
352.78498886740275.2482012e+048.0010128e+000-1.418653e-03682.68999190.13357119344.3693109e+046.6463881e+001.6749097e+034.6720043e-015.2482012e+048.0010128e+000682.608047.7987694e-05190.369471.1771973e-04682.689991.8636086e-04190.133571.8305663e-049.7584486e-02-1.7054483e-01
352.805421971243055.2485773e+048.0009441e+000-1.419049e-03682.68989190.13358119354.3694504e+046.6463594e+001.6748682e+034.6818867e-015.2485773e+048.0009441e+000682.607827.7982280e-05190.369521.1769895e-04682.689891.8636433e-04190.133581.8303795e-049.7454362e-02-1.7061280e-01
...........................................................................
441.774382530515145.2472027e+047.9701767e+0010000000000000-3.500895e-04682.49137190.34474162894.3155488e+046.6141920e+001.5012952e+034.6742216e-015.2472027e+047.9701767e+0010000000000000682.423157.3329160e-05190.684909.3236005e-05682.491371.8502712e-04190.344741.8690614e-04-7.9620197e-021.3869031e-01
441.79481689428945.2483449e+047.9703755e+000-3.493257e-04682.49125190.34433162904.3164199e+046.6143861e+001.5015933e+034.6649483e-015.2483449e+047.9703755e+000682.423277.3319563e-05190.684759.3264607e-05682.491251.8498245e-04190.344331.8683473e-04-7.9462834e-021.3846718e-01
441.81525115815025.2474996e+047.9697852e+000-3.485619e-04682.49165190.34417162914.3154418e+046.6140785e+001.5028657e+034.6644580e-015.2474996e+047.9697852e+000682.423277.3324212e-05190.684589.3323062e-05682.491651.8503748e-04190.344171.8689658e-04-7.9532765e-021.3827184e-01
441.83568562217995.2469941e+047.9697943e+000-3.477978e-04682.49124190.34488162924.3153219e+046.6139221e+001.5025079e+034.6653268e-015.2469941e+047.9697943e+000682.423147.3329662e-05190.684989.3182280e-05682.491241.8502890e-04190.344881.8690157e-04-7.9588197e-021.3860969e-01
441.85611998633255.2481059e+047.9711428e+000-3.470337e-04682.49182190.34415162934.3161004e+046.6144495e+001.5020490e+034.6753466e-015.2481059e+047.9711428e+000682.423417.3324314e-05190.684519.3318908e-05682.491821.8501634e-04190.344151.8688360e-04-7.9376958e-021.3828298e-01
441.876554250600755.2466848e+047.9694710e+000-3.462694e-04682.49179190.34417162944.3149250e+046.6137443e+001.5030779e+034.6643156e-015.2466848e+047.9694710e+000682.423627.3329109e-05190.684599.3358700e-05682.491791.8505476e-04190.344171.8690665e-04-7.9315238e-021.3822258e-01
441.896988714979675.2474023e+047.9719896e+0010000000-3.455050e-04682.49150190.34448162954.3157855e+046.6145024e+001.5011398e+034.6713176e-015.2474023e+047.9719896e+0010000000682.423257.3322197e-05190.684769.3278293e-05682.491501.8496772e-04190.344481.8688334e-04-7.9429932e-021.3862607e-01
441.917423079539735.2472281e+047.9701529e+000-3.447405e-04682.49128190.34399162964.3154711e+046.6138754e+001.5010295e+034.6696991e-015.2472281e+047.9701529e+000682.423187.3326584e-05190.684549.3316215e-05682.491281.8502600e-04190.343991.8689150e-04-7.9607107e-021.3834631e-01
441.937857344186345.2472938e+047.9703026e+000-3.439758e-04682.49165190.34435162974.3154684e+046.6139832e+001.5008883e+034.6656749e-015.2472938e+047.9703026e+000682.423377.3328170e-05190.684859.3249735e-05682.491651.8502508e-04190.344351.8690228e-04-7.9325221e-021.3840406e-01
441.958291708971965.2471516e+047.9689603e+000-3.432110e-04682.49119190.34454162984.3155348e+046.6138535e+001.5008563e+034.6656010e-015.2471516e+047.9689603e+000682.423047.3324562e-05190.685149.3178627e-05682.491191.8498173e-04190.344541.8685704e-04-7.9735115e-021.3892399e-01
441.99916043893615.2475980e+047.9695969e+000-3.416811e-04682.49093190.34463163004.3155496e+046.6140313e+001.5005978e+034.6754882e-015.2475980e+047.9695969e+000682.422997.3329807e-05190.684759.3298462e-05682.490931.8499741e-04190.344631.8689795e-04-7.9793788e-021.3853292e-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

This object provides a convenient way to interact with the data file that has been returned by the archive, which contains both the light curve data and metadata about the observations.

Before diving into the properties of the light curve file, we can plot the data, also using Lightkurve.

[7]:
%matplotlib inline
klc.plot();
../../_images/tutorials_1-getting-started_using-light-curve-file-products_24_0.png

On this plot, the y-axis is flux in electrons per second. This unit may appear counterintutive, as flux is a measure of brightness. The CCD cameras measure an electrical charge, and so light is recorded as electrons, not photons as you might expect. On the x-axis we have time in Barycentric Kepler Julian Date (BKJD). In short, the x-axis values are days since the start of the Kepler mission. The repeating dips in brightness are transits, the effect of a planet orbiting Kepler-8 and passing between us and the star.

Note#

You can also download light curve FITS files from the archive by hand, store them on your local disk, and open them using the lk.read(<filename>) function. This function will return a KeplerLightCurve object just as in the above example. You can find out where Lightkurve stored a light curve file using the filename attribute:

[8]:
klc.filename
[8]:
'/Users/tapritc2/.lightkurve/cache/mastDownload/Kepler/kplr006922244_lc_Q111111111111111111/kplr006922244-2010078095331_llc.fits'

3. The SAP and PDCSAP Light Curves#

As you can see in the Table above, there are two different types of flux stored in the KeplerLightCurve object. These correspond to different levels of data treatment performed for this star by NASA’s Kepler Data Processing Pipeline: the simple aperture photometry (SAP) flux, and the presearch data conditioning SAP (PDCSAP) flux.

By default, a KeplerLightCurve will set the PDCSAP flux to its .flux property.

To compare the PDCSAP and the SAP flux, we can use the column keyword while plotting.

Note: alternatively, you can replace the flux column with the sap_flux column by using klc.flux = klc['sap_flux'].

[9]:
ax = klc.plot(column='pdcsap_flux', label='PDCSAP Flux', normalize=True)
klc.plot(column='sap_flux', label='SAP Flux', normalize=True, ax=ax);
../../_images/tutorials_1-getting-started_using-light-curve-file-products_31_0.png

In brief:

  • The SAP light curve is calculated by summing together the brightness of pixels that fall within an aperture set by the Kepler mission. This is often referred to as the optimal aperture, but in spite of its name can sometimes be improved upon! Because the SAP light curve is a sum of the brightness in chosen pixels, it is still subject to systematic artifacts of the mission.

  • The PDCSAP light curve is subject to more treatment than the SAP light curve, and is specifically intended for detecting planets. The PDCSAP pipeline attempts to remove systematic artifacts while keeping planetary transits intact.

Looking at the figure we made above, you can see that the SAP light curve has a long-term change in brightness that has been removed in the PDCSAP light curve, while keeping the transits at the same depth. For most inspections, a PDCSAP light curve is what you want to use, but when looking at astronomical phenomena that aren’t planets (for example, long-term variability), the SAP flux may be preferred.

For now, let’s continue to use the PDCSAP flux only. Because this is the default .flux property of our light curve object, we don’t need to change anything.

Note#

The plot() methods in Lightkurve always return a Matplotlib object. This is useful because it lets us manipulate the plot using standard Matplotlib functions. For example, we can set the title as follows:

[10]:
ax = klc.plot()
ax.set_title("PDCSAP light curve of Kepler-8");
../../_images/tutorials_1-getting-started_using-light-curve-file-products_35_0.png

And the figure can be saved as follows:

[11]:
ax.figure.savefig('demo-lightcurve.png')

4. Accessing the Metadata#

When downloading data from MAST, that data usually comes in the format of a FITS file. These FITS files carry a wealth of metadata about the observation. When these are loaded in to Lightkurve to create a KeplerLightCurve, all of the metadata are stored in the .meta property of the object.

We can view these metadata by calling this property, as follows:

[12]:
klc.meta
[12]:
{'INHERIT': True,
 'EXTNAME': 'PRIMARY',
 'EXTVER': 1,
 'TELESCOP': 'Kepler',
 'INSTRUME': 'Kepler Photometer',
 'OBJECT': 'KIC 6922244',
 'KEPLERID': 6922244,
 'RADESYS': 'ICRS',
 'RA_OBJ': 281.28812,
 'DEC_OBJ': 42.45108,
 'EQUINOX': 2000.0,
 'EXPOSURE': 82.71685005,
 'TIMEREF': 'SOLARSYSTEM',
 'TASSIGN': 'SPACECRAFT',
 'TIMESYS': 'TDB',
 'BJDREFI': 2454833,
 'BJDREFF': 0.0,
 'TIMEUNIT': 'd',
 'TELAPSE': 89.84761299,
 'LIVETIME': 82.71685005,
 'TSTART': 352.36610827,
 'TSTOP': 442.21372126,
 'LC_START': 55184.87773552,
 'LC_END': 55274.70383812,
 'DEADC': 0.92063492,
 'TIMEPIXR': 0.5,
 'TIERRELA': 5.78e-07,
 'TIERABSO': <astropy.io.fits.card.Undefined at 0x17e65bd10>,
 'INT_TIME': 6.01980290327,
 'READTIME': 0.518948526144,
 'FRAMETIM': 6.538751429414,
 'NUM_FRM': 270,
 'TIMEDEL': 0.02043359821692,
 'DATE-OBS': '2009-12-19T20:49:13.619Z',
 'DATE-END': '2010-03-19T17:08:14.343Z',
 'BACKAPP': True,
 'DEADAPP': True,
 'VIGNAPP': True,
 'GAIN': 115.49,
 'READNOIS': 83.014212,
 'NREADOUT': 270,
 'TIMSLICE': 1,
 'MEANBLCK': 715,
 'LCFXDOFF': 419400,
 'SCFXDOFF': 219400,
 'CDPP3_0': 74.77433013916016,
 'CDPP6_0': 61.75667190551758,
 'CDPP12_0': 56.56961441040039,
 'CROWDSAP': 1.0,
 'FLFRCSAP': 0.8286,
 'NSPSDDET': 0,
 'NSPSDCOR': 0,
 'PDCVAR': 0.5488878488540649,
 'PDCMETHD': 'multiScaleMap',
 'NUMBAND': 3,
 'FITTYPE1': 'robust',
 'PR_GOOD1': 0.0,
 'PR_WGHT1': 0.0,
 'FITTYPE2': 'prior',
 'PR_GOOD2': 0.47542938590049744,
 'PR_WGHT2': 22.81161117553711,
 'FITTYPE3': 'prior',
 'PR_GOOD3': 0.9755752682685852,
 'PR_WGHT3': 46.809146881103516,
 'PDC_TOT': 0.45028069615364075,
 'PDC_TOTP': 0.2651563882827759,
 'PDC_COR': 0.9997496604919434,
 'PDC_CORP': 86.80510711669922,
 'PDC_VAR': 0.9991965293884277,
 'PDC_VARP': 86.88060760498047,
 'PDC_NOI': 0.9822107553482056,
 'PDC_NOIP': 99.34284210205078,
 'PDC_EPT': 1.0,
 'PDC_EPTP': 77.33592224121094,
 'CHECKSUM': '9pCbEmCZ9mCbCmCZ',
 'SIMPLE': True,
 'BITPIX': 8,
 'NAXIS': 0,
 'EXTEND': True,
 'NEXTEND': 2,
 'ORIGIN': 'NASA/Ames',
 'DATE': '2015-09-11',
 'CREATOR': '859340 FluxExporter2PipelineModule',
 'PROCVER': 'svn+ssh://murzim/repo/soc/tags/release/9.3.22 r60269',
 'FILEVER': '6.1',
 'TIMVERSN': 'OGIP/93-003',
 'CHANNEL': 31,
 'SKYGROUP': 31,
 'MODULE': 10,
 'OUTPUT': 3,
 'QUARTER': 4,
 'SEASON': 2,
 'DATA_REL': 25,
 'OBSMODE': 'long cadence',
 'MISSION': 'Kepler',
 'TTABLEID': 29,
 'PMRA': 0.0,
 'PMDEC': 0.0,
 'PMTOTAL': 0.0,
 'PARALLAX': None,
 'GLON': 71.6589,
 'GLAT': 19.012749,
 'GMAG': 13.886,
 'RMAG': 13.511,
 'IMAG': 13.424,
 'ZMAG': 13.413,
 'D51MAG': 13.7,
 'JMAG': 12.576,
 'HMAG': 12.323,
 'KMAG': 12.292,
 'KEPMAG': 13.563,
 'GRCOLOR': 0.375,
 'JKCOLOR': 0.284,
 'GKCOLOR': 1.594,
 'TEFF': 6225,
 'LOGG': 4.169,
 'FEH': -0.04,
 'EBMINUSV': 0.096,
 'AV': 0.297,
 'RADIUS': 1.451,
 'TMINDEX': 262064792,
 'SCPID': 262064792,
 'LABEL': 'KIC 6922244',
 'RA': 281.28812,
 'DEC': 42.45108,
 'FILENAME': '/Users/tapritc2/.lightkurve/cache/mastDownload/Kepler/kplr006922244_lc_Q111111111111111111/kplr006922244-2010078095331_llc.fits',
 'FLUX_ORIGIN': 'pdcsap_flux',
 'AUTHOR': 'Kepler',
 'TARGETID': 6922244,
 'QUALITY_BITMASK': 'default',
 'QUALITY_MASK': array([ True,  True, False, ...,  True,  True,  True])}

As you can see, there is a lot here if you don’t know what you are looking for! These metadata don’t just include information about the observations, but also data from the Kepler Input Catalogue (KIC) used to select observing targets, such as their magnitudes and temperature.

The .meta property is a Python dictionary, which has some convenient features. For example, we can retrieve the value of an individual keyword as follows:

[13]:
klc.meta['QUARTER']
[13]:
4

Alternatively, we can use the .get() method, which accounts for queries that aren’t in the dictionary.

[14]:
klc.meta.get('MISSION')
[14]:
'Kepler'

A feature of the KeplerLightCurve object is that the metadata can also be accessed via user-friendly object properties for convenience. For example, the Kepler Quarter number is directly accessible via the quarter property:

[15]:
klc.quarter
[15]:
4

5. Understanding the Data Arrays and Units#

As we saw above, the KeplerLightCurve object is a table that contains many arrays other than the PDCSAP and SAP fluxes. Detailed information on each of these can be found in the Kepler Archive Manual, Section 2.3.1. Light Curve Files.

The first six columns appear in all KeplerLightCurve objects, and contain the most commonly used information. These are:

  • time: the time measurements at each cadence.

  • flux: the flux of the target star at each time measurement. This is populated with PDCSAP flux by default.

  • flux_err: the statistical uncertainty on each flux data point.

  • quality: information on the data quality at each time measurement.

  • centroid_col & centroid_row: the position of the target star on the CCD at each observation. This changes over time due to, for example, small jitters of the spacecraft.

The remaining columns are more detailed information on the observation. Some of these are duplicated in the first five columns described above:

  • timecorr: correction values that allow users to revert back to non-barycentric timestamps.

  • cadenceno: these are mission-specific identifiers of each exposure.

  • sap_flux & sap_flux_err: the SAP flux and associated error.

  • sap_bkg & sap_bkg_err: the calculated background (and associated error) inside the aperture used to calculate the SAP flux.

  • pdcsap_flux & pdcsap_flux_err: the PDCSAP flux and associated error. Duplicated by default in flux and flux_err.

  • sap_quality: information on the data quality at each time measurement. Duplicated in quality.

  • psf_centr1 & psf_centr2 (and errors): the column and row centroid positions of a PSF model fit to the target star.

  • mom_centr1 & mom_centr2 (and errors): the column and row centroid positions of the target star, weighted by flux. Duplicated in centroid_col and centroid_row respectively.

  • pos_corr1 & pos_corr2: the column and row components of the calculated image motion.

These columns can be accessed as properties of the KeplerLightCurve , for example, as follows:

[16]:
klc.sap_bkg
[16]:
$[1672.2699,~1669.84,~1673.1306,~\dots,~1498.2946,~1498.7802,~1497.7747] \; \mathrm{\frac{e^{-}}{s}}$

The unit information of the arrays are stored using Astropy’s `astropy.units <https://docs.astropy.org/en/stable/units/>`__ module, which means that they are an Astropy `Quantity <https://docs.astropy.org/en/stable/api/astropy.units.Quantity.html#astropy.units.Quantity>`__ object. We can view the units as follows:

[17]:
print(f'Centroid column unit: {klc.centroid_col.unit}')
print(f'Flux unit: {klc.flux.unit}')
Centroid column unit: pix
Flux unit: electron / s

You can access the data in the form of a standard NumPy array using the value attribute:

[18]:
klc.centroid_col.value
[18]:
MaskedNDArray([682.69124789, 682.69084371, 682.6903808 , ...,
               682.49103683, 682.49113696, 682.49069432])

We can also plot the data using the KeplerLightCurve’s plot() method by passing a column keyword argument:

[19]:
ax = klc.plot(column='mom_centr1', label='Flux-weighted column position')
klc.plot(ax=ax, column='psf_centr1', label='PSF centroid column position');
../../_images/tutorials_1-getting-started_using-light-curve-file-products_58_0.png

Finally, the .time property is a little different. Instead of an Astropy Quantity object, it is an Astropy `Time <https://docs.astropy.org/en/stable/time/>`__ object, and has some additional time scale and format information.

[20]:
klc.time
[20]:
<Time object: scale='tdb' format='bkjd' value=[352.37632485 352.39675805 352.43762445 ... 442.16263546 442.18306983
 442.2035041 ]>
[21]:
print(f'Time scale: {klc.time.scale}')
print(f'Time format: {klc.time.format}')
Time scale: tdb
Time format: bkjd

Here, the time format is the unit of time, in this case Barycentric Kepler Julian Date (BKJD). The time scale indicates how the time is measured, in this case by taking the Barycentric Dynamical Time (TDB). This detailed information may be important when comparing observations of a periodic event (such as a planet transit) with observations made with other telescopes on Earth.

Exercises#

Some stars, such as Kepler-10, have been observed both with Kepler and TESS. In this exercise, download and plot the TESS PDCSAP flux only. You can do this by either selecting it from the SearchResult returned by `search_lightcurve() <https://docs.lightkurve.org/reference/api/lightkurve.search_lightcurve.html?highlight=search_lightcurve>`__ or by using the mission keyword argument when searching.

[22]:
#search_result = lk.search_lightcurvefile(...)
[23]:
# Solution:
search_result = lk.search_lightcurve('Kepler-10', mission='TESS')
search_result
[23]:
SearchResult containing 47 data products.
#missionyearauthorexptimetarget_namedistance
sarcsec
0TESS Sector 142019SPOC1203777807900.0
1TESS Sector 402021SPOC203777807900.0
2TESS Sector 412021SPOC203777807900.0
3TESS Sector 402021SPOC1203777807900.0
4TESS Sector 412021SPOC1203777807900.0
5TESS Sector 552022SPOC203777807900.0
6TESS Sector 542022SPOC203777807900.0
7TESS Sector 532022SPOC203777807900.0
8TESS Sector 552022SPOC1203777807900.0
9TESS Sector 542022SPOC1203777807900.0
10TESS Sector 532022SPOC1203777807900.0
11TESS Sector 802024SPOC1203777807900.0
12TESS Sector 812024SPOC1203777807900.0
13TESS Sector 742024SPOC1203777807900.0
14TESS Sector 752024SPOC1203777807900.0
15TESS Sector 142019TESS-SPOC18003777807900.0
16TESS Sector 152019TESS-SPOC18003777807900.0
17TESS Sector 262020TESS-SPOC18003777807900.0
18TESS Sector 412021TESS-SPOC6003777807900.0
19TESS Sector 402021TESS-SPOC6003777807900.0
20TESS Sector 542022TESS-SPOC6003777807900.0
.....................
25TESS Sector 262020QLP18003777807900.0
26TESS Sector 412021QLP6003777807900.0
27TESS Sector 402021QLP6003777807900.0
28TESS Sector 542022QLP6003777807900.0
29TESS Sector 552022QLP6003777807900.0
30TESS Sector 532022QLP6003777807900.0
31TESS Sector 742024QLP2003777807900.0
32TESS Sector 752024QLP2003777807900.0
33TESS Sector 142019TASOC1203777807900.0
34TESS Sector 152019TASOC18003777807900.0
35TESS Sector 152019TASOC18003777807900.0
36TESS Sector 142019TASOC18003777807900.0
37TESS Sector 142019TASOC18003777807900.0
38TESS Sector 152019CDIPS18003777807900.0
39TESS Sector 262020TASOC18003777807900.0
40TESS Sector 262020CDIPS18003777807900.0
41TESS Sector 262020TASOC18003777807900.0
42TESS Sector 412021CDIPS18003777807900.0
43TESS Sector 402021CDIPS18003777807900.0
44TESS Sector 552022CDIPS18003777807900.0
45TESS Sector 542022CDIPS18003777807900.0
46TESS Sector 532022CDIPS18003777807900.0
Length = 47 rows
[24]:
search_result.download().plot();
/Users/tapritc2/tessgi/lightkurve_party/lightkurve/src/lightkurve/search.py:424: LightkurveWarning: Warning: 47 files available to download. Only the first file has been downloaded. Please use `download_all()` or specify additional criteria (e.g. quarter, campaign, or sector) to limit your search.
  warnings.warn(
../../_images/tutorials_1-getting-started_using-light-curve-file-products_67_1.png

About this Notebook#

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

Updated On: 2020-08-31

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.

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

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