Closed skgrunblatt closed 4 years ago
lines to add:
from astropy.stats import mad_std
flux = flux - scipy.ndimage.filters.gaussian_filter(flux, 90) #<2-day (5muHz) filter
#sigma clip and filter data bound = 3.5 # N sigma clipping mad = mad_std(flux) outlier_ind = np.where(abs(flux) >= bound*mad)[0] print("Outlier number: ",outlier_ind.size)
#sigma clip and filter data
bound = 3.5 # N sigma clipping
mad = mad_std(flux)
outlier_ind = np.where(abs(flux) >= bound*mad)[0]
print("Outlier number: ",outlier_ind.size)
time_clean = np.delete(time, outlier_ind) flux_clean = np.delete(flux, outlier_ind) flux_err_clean = np.delete(flux_err, outlier_ind)
time_clean = np.delete(time, outlier_ind)
flux_clean = np.delete(flux, outlier_ind)
flux_err_clean = np.delete(flux_err, outlier_ind)
time = time_clean flux = flux_clean flux_err = flux_err_clean
time = time_clean
flux = flux_clean
flux_err = flux_err_clean
Implemented!
lines to add:
from astropy.stats import mad_std
flux = flux - scipy.ndimage.filters.gaussian_filter(flux, 90) #<2-day (5muHz) filter
#sigma clip and filter data
bound = 3.5 # N sigma clipping
mad = mad_std(flux)
outlier_ind = np.where(abs(flux) >= bound*mad)[0]
print("Outlier number: ",outlier_ind.size)
time_clean = np.delete(time, outlier_ind)
flux_clean = np.delete(flux, outlier_ind)
flux_err_clean = np.delete(flux_err, outlier_ind)
time = time_clean
flux = flux_clean
flux_err = flux_err_clean