lightkurve.lightcurve.
FoldedLightCurve
(*args, **kwargs)¶Bases: lightkurve.lightcurve.LightCurve
Generic class to store and plot phasefolded light curves.
Compared to the standard LightCurve
class, this class offers an extra
phase
property and implements different plotting defaults.
Attributes Summary
astropy_time 
Returns the time values as an Astropy Time object (if time_format is set). 
phase 
Methods Summary
append (others) 
Append LightCurve objects. 
bin ([binsize, method]) 
Bins a lightcurve in blocks of size binsize . 
cdpp (**kwargs) 
DEPRECATED: use estimate_cdpp() instead. 
copy () 
Returns a copy of the LightCurve object. 
errorbar (**kwargs) 
Plot the folded light curve usng matplotlib’s errorbar method. 
estimate_cdpp ([transit_duration, …]) 
Estimate the CDPP noise metric using the SavitzkyGolay (SG) method. 
fill_gaps ([method]) 
Fill in gaps in time with linear interpolation. 
flatten ([window_length, polyorder, …]) 
Removes the low frequency trend using scipy’s SavitzkyGolay filter. 
fold (period[, t0, transit_midpoint]) 
Folds the lightcurve at a specified period and reference time t0 . 
normalize () 
Returns a normalized version of the light curve. 
plot (**kwargs) 
Plot the folded light curve usng matplotlib’s plot method. 
remove_nans () 
Removes cadences where the flux is NaN. 
remove_outliers ([sigma, return_mask]) 
Removes outlier data points using sigmaclipping. 
scatter (**kwargs) 
Plot the folded light curve usng matplotlib’s scatter method. 
show_properties () 
Prints a description of all noncallable attributes. 
to_csv ([path_or_buf]) 
Writes the light curve to a csv file. 
to_fits ([path, overwrite]) 
Writes the light curve to a FITS file. 
to_pandas ([columns]) 
Converts the light curve to a Pandas DataFrame object. 
to_periodogram ([method]) 
Converts the light curve to a Periodogram power spectrum object. 
to_table () 
Converts the light curve to an Astropy Table object. 
Attributes Documentation
astropy_time
¶Returns the time values as an Astropy Time
object
(if time_format
is set).
The Time object will be created using the values in the time
,
time_format
, and time_scale
attributes.
For Kepler data products, the times are Barycentric.
Raises: 


phase
¶Methods Documentation
append
(others)¶Append LightCurve objects.
Parameters: 


Returns: 

bin
(binsize=13, method='mean')¶Bins a lightcurve in blocks of size binsize
.
The value of the bins will contain the mean (method='mean'
) or the
median (method='median'
) of the original data. The default is mean.
Parameters: 


Returns: 

Notes
flux_err
),
the binned lightcurve will report the rootmeansquare error.
If no uncertainties are included, the binned curve will return the
standard deviation of the data.cdpp
(**kwargs)¶DEPRECATED: use estimate_cdpp()
instead.
copy
()¶Returns a copy of the LightCurve object.
This method uses the copy.deepcopy
function to ensure that all
objects stored within the LightCurve are copied (e.g. time and flux).
Returns: 


errorbar
(**kwargs)¶Plot the folded light curve usng matplotlib’s errorbar
method.
See LightCurve.scatter
for details on the accepted arguments.
Parameters: 


Returns: 

estimate_cdpp
(transit_duration=13, savgol_window=101, savgol_polyorder=2, sigma=5.0)¶Estimate the CDPP noise metric using the SavitzkyGolay (SG) method.
A common estimate of the noise in a lightcurve is the scatter that remains after all long term trends have been removed. This is the idea behind the Combined Differential Photometric Precision (CDPP) metric. The official Kepler Pipeline computes this metric using a waveletbased algorithm to calculate the signaltonoise of the specific waveform of transits of various durations. In this implementation, we use the simpler “sgCDPP proxy algorithm” discussed by Gilliland et al (2011ApJS..197….6G) and Van Cleve et al (2016PASP..128g5002V).
savgol_window
and polynomial order savgol_polyorder
.sigma
times the standard deviation.transit_duration
.We use a running mean (as opposed to block averaging) to strongly attenuate the signal above 1/transit_duration whilst retaining the original frequency sampling. Block averaging would set the Nyquist limit to 1/transit_duration.
Parameters: 


Returns: 

Notes
This implementation is adapted from the Matlab version used by Jeff van Cleve but lacks the normalization factor used there: svn+ssh://murzim/repo/so/trunk/Develop/jvc/common/compute_SG_noise.m
fill_gaps
(method='nearest')¶Fill in gaps in time with linear interpolation.
Parameters: 


Returns: 

flatten
(window_length=101, polyorder=2, return_trend=False, break_tolerance=5, niters=3, sigma=3, mask=None, **kwargs)¶Removes the low frequency trend using scipy’s SavitzkyGolay filter.
This method wraps scipy.signal.savgol_filter
.
Parameters: 


Returns: 

fold
(period, t0=None, transit_midpoint=None)¶Folds the lightcurve at a specified period
and reference time t0
.
This method returns a FoldedLightCurve
object in which the time
values range between 0.5 to +0.5 (i.e. the phase).
Data points which occur exactly at t0
or an integer multiple of
t0 + n*period
will have phase value 0.0.
Parameters: 


Returns: 

normalize
()¶Returns a normalized version of the light curve.
The normalized light curve is obtained by dividing the flux
and
flux_err
object attributes by the by the median flux.
Returns: 


plot
(**kwargs)¶Plot the folded light curve usng matplotlib’s plot
method.
See LightCurve.plot
for details on the accepted arguments.
Parameters: 


Returns: 

remove_nans
()¶Removes cadences where the flux is NaN.
Returns: 


remove_outliers
(sigma=5.0, return_mask=False, **kwargs)¶Removes outlier data points using sigmaclipping.
This method returns a new LightCurve
object from which data
points are removed if their flux values are greater or smaller than
the median flux by at least sigma
times the standard deviation.
Sigmaclipping works by iterating over data points, each time rejecting values that are discrepant by more than a specified number of standard deviations from a center value. If the data contains invalid values (NaNs or infs), they are automatically masked before performing the sigma clipping.
Note
This function is a convenience wrapper around
astropy.stats.sigma_clip()
and provides the same functionality.
Parameters: 


Returns: 

Examples
This example generates a new light curve in which all points that are more than 1 standard deviation from the median are removed:
>>> lc = LightCurve(time=[1, 2, 3, 4, 5], flux=[1, 1000, 1, 1000, 1])
>>> lc_clean = lc.remove_outliers(sigma=1)
>>> lc_clean.time
array([1, 3, 5])
>>> lc_clean.flux
array([1, 1, 1])
This example removes only points where the flux is larger than 1 standard deviation from the median, but leaves negative outliers in place:
>>> lc = LightCurve(time=[1, 2, 3, 4, 5], flux=[1, 1000, 1, 1000, 1])
>>> lc_clean = lc.remove_outliers(sigma_lower=float('inf'), sigma_upper=1)
>>> lc_clean.time
array([1, 3, 4, 5])
>>> lc_clean.flux
array([ 1, 1, 1000, 1])
scatter
(**kwargs)¶Plot the folded light curve usng matplotlib’s scatter
method.
See LightCurve.scatter
for details on the accepted arguments.
Parameters: 


Returns: 

show_properties
()¶Prints a description of all noncallable attributes.
Prints in order of type (ints, strings, lists, arrays, others).
to_csv
(path_or_buf=None, **kwargs)¶Writes the light curve to a csv file.
Parameters: 


Returns: 

to_fits
(path=None, overwrite=False, **extra_data)¶Writes the light curve to a FITS file.
Parameters: 


Returns: 

to_pandas
(columns=['time', 'flux', 'flux_err'])¶Converts the light curve to a Pandas DataFrame
object.
Parameters: 


Returns: 

to_periodogram
(method='lombscargle', **kwargs)¶Converts the light curve to a Periodogram
power spectrum object.
This method will call either lightkurve.periodogram.LombScarglePeriodogram.from_lightcurve()
or lightkurve.periodogram.BoxLeastSquaresPeriodogram.from_lightcurve()
,
which in turn wrap astropy.stats.LombScargle
and astropy.stats.BoxLeastSquares
.
method='lombscargle'
are:minimum_frequency
, maximum_frequency
, mininum_period
,
maximum_period
, frequency
, period
, nterms
,
nyquist_factor
, oversample_factor
, freq_unit
,
normalization
.method='bls'
are:minimum_period
, maximum_period
, period
,
frequency_factor
, duration
.Parameters: 


Returns: 

to_table
()¶Converts the light curve to an Astropy Table
object.
Returns: 


Created with ♥ by the Lightkurve developers. Join us on GitHub.