kepprf: fit a PSF model to a specific image within a Target Pixel File

pyke.kepprf.kepprf(infile, prfdir, frameno, columns, rows, fluxes, background=False, border=1, focus=False, xtol=0.0001, ftol=1.0, outfile=None, plot=False, imscale='linear', cmap='YlOrBr', apercol='#ffffff', verbose=False, logfile='kepprf.log')

kepprf – Fit a PSF model to a specific image within a Target Pixel File

Fit a PSF model, combined with spacecraft jitter and pixel scale drift (the Pixel Response Function; PRF) to a single observation of Kepler target pixels.

Parameters:

infile : str

The name of a MAST standard format FITS file containing Kepler Target Pixel data within the first data extension.

prfdir : str

The full or relative directory path to a folder containing the Kepler PSF calibration. Calibration files can be downloaded from the Kepler focal plane characteristics page at the MAST.

frameno : int

The cadence number in the input file data containing the pixels to plot. If the chosen observation has a non-zero quality flag set or the pixel set contains only NULLs then the task will halt with an error message.

columns : list

A starting guess for the CCD column position(s) of the source(s) that are to be fit. The model is unlikely to converge if the guess is too far away from the correct location. A rule of thumb is to provide a guess within 1 CCD pixel of the true position. If more than one source is being modeled then the column positions of each are separated by a comma. The same number of sources in the columns, rows and fluxes field is a requirement of this task.

rows : list

A starting guess for the CCD row position(s) of the source(s) that are to be fit. The model is unlikely to converge if the guess is too far away from the correct location. A rule of thumb is to provide a guess within 1 CCD pixel of the true position. If more than one source is being modeled then the row positions of each are separated by a comma. The same number of sources in the columns, rows and fluxes field is a requirement of this task.

fluxes : list

A starting guess for the flux(es) of the source(s) that are to be fit. Fit convergence is not particularly reliant on the accuracy of these guesses, but the fit will converge faster the more accurate the guess. If more than one source is being modeled then the row positions of each are separated by a comma. The same number of sources in the columns, rows and fluxes field is a requirement of this task.

background : boolean

Whether to include a background component in the model. If True then the background will be represented by a two-dimensional polynomial of order border. This functionality is somewhat experimental, with one eye upon potential background gradients across large masks or on those detectors more prone to pattern noise. Generally it is recommended to set background as False.

border : int

If a background is included in the fit then it is modeled as a two-dimensional polynomial. This parameter is the polynomial order. A zero-order polynomial is generally recommended.

focus : boolean

Whether to incude pixel scale and focus rotation with the fit parameters of the model. This is also an experimental function. This approach does not attempt to deal with inter- or intra-pixel variations. The recommended use is currently to set focus as False.

xtol : float

The dimensionless, relative model parameter convergence criterion for the fit algorithm.

ftol : float

The dimensionless, relative model residual convergence criterion for the fit algorithm.

outfile : str

Name of an optional output plot file containing the results of kepprf. An example is provided in Figure 1. Typically this is a PNG format file. If no file is required, outfile can be ‘None’ or blank, in which case the plot will be generated but the plot will not be saved to a file. Any existing file with this name will be automatically overwritten.

plot : boolean

Plot fit results to the screen?

imscale : str

kepprf can plot images with three choices of image scales. The choice is made using this argument. The options are: * linear * logarithmic * squareroot

cmap : str

matplotlib’s color map

verbose : boolean

Print informative messages and warnings to the shell and logfile?

logfile : string

Name of the logfile containing error and warning messages.

Examples

Using the command line tool kepprf, one can fit multiple PRFs to a given frame in a target pixel file as follows

$ kepprf kplr008256049-2010174085026_lpd-targ.fits --prfdir ~/kplr2011265_prf/
--frameno 1000 --columns 830 831 --rows 242 241 --fluxes 1.0 0.1 --plot --verbose

      KepID: 8256049
        BJD: 2455296.903574196
 RA (J2000): 298.67861
Dec (J2000): 44.1755
     KepMag: 15.654
   SkyGroup: 53
     Season: 3
    Channel: 81
     Module: 24
     Output: 1

Convergence time = 0.15390515327453613s

Flux = 3978.040625752744 e-/s X = 829.8259431097927 pix Y = 242.3810334478628 pix
Flux = 4734.069273790539 e-/s X = 830.990805551025 pix Y = 240.97340366638306 pix

                Total flux in mask = 10747.293440638587 e-/s
               Target flux in mask = 3793.041929468528 e-/s
            Total flux in aperture = 6365.551487630484 e-/s
           Target flux in aperture = 3110.924803570053 e-/s
  Target flux fraction in aperture = 78.2024392468689 %
Contamination fraction in aperture = 51.12874650978488 %

       Residual flux = -0.5748827605745994 e-/s
Pearsons chi^2 test = 296.12077907844986 for 13 dof
         Chi^2 test = 19803.55879917441 for 13 dof
../_images/kepprf.png