Warning: this page is no longer updated and may contain outdated information.

Please refer to the new Kepler/K2 science website at http://keplerscience.arc.nasa.gov

NASA - National Aeronautics and Space Administration Follow this link to skip to the main content + Contact NASA
Kepler Guest Observer Program

Contributed Software - KEPFOLD

Software: PyKE
Version: 2.0.2

Figure 1: The light curve on the left is the quarter 2 SAP light curve of an eclipsing red dwarf-white dwarf binary available in the public Kepler archive as KIC 10544976. The figure on the right provides the same light curved folded upon the binary orbital period using the kepfold tool.

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

kepfold infile outfile period bjd0 bindata binmethod threshold niter nbins plottype plotlab clobber verbose logfile status

infile = string
The name of a MAST standard format FITS file containing a Kepler light curve within the first data extension.

outfile = string
The name of the output FITS file with a new extension containing a phased light curve.

period = float
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 = boolean
Collect the data into discrete bins during the fold?

binmethod = string
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. Options:
mean | median | sigclip

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 σ from the mean.

niter = integer
The maximum number of iterations over which to reject outliers before accepting the sigclip result.

nbins = integer
The number of phase bins to calculate.

quality = boolean
If quality=yes, timestamps with quality issues recorded as a finite quality flag in the input file will be thrown away before folding the data.

plottype = string
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. 'None' yields no plot. Options:
sap | pdc | cbv | det | none

plotlab = string
vertical axis label for plot

clobber = boolean (optional)
Overwrite the output file? if clobber = no and an existing file has the same name as outfile then the task will stop with an error.

verbose = boolean (optional)
Print informative messages and warnings to the shell and logfile?

logfile = string (optional)
Name of the logfile containing error and warning messages.

status = integer
Exit status of the script. It will be non-zero if the task halted with an error. This parameter is set by the task and should not be modified by the user.

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

TIMEi = bjdzero + period * PHASEi

TIME is the column within the FITS light curve file containing barycenter-corrected time stamps. bjdzero 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.


  • kepfold infile=kplr010544976-2009201121230_slc.fits outfile=kepfold.fits period=0.350471 bjd0=2455002.825 bindata=yes binmethod=median threshold=3.0 niter=10 nbins=1000 plottype=sap plotlab='e$^-$ s$^{-1}$' clobber=yes

Completion upon one target pixel file using a 2.66 GHz Intel Core 2 i7 Mac running OS 10.6.7, takes a few seconds in addition to the manual input required by the tool.

The Kepler PyRAF package is privately-developed software made available to the community through the contributed software page of the Kepler astrophysics program at http://keplergo.arc.nasa.gov/ContributedSoftware.shtml. It is not an official software product of the Kepler mission or NASA. Bugs and errors are not the responsibility of the Kepler Team or NASA. Please send bug reports and suggestions to keplergo@mail.arc.nasa.gov.


Initial software release (MS)
Updated for FITS v2.0. Minimization within the sigma-clipping method has been made more reliable. Folded data binning occurs between phases 0.0 and 1.0, not anymore the maximum and minimum observed phases. A bug that loses the last bin of folded output has been fixed. (MS)
Fixed a bug which prevented the use of CBV and PCD flux data. (TB)
Code can now be run from the command line (TB)
Adapted to fold DETSAP data - detrended SAP time series calculated by kepflatten (MS)
Fixed execution error in the shell-only version of the tool (MS).


Questions concerning Kepler's science opportunities and open programs, public archive or community tools? Contact us via the email address.
FirstGov - Your First Click to the US Government
+ Freedom of Information Act
+ Budgets, Strategic Plans and Accountability Reports
+ The President's Management Agenda
+ NASA Privacy Statement, Disclaimer,
and Accessibility Certification

+ Inspector General Hotline
+ Equal Employment Opportunity Data Posted Pursuant
to the No Fear Act

+ Information-Dissemination Priorities and Inventories
NASA - National Aeronautics and Space Administration
Editor: Martin Still
NASA Official: Jessie Dotson
Last Updated: Jan 11, 2013
+ Contact NASA