Beispiel #1
0
transits = LightCurve(**whole_lc.mask_out_of_transit(hat11_params)
                      ).get_transit_light_curves(hat11_params)

delta_chi2 = {}

with ProgressBar(len(transits)) as bar:
    for i, lc in enumerate(transits):
        # Remove linear out-of-transit trend from transit
        lc.remove_linear_baseline(hat11_params)

        # Subtract out a transit model
        transit_model = generate_lc_depth(lc.times_jd, depth, hat11_params)
        residuals = lc.fluxes - transit_model

        # Find peaks in the light curve residuals
        best_fit_params = peak_finder(lc.times.jd, residuals, lc.errors,
                                      hat11_params, n_peaks=2)
        best_fit_gaussian_model = summed_gaussians(lc.times.jd, best_fit_params)

        # Measure delta chi^2
        chi2_transit = np.sum((lc.fluxes - transit_model)**2 /
                              lc.errors**2)/len(lc.fluxes)

        if best_fit_params is not None:
            split_input_parameters = np.split(np.array(best_fit_params),
                                              len(best_fit_params)/3)
            delta_chi2[i] = []
            for amplitude, t0, sigma in split_input_parameters:
                model_i = gaussian(lc.times.jd, amplitude, t0, sigma)
                chi2_bumps = np.sum((lc.fluxes - transit_model - model_i)**2 /
                                    lc.errors**2)/len(lc.fluxes)
                delta_chi2[i].append(np.abs(chi2_transit - chi2_bumps))
Beispiel #2
0
lc.subtract_add_divide_without_outliers(params=hat11_params,
                                        quarterly_max=quarterly_maxes[lc.quarters[0]],
                                        plots=False)
lc_output_path = os.path.join(output_dir,
                              'lc{0:03d}.txt'.format(transit_number))
np.savetxt(lc_output_path, np.vstack([lc.times.jd, lc.fluxes, lc.errors]).T)

# Delete sharp outliers prior to peak-finding
lc.delete_outliers()

transit_model = generate_lc_depth(lc.times_jd, hat11_params.rp**2, hat11_params)
residuals = lc.fluxes - transit_model

# Find peaks in the light curve residuals
best_fit_spot_params = peak_finder(lc.times.jd, residuals, lc.errors,
                                   hat11_params, n_peaks=4, plots=False,
                                   verbose=True)
best_fit_gaussian_model = summed_gaussians(lc.times.jd,
                                           best_fit_spot_params)

# If spots are detected:
if best_fit_spot_params is not None:
    output_path = os.path.join(output_dir,
                               'chains{0:03d}.hdf5'.format(transit_number))
    sampler = run_emcee_seeded(lc, hat11_params, best_fit_spot_params,
                               n_steps=15000, n_walkers=150,
                               output_path=output_path, burnin=0.6,
                               n_extra_spots=0)
#
Beispiel #3
0
transits = LightCurve(**whole_lc.mask_out_of_transit(kepler17_params)
                      ).get_transit_light_curves(kepler17_params)

delta_chi2 = {}

with ProgressBar(len(transits)) as bar:
    for i, lc in enumerate(transits):
        # Remove linear out-of-transit trend from transit
        lc.remove_linear_baseline(kepler17_params)

        # Subtract out a transit model
        transit_model = generate_lc_depth(lc.times_jd, depth, kepler17_params)
        residuals = lc.fluxes - transit_model

        # Find peaks in the light curve residuals
        best_fit_params = peak_finder(lc.times.jd, residuals, lc.errors,
                                      kepler17_params)
        best_fit_gaussian_model = summed_gaussians(lc.times.jd, best_fit_params)

        # Measure delta chi^2
        chi2_transit = np.sum((lc.fluxes - transit_model)**2 /
                              lc.errors**2)/len(lc.fluxes)

        if best_fit_params is not None:
            split_input_parameters = np.split(np.array(best_fit_params),
                                              len(best_fit_params)/3)
            delta_chi2[i] = []
            for amplitude, t0, sigma in split_input_parameters:
                model_i = gaussian(lc.times.jd, amplitude, t0, sigma)
                chi2_bumps = np.sum((lc.fluxes - transit_model - model_i)**2 /
                                    lc.errors**2)/len(lc.fluxes)
                delta_chi2[i].append(np.abs(chi2_transit - chi2_bumps))