lightkurve.TessTargetPixelFile#

class lightkurve.TessTargetPixelFile(path, quality_bitmask='default', **kwargs)[source]#

Represents pixel data products created by NASA’s TESS pipeline.

This class enables extraction of custom light curves and centroid positions.

Parameters
pathstr

Path to a TESS Target Pixel (FITS) File.

quality_bitmask“none”, “default”, “hard”, “hardest”, or int

Bitmask that should be used to ignore bad-quality 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=175).

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

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

If an integer is passed, it will be used as a bitmask, i.e. it will have the effect of removing cadences where (tpf.hdu[1].data['QUALITY'] & quality_bitmask) > 0. See the KeplerQualityFlags class for details on the bitmasks.

kwargsdict

Keyword arguments passed to astropy.io.fits.open().

__init__(path, quality_bitmask='default', **kwargs)[source]#

Methods

__init__(path[, quality_bitmask])

animate([step, interval])

Displays an interactive HTML matplotlib animation.

create_threshold_mask([threshold, ...])

Returns an aperture mask creating using the thresholding method.

cutout([center, size])

Cut a rectangle out of the Target Pixel File.

estimate_background([aperture_mask])

Returns an estimate of the median background level in the FLUX column.

estimate_centroids([aperture_mask, method])

Returns the flux center of an object inside aperture_mask.

extract_aperture_photometry([aperture_mask, ...])

Returns a LightCurve obtained using aperture photometry.

from_fits_images(images_flux, position[, ...])

Creates a new Target Pixel File from a set of images.

get_bkg_lightcurve([aperture_mask])

get_coordinates([cadence])

Returns two 3D arrays of RA and Dec values in decimal degrees.

get_header([ext])

Returns the metadata embedded in the file.

get_keyword(keyword[, hdu, default])

Returns a header keyword value.

interact([notebook_url, max_cadences, ...])

Display an interactive Jupyter Notebook widget to inspect the pixel data.

interact_sky([notebook_url, aperture_mask, ...])

Display a Jupyter Notebook widget showing Gaia DR2 positions on top of the pixels.

plot([ax, frame, cadenceno, bkg, column, ...])

Plot the pixel data for a single frame (i.e.

plot_pixels([ax, periodogram, ...])

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

query_solar_system_objects([cadence_mask, ...])

Returns a list of asteroids or comets which affected the target pixel files.

show_properties()

Prints a description of all non-callable attributes.

to_corrector([method])

Returns a Corrector instance to remove systematics.

to_fits([output_fn, overwrite])

Writes the TPF to a FITS file on disk.

to_lightcurve([method, corrector])

Performs photometry on the pixel data and returns a LightCurve object.

Attributes

astropy_time

Deprecated since version 2.0.

background_mask

Returns the background mask used by the TESS pipeline.

cadenceno

Return the cadence number for all good-quality cadences.

camera

TESS Camera number ('CAMERA' header keyword).

ccd

TESS CCD number ('CCD' header keyword).

column

CCD pixel column number ('1CRV5P' header keyword).

dec

Declination of target ('DEC_OBJ' header keyword).

flux

Returns the flux for all good-quality cadences.

flux_bkg

Returns the background flux for all good-quality cadences.

flux_bkg_err

flux_err

Returns the flux uncertainty for all good-quality cadences.

hdu

header

Deprecated since version 2.0.

mission

nan_time_mask

Returns a boolean mask flagging cadences whose time is nan.

pipeline_mask

Returns the optimal aperture mask used by the pipeline.

pos_corr1

Returns the column position correction.

pos_corr2

Returns the row position correction.

quality

Returns the quality flag integer of every good cadence.

ra

Right Ascension of target ('RA_OBJ' header keyword).

row

CCD pixel row number ('2CRV5P' header keyword).

sector

TESS Sector number ('SECTOR' header keyword).

shape

Return the cube dimension shape.

time

Returns the time for all good-quality cadences.

wcs

Returns an astropy.wcs.WCS object with the World Coordinate System solution for the target pixel file.