KeplerLightCurveFile

class lightkurve.lightcurvefile.KeplerLightCurveFile(path, quality_bitmask='default', **kwargs)

Bases: lightkurve.lightcurvefile.LightCurveFile

Subclass of LightCurveFile to represent files generated by NASA’s Kepler pipeline.

Parameters
pathstr

Local path or remote url of a FITS file in Kepler’s lightcurve format.

quality_bitmaskstr or int

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 (quality_bitmask=0).

  • “default”: cadences with severe quality issues will be ignored (quality_bitmask=1130799).

  • “hard”: more conservative choice of flags to ignore (quality_bitmask=1664431). This is known to remove good data.

  • “hardest”: removes all data that has been flagged (quality_bitmask=2096639). This mask is not recommended.

See the KeplerQualityFlags class for details on the bitmasks.

kwargsdict

Keyword arguments to be passed to astropy.io.fits.open.

Attributes Summary

FLUX

Returns a LightCurve object based on the contents of the FLUX column in the file, if that column exists.

PDCSAP_FLUX

Returns a LightCurve object based on the contents of the PDCSAP_FLUX column in the file, if that column exists.

SAP_FLUX

Returns a LightCurve object based on the contents of the SAP_FLUX column in the file, if that column exists.

astropy_time

Returns an AstroPy Time object for all good-quality cadences.

cadenceno

The file’s CADENCENO column.

campaign

K2 Campaign number.

channel

Kepler CCD channel number.

dec

Declination as recorded in the header’s DEC_OBJ keyword.

mission

‘Kepler’ or ‘K2’.

obsmode

‘short cadence’ or ‘long cadence’.

pos_corr1

Returns the column position correction.

pos_corr2

Returns the row position correction.

quarter

Kepler quarter number.

ra

Right Ascension as recorded in the header’s RA_OBJ keyword.

time

The file’s TIME column.

Methods Summary

compute_cotrended_lightcurve(self[, cbvs])

Returns a LightCurve object after cotrending the SAP_FLUX against the cotrending basis vectors.

errorbar(self[, flux_types, style])

Plot the light curve file using matplotlib’s errorbar method.

get_keyword(self, keyword[, hdu, default])

Returns a header keyword value.

get_lightcurve(self, flux_type[, centroid_type])

header(self[, ext])

Header of the object at extension ext

plot(self[, flux_types, style])

Plot the light curve file using matplotlib’s plot method.

scatter(self[, flux_types, style])

Plot the light curve file using matplotlib’s scatter method.

Attributes Documentation

FLUX

Returns a LightCurve object based on the contents of the FLUX column in the file, if that column exists.

PDCSAP_FLUX

Returns a LightCurve object based on the contents of the PDCSAP_FLUX column in the file, if that column exists.

SAP_FLUX

Returns a LightCurve object based on the contents of the SAP_FLUX column in the file, if that column exists.

astropy_time

Returns an AstroPy Time object for all good-quality cadences.

cadenceno

The file’s CADENCENO column.

campaign

K2 Campaign number. (‘CAMPAIGN’ header keyword)

channel

Kepler CCD channel number. (‘CHANNEL’ header keyword)

dec

Declination as recorded in the header’s DEC_OBJ keyword.

mission

‘Kepler’ or ‘K2’. (‘MISSION’ header keyword)

obsmode

‘short cadence’ or ‘long cadence’. (‘OBSMODE’ header keyword)

pos_corr1

Returns the column position correction.

pos_corr2

Returns the row position correction.

quarter

Kepler quarter number. (‘QUARTER’ header keyword)

ra

Right Ascension as recorded in the header’s RA_OBJ keyword.

time

The file’s TIME column.

Methods Documentation

compute_cotrended_lightcurve(self, cbvs=(1, 2), **kwargs)

Returns a LightCurve object after cotrending the SAP_FLUX against the cotrending basis vectors.

Parameters
cbvstuple or list of ints

The list of cotrending basis vectors to fit to the data. For example, (1, 2) will fit the first two basis vectors.

kwargsdict

Dictionary of keyword arguments to be passed to KeplerCBVCorrector.correct.

Returns
lcLightCurve object

CBV flux-corrected lightcurve.

errorbar(self, flux_types=None, style='lightkurve', **kwargs)

Plot the light curve file using matplotlib’s errorbar method.

Parameters
axAxes

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

flux_typeslist or None

Which fluxes in the LCF to plot. Default is lcf._flux_types(). For Kepler this is PDCSAP and SAP flux. Pass a list to change flux types.

normalizebool

Normalize the lightcurve before plotting?

xlabelstr

Plot x axis label

ylabelstr

Plot y axis label

titlestr

Plot set_title

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.

kwargsdict

Dictionary of arguments to be passed to matplotlib.pyplot.plot.

Returns
axAxes

The matplotlib axes object.

get_keyword(self, keyword, hdu=0, default=None)

Returns a header keyword value.

If the keyword is Undefined or does not exist, then return default instead.

get_lightcurve(self, flux_type, centroid_type='MOM_CENTR')
header(self, ext=0)

Header of the object at extension ext

plot(self, flux_types=None, style='lightkurve', **kwargs)

Plot the light curve file using matplotlib’s plot method.

Parameters
axAxes

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

flux_typeslist or None

Which fluxes in the LCF to plot. Default is lcf._flux_types(). For Kepler this is PDCSAP and SAP flux. Pass a list to change flux types.

normalizebool

Normalize the lightcurve before plotting?

xlabelstr

Plot x axis label

ylabelstr

Plot y axis label

titlestr

Plot set_title

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.

kwargsdict

Dictionary of arguments to be passed to matplotlib.pyplot.plot.

Returns
axAxes

The matplotlib axes object.

scatter(self, flux_types=None, style='lightkurve', **kwargs)

Plot the light curve file using matplotlib’s scatter method.

Parameters
axAxes

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

flux_typeslist or None

Which fluxes in the LCF to plot. Default is lcf._flux_types(). For Kepler this is PDCSAP and SAP flux. Pass a list to change flux types.

normalizebool

Normalize the lightcurve before plotting?

xlabelstr

Plot x axis label

ylabelstr

Plot y axis label

titlestr

Plot set_title

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.

kwargsdict

Dictionary of arguments to be passed to matplotlib.pyplot.plot.

Returns
axAxes

The matplotlib axes object.