class lightkurve.correctors.PLDCorrector(tpf)

Bases: object

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

Pixel Level Decorrelation (PLD) was developed by [1] to remove systematic noise caused by spacecraft jitter for the Spitzer Space Telescope. It was adapted to K2 data by [2] and [3] for the EVEREST pipeline [4].

For a detailed description and implementation of PLD, please refer to these references. Lightkurve provides a reference implementation of PLD that is less sophisticated than EVEREST, but is suitable for quick-look analyses and detrending experiments.

Our simple implementation of PLD is performed by first calculating the noise model for each cadence in time. This function goes up to second order, and is represented by

\[m_i = \sum_l a_l \frac{f_{il}}{\sum_k f_{ik}} + \sum_l \sum_m b_{lm} \frac{f_{il}f_{im}}{\left( \sum_k f_{ik} \right)^2} + \alpha + \beta t_i + \gamma t_i^2\]


  • \(m_i\) is the noise model at time \(t_i\)
  • \(f_{il}\) is the flux in the \(l^\text{th}\) pixel at time \(t_i\)
  • \(a_l\) is the first-order PLD coefficient on the linear term
  • \(b_{lm}\) is the second-order PLD coefficient on the \(l^\text{th}\), \(m^\text{th}\) pixel pair
  • \(\alpha\), \(\beta\), and \(\gamma\) are the Gaussian Process terms applied to capture long-period variability.

We perform Principal Component Analysis (PCA) to reduce the number of vectors in our final model to limit the set to best capture instrumental noise. With a PCA-reduced set of vectors, we can construct a design matrix containing first and second order fractional pixel fluxes.

To solve for the PLD model, we need to minimize the difference squared

\[\chi^2 = \sum_i \frac{(y_i - m_i)^2}{\sigma_i^2},\]

where \(y_i\) is the observed flux value at time \(t_i\), by solving

\[\frac{\partial \chi^2}{\partial a_l} = 0.\]


[1](1, 2) Deming et al. (2015), ads:2015ApJ…805..132D. (arXiv:1411.7404)
[2](1, 2) Luger et al. (2016), ads:2016AJ….152..100L (arXiv:1607.00524)
[3](1, 2) Luger et al. (2018), ads:2018AJ….156…99L (arXiv:1702.05488)
[4](1, 2) EVEREST pipeline webpage,


Download the pixel data for GJ 9827 and obtain a PLD-corrected light curve:

>>> import lightkurve as lk
>>> tpf = lk.search_targetpixelfile("GJ9827").download() # doctest: +SKIP
>>> corrector = lk.PLDCorrector(tpf) # doctest: +SKIP
>>> lc = corrector.correct() # doctest: +SKIP
>>> lc.plot() # doctest: +SKIP

However, the above example will over-fit the small transits! It is necessary to mask the transits using corrector.correct(cadence_mask=...).

Methods Summary

correct([aperture_mask, cadence_mask, …]) Returns a PLD systematics-corrected LightCurve.

Methods Documentation

correct(aperture_mask=None, cadence_mask=None, gp_timescale=30, n_components_first=None, n_components_second=20, use_gp=True)

Returns a PLD systematics-corrected LightCurve.

aperture_mask : array-like, ‘pipeline’, ‘all’, ‘threshold’, or None

A boolean array describing the aperture such that True means that the pixel will be used. If None or ‘all’ are passed, all pixels will be used. If ‘pipeline’ is passed, the mask suggested by the official pipeline will be returned. If ‘threshold’ is passed, all pixels brighter than 3-sigma above the median flux will be used.

cadence_mask : array-like

A mask that will be applied to the cadences prior to constructing the detrending model. For example, you can pass a boolean array of length n_cadences where True means that the cadence will be included in the noise model. You may also pass an array of indices. This option enables signals of interest (e.g. planet transits) to be excluded from the noise model, which will prevent over-fitting. By default, no cadences will be masked.

gp_timescale : float

Gaussian Process time scale length term (tau) used to define length of fit variability in days.

n_components_first : int

Number of first-order PLD components to reduce to with PCA. Must be smaller than the number of pixels in the aperture mask. If None, then 25 or the number of pixels in the mask will be used, whichever is smaller.

n_components_second : int

Number of second-order PLD components to reduce to with PCA.

use_gp : boolean

Option to turn GP fitting on or off.

corrected_lightcurve : LightCurve

Returns a corrected lightcurve object. Depending on the input, the returned object will be a KeplerLightCurve, TessLightCurve, or general LightCurve object.

Created with ♥ by the Lightkurve developers. Join us on GitHub.