import matplotlib.pyplot as plt
import numpy as np
from thirdway.lightcurve import LightCurve, generate_lc_depth, kepler17_params_db
from thirdway.fitting import peak_finder, summed_gaussians, gaussian
from astropy.utils.console import ProgressBar

# Load light curve from jrad's text archive
light_curve_path = 'data/kepler17_whole.dat'
BJDREF = 2454833.
depth = 0.13413993**2
jd_minus_bjdref, flux, error = np.loadtxt(light_curve_path, unpack=True)
jd = jd_minus_bjdref + BJDREF
kepler17_params = kepler17_params_db()

# construct light curve object from those data
whole_lc = LightCurve(times=jd, fluxes=flux, errors=error)
transits = LightCurve(**whole_lc.mask_out_of_transit(kepler17_params)
                      ).get_transit_light_curves(kepler17_params)

# The short cadence data begin after the 137th transit, so ignore all transits before then:
transits = transits[137:]

plots = True

delta_chi2 = {}#np.zeros(len(transits))

with ProgressBar(len(transits)) as bar:
    for i, lc in enumerate(transits):
        #lc.plot()
        # Remove linear out-of-transit trend from transit
        lc.remove_linear_baseline(kepler17_params)
Beispiel #2
0
Example ThirdWay experimentations.
"""
from __future__ import absolute_import, print_function
import matplotlib.pyplot as plt
import numpy as np
from thirdway.lightcurve import LightCurve, generate_lc_depth
from thirdway.fitting import run_emcee, summed_gaussians

# Load light curve from jrad's text archive
light_curve_path = 'data/kepler17_whole.dat'
BJDREF = 2454833.
jd_minus_bjdref, flux, error = np.loadtxt(light_curve_path, unpack=True)
jd = jd_minus_bjdref + BJDREF

# construct light curve object from those data
whole_lc = LightCurve(times=jd, fluxes=flux, errors=error)
transits = LightCurve(**whole_lc.mask_out_of_transit()).get_transit_light_curves()

# The short cadence data begin after the 137th transit, so ignore all transits before then:
transits = transits[137:]


lc = transits[104]
# Remove linear out-of-transit trend from transit
lc.remove_linear_baseline()
depth = 0.13413993**2
residuals = lc.fluxes - generate_lc_depth(lc.times_jd, depth)

# Fit the transit model residuals for n_peaks gaussians
sampler, samples = run_emcee(lc.times.jd, residuals, lc.errors, n_peaks=4)