Exemplo n.º 1
0
def k2lc(epic):
    """
    load k2 light curve
    """
    prefix = epic[:4]
    id = epic[4:]
    c = "01"
    path = "data/c01/{0}00000/{1}".format(prefix, id)
    end = "kepler_v1.0_lc.fits"
    file = "{0}/hlsp_everest_k2_llc_{1}-c{2}_{3}".format(path, epic, c, end)
    x, y = process_data(file)
    return x, y
Exemplo n.º 2
0
    # save samples
    f = h5py.File("%s_samples.h5" % id, "w")
    data = f.create_dataset("samples", np.shape(sampler.chain))
    data[:, :] = np.array(sampler.chain)
    f.close()

    # make various plots
    if plot:
        with h5py.File("%s_samples.h5" % id, "r") as f:
            samples = f["samples"][...]
        mcmc_result = make_plot(samples, xsub, ysub, yerrsub, id, fn,
                                traces=True, tri=True, prediction=True)

if __name__ == "__main__":

    c = "01"
    epic = "201131793"
    path = "data/c01/201100000/31793"
    end = "kepler_v1.0_lc.fits"
    file = "{0}/hlsp_everest_k2_llc_{1}-c{2}_{3}".format(path, epic, c, end)
    if os.path.exists(file):
        x, y = process_data(file)

        burnin, run, npts, tol = 1000, 100000, 10, .4  # MCMC. max npts is 48
        yerr = np.ones_like(y) * 1e-5
        interval = 0.02043365  # assume for long cadence
        recover_injections(id, x, y, yerr, path, burnin, run, interval, tol,
                           npts, nwalkers=12, plot=True)
    else:
        print(file, "file not found")