lightkurve.KeplerTargetPixelFile.plot_pixels#

KeplerTargetPixelFile.plot_pixels(ax=None, periodogram=False, aperture_mask=None, show_flux=False, corrector_func=None, style='lightkurve', title=None, markersize=0.5, **kwargs)#

Show the light curve of each pixel in a single plot.

Note that all values are autoscaled and axis labels are not provided. This utility is designed for by-eye inspection of signal morphology.

Parameters
axAxes

A matplotlib axes object to plot into. If no axes is provided, a new one will be generated.

periodogrambool

Default: False; if True, periodograms will be plotted, using normalized light curves. Note that this keyword overrides normalized.

aperture_maskndarray or str

Highlight pixels selected by aperture_mask. Only pipeline, threshold, or custom masks will be plotted. all and None masks will be ignored.

show_fluxbool

Default: False; if True, shade pixels with frame 0 flux colour Inspired by https://github.com/noraeisner/LATTE

corrector_funcfunction

Function that accepts and returns a LightCurve. This function is applied to each pixel’s light curve. The default is to return a 5 sigma-clipped light curve.

stylestr

Path or URL to a matplotlib style file, or name of one of matplotlib’s built-in stylesheets (e.g. ‘ggplot’). Lightkurve’s custom stylesheet is used by default.

markersizefloat

Size of the markers in the lightcurve plot. For periodogram plot, it is used as the line width. Default: 0.5

kwargsdict

e.g. extra parameters to be passed to to_periodogram.

Examples

Inspect the lightcurve around a possible transit at per-pixel level:

>>> import lightkurve as lk
>>> # A possible transit around time BTJD 2277.0. Inspect the lightcurve around that time
>>> tpf = tpf[(tpf.time.value >= 2276.5) & (tpf.time.value <= 2277.5)]    
>>> tpf.plot_pixels(aperture_mask='pipeline')  
>>>
>>> # Variation: shade the pixel based on the flux at frame 0
>>> # increase markersize so that it is more legible for pixels with yellow background (the brightest pixels)
>>> tpf.plot_pixels(aperture_mask='pipeline', show_flux=True, markersize=1.5)  
>>>
>>> # Variation: Customize the plot's size so that each pixel is about 1 inch by 1 inch
>>> import matplotlib.pyplot as plt
>>> fig = plt.figure(figsize=(tpf.flux[0].shape[1] * 1.0, tpf.flux[0].shape[0] * 1.0))    
>>> tpf.plot_pixels(ax=fig.gca(), aperture_mask='pipeline')