Binder badge

What are LightCurveFile objects?

In the previous tutorial we looked at LightCurve objects, which contain time and flux points. Now we will look at LightCurveFiles. Rather than being generated by you using a Target Pixel File, these files have been pregenerated using NASA’s Kepler Data Processing Pipeline. Usually, you will access these files through the MAST archive.

We will demonstrate the difference between a LightCurve and a LightCurveFile using data from Kepler.

Kepler light curves from MAST have some level of processing (more details here) and allow you to access the two kinds of flux; the SAP flux and the PDCSAP flux. SAP flux is Simple Aperture Photometry flux, the same as we made in the previous tutorial. PDCSAP is the Pre-search Data Conditioning SAP flux. Long term trends have been removed from this data using so-called Cotrending Basis Vectors (CBVs). PDCSAP flux is usually cleaner data than the SAP flux and will have fewer systematic trends.

We can read in a light curve file from the Kepler mission using KeplerLightCurveFile. We can use the search_lightcurvefile() function to fetch them from the data archive:

from lightkurve import search_lightcurvefile
lcf = search_lightcurvefile('KIC 6922244', quarter=4).download()

lcf is now a KeplerLightCurveFile object. In this case it contains two KeplerLightCurve objects, one for the SAP flux and one for the PDCSAP flux. The plot method on a KeplerLightCurveFile object will plot up both of these.


We can see that the PDCSAP flux is flatter. To work more with this data we must choose which type of flux we want to work with. Let’s choose PDCSAP flux:

pdcsap = lcf.PDCSAP_FLUX

You can choose SAP flux in a similar way using

sapflux = lcf.SAP_FLUX
KeplerLightCurveFile(ID: 6922244)
KeplerLightCurve(ID: 6922244)

This has created a KeplerLightCurve object. The only flux it contains is the PDCSAP flux. This has the same methods we used in the previous tutorial. For example you can check the meta data and the CDPP noise metric: