Estimate the CDPP noise metric using the Savitzky-Golay (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 wavelet-based
algorithm to calculate the signal-to-noise 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).
Remove low frequency signals using a Savitzky-Golay filter with
window length savgol_window and polynomial order savgol_polyorder.
Remove outliers by rejecting data points which are separated from
the mean by sigma times the standard deviation.
Compute the standard deviation of a running mean with
a configurable window length equal to 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.
The transit duration in units of number of cadences. This is the
length of the window used to compute the running mean. The default
is 13, which corresponds to a 6.5 hour transit in data sampled at
Width of Savitsky-Golay filter in cadences (odd number).
Default value 101 (2.0 days in Kepler Long Cadence mode).
Polynomial order of the Savitsky-Golay filter.
The recommended value is 2.
The number of standard deviations to use for clipping outliers.
The default is 5.
Savitzky-Golay CDPP noise metric in units parts-per-million (ppm).
This implementation is adapted from the Matlab version used by
Jeff van Cleve but lacks the normalization factor used there: