, **kwargs)[source]

Reads any valid Kepler or TESS data file and returns an instance of LightCurve or TargetPixelFile

This function will automatically detect the type of the data product, and return the appropriate object. File types currently supported include:

* `KeplerTargetPixelFile` (typical suffix "-targ.fits.gz");
* `KeplerLightCurve` (typical suffix "llc.fits");
* `TessTargetPixelFile` (typical suffix "_tp.fits");
* `TessLightCurve` (typical suffix "_lc.fits").

Path or URL of a FITS file.

quality_bitmaskstr or int, optional

Bitmask (integer) which identifies the quality flag bitmask that should be used to mask out bad cadences. If a string is passed, it has the following meaning:

  • “none”: no cadences will be ignored

  • “default”: cadences with severe quality issues will be ignored

  • “hard”: more conservative choice of flags to ignore This is known to remove good data.

  • “hardest”: removes all data that has been flagged This mask is not recommended.

See the KeplerQualityFlags or TessQualityFlags class for details on the bitmasks.

flux_columnstr, optional

(Applicable to LightCurve products only) The column in the FITS file to be read as flux. Defaults to ‘pdcsap_flux’. Typically ‘pdcsap_flux’ or ‘sap_flux’.


Dictionary of arguments to be passed to underlying data product type specific reader.

dataa subclass of LightCurve or TargetPixelFile

depending on the detected file type.

ValueErrorraised if the data product is not recognized as a Kepler or TESS product.


To read a target pixel file using its path or URL, simply use:

>>> import lightkurve as lk
>>> tpf ="mytpf.fits")