Target Pixel File

class pyke.targetpixelfile.KeplerTargetPixelFile(path, quality_bitmask=1130927, **kwargs)[source]

Defines a TargetPixelFile class for the Kepler/K2 Mission. Enables extraction of raw lightcurves and centroid positions.

References

[R7]Kepler: A Search for Terrestrial Planets. Kepler Archive Manual. http://archive.stsci.edu/kepler/manuals/archive_manual.pdf

Attributes

path (str) Path to fits file.
quality_bitmask (str or int) Bitmask specifying quality flags of cadences that should be ignored. If a string is passed, it has the following meaning: * “default”: recommended quality mask * “hard”: removes more flags, known to remove good data * “hardest”: removes all data that has been flagged

Methods

centroids([aperture_mask]) Returns centroids based on sample moments.
get_bkg_lightcurve([aperture_mask])
get_prf_model() Returns an object of SimpleKeplerPRF initialized using the necessary metadata in the tpf object.
header([ext]) Returns the header for a given extension.
plot([frame, cadenceno, bkg, aperture_mask]) Plot a target pixel file at a given frame (index) or cadence number.
to_fits() Save the TPF to fits
to_lightcurve([aperture_mask]) Performs aperture photometry.
cadenceno

Return the cadence number for all good-quality cadences.

campaign

Campaign number

centroids(aperture_mask='pipeline')[source]

Returns centroids based on sample moments.

Parameters:

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

A boolean array describing the aperture such that False means that the pixel will be masked out. If the string ‘all’ is passed, all pixels will be used. The default behaviour is to use the Kepler pipeline mask.

Returns:

col_centr, row_centr : tuple

Arrays containing centroids for column and row at each cadence

channel
column
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.

get_bkg_lightcurve(aperture_mask=None)[source]
get_prf_model()[source]

Returns an object of SimpleKeplerPRF initialized using the necessary metadata in the tpf object.

Returns:prf : instance of SimpleKeplerPRF
header(ext=0)[source]

Returns the header for a given extension.

keplerid
mission

Mission name

module
n_good_cadences

Returns the number of good-quality cadences.

nan_time_mask

Returns a boolean mask flagging cadences whose time is nan.

output
pipeline_mask

Returns the aperture mask used by the Kepler pipeline

plot(frame=0, cadenceno=None, bkg=False, aperture_mask=None, **kwargs)[source]

Plot a target pixel file at a given frame (index) or cadence number.

Parameters:

frame : int

Frame number. The default is 0, i.e. the first frame.

cadenceno : int, optional

Alternatively, a cadence number can be provided. This argument has priority over frame number.

bkg : bool

If True, background will be added to the pixel values.

aperture_mask : ndarray

Highlight pixels selected by aperture_mask.

kwargs : dict

Keywords arguments passed to pyke.utils.plot_image.

quality

Returns the quality flag integer of every good cadence.

quarter

Quarter number

row
shape

Return the cube dimension shape.

time

Returns the time for all good-quality cadences.

to_fits()[source]

Save the TPF to fits

to_lightcurve(aperture_mask='pipeline')[source]

Performs aperture photometry.

Parameters:

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

A boolean array describing the aperture such that False means that the pixel will be masked out. If the string ‘all’ is passed, all pixels will be used. The default behaviour is to use the Kepler pipeline mask.

Returns:

lc : KeplerLightCurve object

Array containing the summed flux within the aperture for each cadence.

Inheritance Diagram