# kepextract: create a light curve from a target pixel file by summing user-selected pixels¶

pyke.kepextract.kepextract(infile, outfile=None, bitmask=1130927, maskfile='ALL', bkg=False, psfcentroid=False, overwrite=False, verbose=False, logfile='kepextract.log')[source]

kepextract – create a light curve from a target pixel file by summing user-selected pixels

kepextract calculates simple aperture photometry, from a target pixel file, for a user-supplied set of pixels. The Kepler pipeline sums a specific set of pixels to produce the standard light curves delivered to users. Termed the optimal aperture, the default pixel set is designed to maximize the signal-to-noise ratio of the resulting light curve, optimizing for transit detection. This tool provides users with a straightforward capability to alter the summed pixel set. Applications include:

• Use of all pixels in the aperture
• The Kepler pipeline does not produce a light curve for sources observed with custom or dedicated pixel masks. The user can create a light curve for these sources using kepextract.
• Construction of pixel light curves, in which the time series for a single pixel can be examined.
• Light curves for extended sources which may be poorly sampled by the optimal aperture.
Parameters: infile : str Filename for the target pixel file. outfile : str Filename for the output light curve. This product will be written to the same FITS format as archived light curves. bitmask : int QUALITY bitmask used to reject poor-quality cadences. maskfile : str This string can be one of three options: ‘ALL’ tells the task to calculate principal components from all pixels within the pixel mask stored in the input file. ‘APER’ tells the task to calculate principal components from only the pixels within the photometric aperture stored in the input file (e.g. only those pixels summed by the Kepler pipeline to produce the light curve archived at MAST. A filename describing the desired photometric aperture. Such a file can be constructed using the kepmask or kepffi tools, or can be created manually using the format described in the documentation for those tools. bkg : bool Option to subtract an estimate of the background. Background is calculated by identifying the median pixel value for each exposure. This method requires an adequate number of pixels within the target mask that contain background and negligible source flux. Note that background has already been subtracted from calibrated Kepler Target Pixel Files, but not early campaign data from the K2 mission. psfcentroid : bool Measure the star’s position by fitting a 2D Gaussian PSF to the pixels in the mask. This will populate values for PSF_CENTR1 (column position) and PSF_CENTR2 (row position) in the output file. overwrite : bool Overwrite the output file? verbose : bool Option for verbose mode, in which informative messages and warnings print to the shell and a logfile. logfile : str Name of the logfile containing error and warning messages.

Examples

$kepextract kplr008256049-2010174085026_lpd-targ.fits --maskfile ALL One further can plot the resulted light curve by doing import matplotlib.pyplot as plt from astropy.io import fits f = fits.open('outlc.fits') plt.plot(f[1].data['TIME'], f[1].data['SAP_FLUX']) or$ kepdraw outlc.fits