Created
March 22, 2018 11:28
-
-
Save j-faria/6d377096f35323a6219b772a64c58536 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.stats import binned_statistic | |
from astropy.convolution import convolve, Box1DKernel | |
def f8(time, flux): | |
""" | |
Calculate the F8 statistic, as in Bastien et al. | |
Both `time` and `flux` should be numpy arrays. | |
The 8-hour flicker (F8) is determined by performing a 16-point (8 hour) | |
boxcar smoothing of the light curve, subtracting it from the original light curve | |
and measuring the root-mean-square (RMS) of the result. | |
""" | |
# bin the LC to 30 minutes to simulate Kepler cadence | |
width = 30*60 # 30 min in seconds | |
bins = np.arange(0, time[-1]+width, width) | |
# binned time and flux | |
btime = binned_statistic(time, time, bins=bins)[0] | |
bflux = binned_statistic(time, flux, bins=bins)[0] | |
# boxcar smooth using 16 pts (8 hours) | |
convflux = convolve(bflux, Box1DKernel(16)) | |
# subtract smoothed lc | |
newflux = bflux - convflux | |
# F8 is the RMS | |
return np.sqrt(np.sum(newflux**2)/newflux.size) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment