A friendly package for Kepler & TESS time series analysis in Python.
npx @tessl/cli install tessl/pypi-lightkurve@2.5.0A comprehensive Python library for analyzing time series data from NASA's Kepler and TESS space telescopes. Lightkurve provides user-friendly tools for downloading, processing, analyzing, and visualizing astronomical flux data, enabling both basic exploratory analysis and sophisticated automated pipelines for exoplanet detection and stellar variability studies.
pip install lightkurveimport lightkurve as lkFor specific functionality:
from lightkurve import LightCurve, TargetPixelFile, search_lightcurve, read, openimport lightkurve as lk
import astropy.units as u
# Search for Kepler data
search_result = lk.search_lightcurve('Kepler-10')
# Download the first light curve
lc = search_result[0].download()
# Basic processing
lc = lc.remove_nans().normalize()
# Create a periodogram to find planets
periodogram = lc.to_periodogram()
# Plot the light curve
lc.plot()
# Fold the light curve at a specific period
folded_lc = lc.fold(period=0.84 * u.day)
folded_lc.plot()Lightkurve is built around several core data containers and analysis tools:
LightCurve and TargetPixelFile classes represent time series and pixel-level data respectivelyThe library integrates seamlessly with the scientific Python ecosystem, building on NumPy, SciPy, Matplotlib, and Astropy.
Search and download time series data from NASA's space telescope archives, including Kepler, K2, and TESS missions with support for multiple data products and pipelines.
def search_lightcurve(target, **kwargs):
"""Search for light curve files in MAST archives"""
def search_targetpixelfile(target, **kwargs):
"""Search for target pixel files in MAST archives"""
def search_tesscut(target, size, **kwargs):
"""Search for TESS full frame image cutouts"""
class SearchResult:
"""Container for search results with download capabilities"""
def download(self, **kwargs): ...
def download_all(self, **kwargs): ...Light curves and target pixel files are the fundamental data containers, providing rich functionality for time series analysis and visualization.
class LightCurve:
"""Time series data with time, flux, and flux_err columns"""
def __init__(self, time=None, flux=None, flux_err=None, **kwargs): ...
def plot(self, **kwargs): ...
def remove_outliers(self, **kwargs): ...
def normalize(self, **kwargs): ...
def fold(self, period, **kwargs): ...
class TargetPixelFile:
"""Pixel-level time series data from space telescopes"""
def to_lightcurve(self, **kwargs): ...
def plot(self, **kwargs): ...
def interact(self, **kwargs): ...Comprehensive periodogram analysis for detecting periodic signals, including specialized algorithms for transit detection and stellar oscillations.
class Periodogram:
"""Power spectrum representation with peak detection"""
def plot(self, **kwargs): ...
def show_properties(self): ...
class LombScarglePeriodogram(Periodogram):
"""Lomb-Scargle periodogram for unevenly sampled data"""
class BoxLeastSquaresPeriodogram(Periodogram):
"""Box Least Squares periodogram for transit detection"""Advanced algorithms for removing instrumental systematics and improving photometric precision, essential for detecting small astrophysical signals.
class PLDCorrector:
"""Pixel Level Decorrelation for removing systematic noise"""
def correct(self, **kwargs): ...
class CBVCorrector:
"""Cotrending Basis Vector correction using pre-computed vectors"""
def correct(self, **kwargs): ...
class SFFCorrector:
"""Self Flat Fielding for K2 data correction"""
def correct(self, **kwargs): ...Sophisticated PSF modeling and photometry for extracting precise light curves from pixel data, particularly useful for crowded fields and faint targets.
class KeplerPRF:
"""Kepler Point Response Function model"""
def evaluate(self, **kwargs): ...
class PRFPhotometry:
"""High-level interface for PRF photometry analysis"""
def fit(self, **kwargs): ...Point Spread Function Modeling
Specialized tools for analyzing stellar oscillations and deriving fundamental stellar properties from seismic parameters.
class Seismology:
"""Asteroseismology analysis for stellar oscillations"""
def estimate_numax(self, **kwargs): ...
def estimate_deltanu(self, **kwargs): ...
def estimate_radius(numax, deltanu, teff): ...
def estimate_mass(numax, deltanu, teff): ...# Time formats for space telescope data
class TimeBKJD:
"""Barycentric Kepler Julian Date"""
class TimeBTJD:
"""Barycentric TESS Julian Date"""
# Quality flag decoders
class KeplerQualityFlags:
"""Decoder for Kepler data quality flags"""
class TessQualityFlags:
"""Decoder for TESS data quality flags"""
# Configuration
class Conf:
"""Configuration parameters for lightkurve"""
cache_dir: str
search_result_display_extra_columns: list