# kepfold: phase-fold light curve data on linear ephemeris¶

pyke.kepfold.kepfold(infile, period, bjd0, outfile=None, bindata=False, binmethod='median', threshold=1.0, niter=5, nbins=1000, rejqual=False, plottype='det', overwrite=False, verbose=False, logfile='kepfold.log')

kepfold: Phase-fold light curve data on linear ephemeris.

kepfold calculates the phase of all time-tagged data points relative to a user-supplied linear ephemeris. The relation is:

$TIME_i = bjd0 + period \cdot PHASE_i$

$$TIME$$ is the column within the FITS light curve file containing barycenter-corrected time stamps. $$bjd0$$ is a user-supplied BJD for zero phase. period is a user-supplied period in units of days. PHASE is the calculated phase for each time stamp; these results are written to a new float column in the LIGHT CURVE extension of the input file before being exported as a new file with name defined by the user. Optionally, kepfold will plot the data folded on the ephemeris and store it within a new FITS extension of the output file called FOLDED. Both the SAP and PDC fluxes are binned and stored in the new extension. There are a number of binning algorithms, mean, median and sigma clipping. The user has options to adapt bin size, binning method and the rejection of outliers.

Parameters: inile : str The name of a MAST standard format FITS file containing a Kepler light curve within the first data extension. outfile : str The name of the output FITS file with a new extension containing a phased light curve. period : str Period over which to fold the light curve, in units of days. bjd0 : float Time of zero phase for the folded data, in units of BJD. bindata: bool Collect the data into discrete bins during the fold? binmethod : str Binning method. mean calculates the mean of all data points contained within a bin. median calculates the median of all data points within a bin. sigclip calculates a mean iteratively. Each iteration rejects data lying further than a threshold number of standard deviations from the mean before recalculating the result. threshold : float The sigma clipping threshold in units of the standard deviation about the calculated mean within a phase bin. A typical outlier lies > 3.0:math:sigma from the mean. niter : int The maximum number of iterations over which to reject outliers before accepting the sigclip result. nbins : int The number of phase bins to calculate. rejqual : bool If True, timestamps with quality issues recorded as a finite quality flag in the input file will be thrown away before folding the data. plottype : str The type of data to plot. The choices refer to the types of photometry stored in the input file. sap is Simple Aperture Photometry, stored in the column, SAP_FLUX. SAP data is generated by the Kepler pipeline but it can also be generated from a target pixel file using the kepextract tool. pdc is Pre-search Data Conditioning photometry, stored in the column PDCSAP_FLUX. PDC data is a Kepler pipeline product. cbv Cotrending Basis Vector is SAP photometry corrected manually by the user using the tool kepcotrend. CBV data is stored in the column CBVSAP_FLUX. det data has been detrended using piecemeal polynomials with the kepflatten tool. DET data is stored in the column DETSAP_FLUX. overwrite : bool Overwrite the output file? verbose : bool Print informative messages and warnings to the shell and logfile? logfile : str Name of the logfile containing error and warning messages.

Examples

\$ kepfold kplr010544976-2009201121230_slc.fits
0.350471 2455002.825 --bindata --binmethod median --threshold 3.0
--niter 1000 --plottype sap --verbose