Downloading data#

Searching the Kepler & TESS archive#

Lightkurve provides three functions which make it easy to search and download TESS and Kepler data products from the public data archive at MAST.

search_targetpixelfile(target[, radius, ...])

Search the MAST data archive for target pixel files.

search_lightcurve(target[, radius, exptime, ...])

Search the MAST data archive for light curves.

search_tesscut(target[, sector])

Search the MAST TESSCut service for a region of sky that is available as a TESS Full Frame Image cutout.

Downloading data products#

The search functions listed above return a SearchResult object, which provides an easy way to select and download data.

SearchResult([table])

Container for the results returned by the search functions.

SearchResult.download([quality_bitmask, ...])

Download and open the first data product in the search result.

SearchResult.download_all([quality_bitmask, ...])

Download and open all data products in the search result.

Filtering search results#

The SearchResult object provides convenient access to the essential metadata, which enables the search results to be filtered. For example, a search result can be filtered by exposure time using result = result[result.exptime.value < 100].

SearchResult.mission

Kepler quarter or TESS sector names for each data product found.

SearchResult.year

Year the observation was made.

SearchResult.author

Pipeline name for each data product found.

SearchResult.target_name

Target name for each data product found.

SearchResult.exptime

Exposure time for each data product found.

SearchResult.distance

Distance from the search position for each data product found.

SearchResult.ra

Right Ascension coordinate for each data product found.

SearchResult.dec

Declination coordinate for each data product found.

SearchResult.table

Table containing the full search results returned by the MAST API.

Customizing search results display#

Users can optionally include a list of extra columns in the default display of SearchResult objects.

SearchResult.display_extra_columns

A list of extra columns to be included in the default display of the search result.

Data products collection#

SearchResult.download_all returns a LightCurveCollection or a TargetPixelFileCollection object. They contain the data products, along with some convenience functions.

A collection can also be further filtered using standard Python list syntax, and a subset of numpy.ndarray syntax. For example, a collection can be filtered by TESS sectors using lcc[(lcc.sector >= 13) & (lcc.sector <= 19)].

LightCurveCollection(lightcurves)

Class to hold a collection of LightCurve objects.

LightCurveCollection.stitch([corrector_func])

Stitch all light curves in the collection into a single LightCurve.

LightCurveCollection.plot([ax, offset])

Plots all light curves in the collection on a single plot.

LightCurveCollection.append(obj)

Appends a new object to the collection.

LightCurveCollection.campaign

(K2-specific) the campaigns of the lightcurves / target pixel files.

LightCurveCollection.quarter

(Kepler-specific) the quarters of the lightcurves / target pixel files.

LightCurveCollection.sector

(TESS-specific) the quarters of the lightcurves / target pixel files.

TargetPixelFileCollection(tpfs)

Class to hold a collection of TargetPixelFile objects.

TargetPixelFileCollection.plot([ax])

Individually plots all TargetPixelFile objects in a single matplotlib axes object.

TargetPixelFileCollection.append(obj)

Appends a new object to the collection.

TargetPixelFileCollection.campaign

(K2-specific) the campaigns of the lightcurves / target pixel files.

TargetPixelFileCollection.quarter

(Kepler-specific) the quarters of the lightcurves / target pixel files.

TargetPixelFileCollection.sector

(TESS-specific) the quarters of the lightcurves / target pixel files.