A friendly package for Kepler & TESS time series analysis in Python.
npx @tessl/cli install tessl/pypi-lightkurve@2.5.00
# Lightkurve
1
2
A 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.
3
4
## Package Information
5
6
- **Package Name**: lightkurve
7
- **Package Type**: pypi
8
- **Language**: Python
9
- **Installation**: `pip install lightkurve`
10
11
## Core Imports
12
13
```python
14
import lightkurve as lk
15
```
16
17
For specific functionality:
18
19
```python
20
from lightkurve import LightCurve, TargetPixelFile, search_lightcurve, read, open
21
```
22
23
## Basic Usage
24
25
```python
26
import lightkurve as lk
27
import astropy.units as u
28
29
# Search for Kepler data
30
search_result = lk.search_lightcurve('Kepler-10')
31
32
# Download the first light curve
33
lc = search_result[0].download()
34
35
# Basic processing
36
lc = lc.remove_nans().normalize()
37
38
# Create a periodogram to find planets
39
periodogram = lc.to_periodogram()
40
41
# Plot the light curve
42
lc.plot()
43
44
# Fold the light curve at a specific period
45
folded_lc = lc.fold(period=0.84 * u.day)
46
folded_lc.plot()
47
```
48
49
## Architecture
50
51
Lightkurve is built around several core data containers and analysis tools:
52
53
- **Data Containers**: `LightCurve` and `TargetPixelFile` classes represent time series and pixel-level data respectively
54
- **Collections**: Group multiple data files together for batch processing
55
- **Search Functions**: Query and download data from MAST archives
56
- **Analysis Tools**: Periodograms, correctors, and specialized analysis classes
57
- **Utilities**: Time formats, quality flags, and helper functions designed for space telescope data
58
59
The library integrates seamlessly with the scientific Python ecosystem, building on NumPy, SciPy, Matplotlib, and Astropy.
60
61
## Capabilities
62
63
### Data Search and Access
64
65
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.
66
67
```python { .api }
68
def search_lightcurve(target, **kwargs):
69
"""Search for light curve files in MAST archives"""
70
71
def search_targetpixelfile(target, **kwargs):
72
"""Search for target pixel files in MAST archives"""
73
74
def search_tesscut(target, size, **kwargs):
75
"""Search for TESS full frame image cutouts"""
76
77
class SearchResult:
78
"""Container for search results with download capabilities"""
79
def download(self, **kwargs): ...
80
def download_all(self, **kwargs): ...
81
```
82
83
[Data Search and Access](./data-search.md)
84
85
### Core Data Objects
86
87
Light curves and target pixel files are the fundamental data containers, providing rich functionality for time series analysis and visualization.
88
89
```python { .api }
90
class LightCurve:
91
"""Time series data with time, flux, and flux_err columns"""
92
def __init__(self, time=None, flux=None, flux_err=None, **kwargs): ...
93
def plot(self, **kwargs): ...
94
def remove_outliers(self, **kwargs): ...
95
def normalize(self, **kwargs): ...
96
def fold(self, period, **kwargs): ...
97
98
class TargetPixelFile:
99
"""Pixel-level time series data from space telescopes"""
100
def to_lightcurve(self, **kwargs): ...
101
def plot(self, **kwargs): ...
102
def interact(self, **kwargs): ...
103
```
104
105
[Core Data Objects](./core-data.md)
106
107
### Time Series Analysis
108
109
Comprehensive periodogram analysis for detecting periodic signals, including specialized algorithms for transit detection and stellar oscillations.
110
111
```python { .api }
112
class Periodogram:
113
"""Power spectrum representation with peak detection"""
114
def plot(self, **kwargs): ...
115
def show_properties(self): ...
116
117
class LombScarglePeriodogram(Periodogram):
118
"""Lomb-Scargle periodogram for unevenly sampled data"""
119
120
class BoxLeastSquaresPeriodogram(Periodogram):
121
"""Box Least Squares periodogram for transit detection"""
122
```
123
124
[Time Series Analysis](./time-series-analysis.md)
125
126
### Systematics Correction
127
128
Advanced algorithms for removing instrumental systematics and improving photometric precision, essential for detecting small astrophysical signals.
129
130
```python { .api }
131
class PLDCorrector:
132
"""Pixel Level Decorrelation for removing systematic noise"""
133
def correct(self, **kwargs): ...
134
135
class CBVCorrector:
136
"""Cotrending Basis Vector correction using pre-computed vectors"""
137
def correct(self, **kwargs): ...
138
139
class SFFCorrector:
140
"""Self Flat Fielding for K2 data correction"""
141
def correct(self, **kwargs): ...
142
```
143
144
[Systematics Correction](./systematics-correction.md)
145
146
### Point Spread Function Modeling
147
148
Sophisticated PSF modeling and photometry for extracting precise light curves from pixel data, particularly useful for crowded fields and faint targets.
149
150
```python { .api }
151
class KeplerPRF:
152
"""Kepler Point Response Function model"""
153
def evaluate(self, **kwargs): ...
154
155
class PRFPhotometry:
156
"""High-level interface for PRF photometry analysis"""
157
def fit(self, **kwargs): ...
158
```
159
160
[Point Spread Function Modeling](./prf-modeling.md)
161
162
### Asteroseismology
163
164
Specialized tools for analyzing stellar oscillations and deriving fundamental stellar properties from seismic parameters.
165
166
```python { .api }
167
class Seismology:
168
"""Asteroseismology analysis for stellar oscillations"""
169
def estimate_numax(self, **kwargs): ...
170
def estimate_deltanu(self, **kwargs): ...
171
172
def estimate_radius(numax, deltanu, teff): ...
173
def estimate_mass(numax, deltanu, teff): ...
174
```
175
176
[Asteroseismology](./asteroseismology.md)
177
178
## Types
179
180
```python { .api }
181
# Time formats for space telescope data
182
class TimeBKJD:
183
"""Barycentric Kepler Julian Date"""
184
185
class TimeBTJD:
186
"""Barycentric TESS Julian Date"""
187
188
# Quality flag decoders
189
class KeplerQualityFlags:
190
"""Decoder for Kepler data quality flags"""
191
192
class TessQualityFlags:
193
"""Decoder for TESS data quality flags"""
194
195
# Configuration
196
class Conf:
197
"""Configuration parameters for lightkurve"""
198
cache_dir: str
199
search_result_display_extra_columns: list
200
```