kepimages: create a series of separate FITS image files from a Target Pixel File

pyke.kepimages.kepimages(infile, prefix, imtype='FLUX', ranges='0, 0', overwrite=True, verbose=True, logfile='kepimages.log')[source]

kepimages – create a series of separate FITS image files from a Target Pixel File

kepimages will create a series of FITS image files which copy the images stored within a Target Pixel File (TPF). One FITS image file will be created for each Kepler exposure. The user can request all images within a TPF or a subset by supplying a series of Barycentric Julian Date ranges. FITS keywords from the primary and first extensions of the TPF are propagated into the output image files. The mid-time of each exposure (MIDTIME), Barycentric time correction (BARYCORR), cadence number (CADENCEN) and data quality flag (QUALITY) are exported to the FITS images as keywords. The position of the target during each observation, relative to the mid-time of the quarter, in both pixel column and row directions are recorded in keywords POSCORR1 and POSCORR2. If a cosmic ray event was recorded during an individual exposure then the keyword COSM_RAY is flagged as true. The keywords TELAPSE, LIVETIME and EXPOSURE are overwritten and refer to the individual exposure times of each image.

The user can choose from six different images to extract:

  • RAW_CNTS – uncalibrated pixel count values
  • FLUX – calibrated pixel, background-subtracted, cosmic ray-removed fluxes in units of \(e^{-}/s\)
  • FLUX_ERR – 1-\(\sigma\) errors on the FLUX image, as propagated through the pixel calibration
  • FLUX_BKG – the background that has been subtracted from the FLUX image in units of \(e^{-}/s\)
  • FLUX_BKG_ERR – 1-\(\sigma\) errors on the FLUX_BKG image, as propagated through the pixel calibration
  • COSMIC_RAYS – the cosmic ray map that has been subtracted from the FLUX image in units of \(e^{-}/s\)

We recommend the tools ds9 and fv for the inspection of the FITS image products. The intent of the kepimages tool is to convert the TPF content into a form from which images can be imported into the array of public photometry software available to the K2 and Kepler communities.


infile : str

Filename for the input Target Pixel File.

prefix : str

Prefix for the filenames of the output FITS images. Individual filenames will be prefix_BJDddddddd.dddd.fits, where ddddddd.dddd is the mid-time of the exposure in units of BJD.

ranges : str

The user can choose here specific time ranges of exposures from which to export images. Time ranges are supplied as comma-separated pairs of Barycentric Julian Dates (BJDs). Multiple ranges are separated by a semi-colon. An example containing two time ranges is:


overwrite : bool

Overwrite the output file? if overwrite is False and an existing file has the same name as outfile then the task will stop with an error.

verbose : bool

Print informative messages and warnings to the shell and logfile?

logfile : str

Name of the logfile containing error and warning messages.