API

This page provides an overview of the Python functions and classes provided by the Lightkurve package.

Programmers tend to refer to a list like this as the API (Application Programming Interface).

Light curves

The lightkurve.lightcurve module provides classes which represent time-series brightness (flux) data. The generic LightCurve class can be used to work with any “time vs flux” data set and provides access to a range of common operations, e.g. bin(), flatten(), fold(), and plot(). There are specific sub-classes for light curves observed by the Kepler and TESS missions, which extend the generic class by adding mission-specific metadata.

LightCurve([time, flux, flux_err, …])

Generic class to work with any time series photometry data set.

KeplerLightCurve([time, flux, flux_err, …])

Subclass of LightCurve which holds extra data specific to the Kepler mission.

TessLightCurve([time, flux, flux_err, …])

Subclass of LightCurve which holds extra data specific to the TESS mission.

Accessing data

The lightkurve.search module provides functions which make it easy to load and search data files produced by the Kepler and TESS missions.

search_targetpixelfile(target[, radius, …])

Searches the public data archive at MAST for a Kepler or TESS TargetPixelFile.

search_lightcurvefile(target[, radius, …])

Searches the public data archive at MAST for a Kepler or TESS LightCurveFile.

search_tesscut(target[, sector])

Searches MAST for TESS Full Frame Image cutouts containing a desired target or region.

open(path_or_url, \*\*kwargs)

Opens any valid Kepler or TESS data file and returns an instance of LightCurveFile or TargetPixelFile.

SearchResult([table])

Container for the results returned by search_targetpixelfile, search_lightcurvefile, and search_tesscut.

Data file classes

Lightkurve provides classes to interact with the files that are generated by NASA’s Kepler and TESS data processing pipelines and made available at the data archive. The lightkurve.lightcurvefile module provides classes which represent FITS files that store one or more light curves. These classes provide methods to read in LightCurve objects and access various metadata.

LightCurveFile(path, **kwargs)

Generic class to represent FITS files which contain one or more light curves.

KeplerLightCurveFile(path[, quality_bitmask])

Subclass of LightCurveFile to represent files generated by NASA’s Kepler pipeline.

TessLightCurveFile(path[, quality_bitmask])

Subclass of LightCurveFile to represent files generated by NASA’s TESS pipeline.

The lightkurve.targetpixelfile module provides classes which represent FITS files that store the original pixel data (images) obtained by the Kepler or TESS telescopes. These classes provide methods to visualize these data and extract custom light curves.

KeplerTargetPixelFile(path[, quality_bitmask])

Represents pixel data products created by NASA’s Kepler pipeline.

TessTargetPixelFile(path[, quality_bitmask])

Represents pixel data products created by NASA’s TESS pipeline.

Correcting systematics

Telescope data is always affected by systematic noise contributed by the detector. The lightkurve.correctors module provides classes which offer different strategies to remove such noise:

SFFCorrector(lightcurve)

Implements the Self-Flat-Fielding (SFF) systematics removal method.

PLDCorrector(tpf)

Implements the Pixel Level Decorrelation (PLD) systematics removal method.

KeplerCBVCorrector(lc[, cbv_array, …])

Remove systematic trends from Kepler light curves by fitting Cotrending Basis Vectors (CBVs).

Finding periodic signals

The lightkurve.periodogram module provides classes to help find periodic signals in light curves.

Periodogram(frequency, power[, nyquist, …])

Generic class to represent a power spectrum (frequency vs power data).

LombScarglePeriodogram(*args, **kwargs)

Subclass of Periodogram representing a power spectrum generated using the Lomb Scargle method.

BoxLeastSquaresPeriodogram(*args, **kwargs)

Subclass of Periodogram representing a power spectrum generated using the Box Least Squares (BLS) method.

Utilities

The lightkurve.utils module provides a range of common helper functions and classes.

LightkurveWarning

Class for all Lightkurve warnings.

KeplerQualityFlags

This class encodes the meaning of the various Kepler QUALITY bitmask flags, as documented in the Kepler Archive Manual (Ref.

TessQualityFlags

This class encodes the meaning of the various TESS QUALITY bitmask flags, as documented in the TESS Data Products Description Document (Ref.

bkjd_to_astropy_time(bkjd[, bjdref])

Converts BKJD time values to an astropy.time.Time object.

btjd_to_astropy_time(btjd[, bjdref])

Converts BTJD time values to an astropy.time.Time object.

Can’t find what you’re looking for?

If you are looking for a specific class or function not listed here, try consulting the API index or search pages:


Created with ♥ by the Lightkurve collaboration. Please cite us or join us on GitHub.