A friendly package for Kepler & TESS time series analysis in Python.
—
Tools for searching and downloading time series data from NASA's space telescope archives, supporting Kepler, K2, and TESS missions with various data products and processing pipelines.
Search for processed light curve files from various pipelines including official mission products and High Level Science Products (HLSPs).
def search_lightcurve(target, mission=None, author=None, exptime=None, **kwargs):
"""
Search for light curve files in MAST archives.
Parameters:
- target: str, int, or SkyCoord - Target identifier (name, KIC/TIC ID, or coordinates)
- mission: str or list - Mission name ('Kepler', 'K2', 'TESS')
- author: str or list - Data product author/pipeline ('Kepler', 'SPOC', 'QLP', 'TASOC', etc.)
- exptime: float or list - Exposure time in seconds
- sector: int or list - TESS sector number
- quarter: int or list - Kepler quarter number
- campaign: int or list - K2 campaign number
Returns:
SearchResult object containing matching data products
"""
def search_lightcurvefile(target, **kwargs):
"""Alias for search_lightcurve function"""Search for target pixel files containing pixel-level time series data for custom aperture photometry and detailed analysis.
def search_targetpixelfile(target, mission=None, author=None, exptime=None, **kwargs):
"""
Search for target pixel files in MAST archives.
Parameters:
- target: str, int, or SkyCoord - Target identifier
- mission: str or list - Mission name ('Kepler', 'K2', 'TESS')
- author: str or list - Data product author/pipeline
- exptime: float or list - Exposure time in seconds
- sector: int or list - TESS sector number
- quarter: int or list - Kepler quarter number
- campaign: int or list - K2 campaign number
Returns:
SearchResult object containing matching target pixel files
"""Search for cutouts from TESS full frame images, enabling analysis of targets not in the target pixel file program.
def search_tesscut(target, sector=None, **kwargs):
"""
Search for TESS full frame image cutouts via TESScut service.
Parameters:
- target: str or SkyCoord - Target identifier or coordinates
- sector: int or list - TESS sector number(s)
Returns:
SearchResult object containing cutout specifications
"""Container class for managing search results with download, filtering, and inspection capabilities.
class SearchResult:
"""
Container for search results with download and filtering capabilities.
Attributes:
- table: astropy.table.Table - Full search results from MAST API
"""
def download(self, quality_bitmask='default', download_dir=None, **kwargs):
"""
Download the first data product.
Parameters:
- quality_bitmask: str or int - Quality flag filtering ('default', 'hard', 'hardest', or int)
- download_dir: str - Local directory for downloaded files
- cache: bool - Whether to cache downloads (default True)
Returns:
LightCurve, TargetPixelFile, or TargetPixelFileCollection
"""
def download_all(self, quality_bitmask='default', download_dir=None, **kwargs):
"""
Download all data products in the search result.
Returns:
LightCurveCollection or TargetPixelFileCollection
"""
def __getitem__(self, key):
"""Access individual search results by index"""
def __len__(self):
"""Number of search results"""
def show_properties(self):
"""Display detailed properties of search results"""import lightkurve as lk
# Search by target name
search_result = lk.search_lightcurve('Kepler-10')
print(f"Found {len(search_result)} light curves")
# Filter by mission and author
kepler_official = lk.search_lightcurve('Kepler-10', mission='Kepler', author='Kepler')
tess_spoc = lk.search_lightcurve('Kepler-10', mission='TESS', author='SPOC')from astropy.coordinates import SkyCoord
# Search using celestial coordinates
coord = SkyCoord(285.67942179, 50.24130576, unit='deg')
search_result = lk.search_lightcurve(coord, mission='TESS')# Download single light curve
lc = search_result[0].download()
# Download all available data
collection = search_result.download_all()
# Apply quality filtering
lc_filtered = search_result[0].download(quality_bitmask='hard')# Get all TESS sectors for a target
all_tess = lk.search_lightcurve('TIC 141914082', mission='TESS')
lc_collection = all_tess.download_all()
# Specific Kepler quarters
q4_q8 = lk.search_lightcurve('KIC 11904151', quarter=[4, 8])# Search and download target pixel files
tpf_search = lk.search_targetpixelfile('Kepler-10b')
tpf = tpf_search[0].download()
# Create custom light curve from pixels
lc_custom = tpf.to_lightcurve(aperture_mask='threshold')# Get cutout for target not in TPF program
cutout_search = lk.search_tesscut('TIC 123456789', size=10)
tpf_cutout = cutout_search.download()Install with Tessl CLI
npx tessl i tessl/pypi-lightkurve