コード例 #1
0
ファイル: g_rotation.py プロジェクト: RuthAngus/KeplerGP
# posterior prob
def lnprob(theta, x, y, yerr):
    lp = lnprior(theta)
    if not np.isfinite(lp):
        return -np.inf
    try:
        return lp + lnlike(theta, x, y, yerr)
    except:
        print theta
        raise

if __name__ == "__main__":

    # Load real data
    x, y, yerr = load("/Users/angusr/angusr/data2/Q3_public/kplr010295224-2009350155506_llc.fits")

    # shorten data
    l = 300.
    x = x[:l]
    y = y[:l]
    yerr = yerr[:l]

#     # median normalise
#     yerr /= np.median(y)
#     y = y/np.median(y) -1

    # normalise so range is 2 - no idea if this is the right thing to do...
    yerr = 2*yerr/(max(y)-min(y))
    y = 2*y/(max(y)-min(y))
    y = y-np.median(y)
コード例 #2
0
ファイル: ml_grid.py プロジェクト: RuthAngus/KeplerGP
    # Load target list with ACF periods
    data = np.genfromtxt('/Users/angusr/Python/george/targets.txt').T
    KIDs = data[0]
    #     p_init = data[1]

    save_results = np.zeros((len(KIDs), 8))

    for k, KID in enumerate(KIDs):

        #         p_init = p_init[k]
        print k, KID

        # Load real quarter 3 data
        x, y, yerr = load(
            "/Users/angusr/angusr/data2/Q3_public/kplr0%s-2009350155506_llc.fits"
            % int(KID))

        r = .4  # range of periods to try
        s = 30.  # number of periods to try
        b = .2  # prior boundaries

        # compute acf
        p_init = autocorrelation(x, y)

        # compute lomb scargle periodogram
        pgram(y, r, p_init, highres=True)

        # normalise so range is 2 - no idea if this is the right thing to do...
        yerr = 2 * yerr / (max(y) - min(y))
        y = 2 * y / (max(y) - min(y))
コード例 #3
0
ファイル: grid.py プロジェクト: RuthAngus/KeplerGP
    pl.plot(xs, predict(xs, x, y, yerr, theta, P)[0], 'r-')
    pl.xlabel('time (days)')
    pl.savefig('%sresult' % name)

    savedata = np.empty(len(theta) + 1)
    savedata[:len(theta)] = theta
    savedata[-1] = like
    np.savetxt('%sresult.txt' % name, savedata)

    return like


if __name__ == "__main__":
    # Load real data
    x, y, yerr = load(
        "/Users/angusr/angusr/data2/Q3_public/kplr010295224-2009350155506_llc.fits"
    )

    # shorten data
    l = 550.
    x = x[:l]
    y = y[:l]
    yerr = yerr[:l]

    # normalise so range is 2 - no idea if this is the right thing to do...
    yerr = 2 * yerr / (max(y) - min(y))
    y = 2 * y / (max(y) - min(y))
    y = y - np.median(y)

    #     theta, P = [0., .2, .2, 1.], 1.7 # initial
    #     theta, P = [-2., -2., -1.2, 6.], 1.7 # better initialisation
コード例 #4
0
ファイル: ml_grid.py プロジェクト: RuthAngus/KeplerGP
    cadence = 0.02043365

    # Load target list with ACF periods
    data = np.genfromtxt('/Users/angusr/Python/george/targets.txt').T
    KIDs = data[0]
#     p_init = data[1]

    save_results = np.zeros((len(KIDs), 8))

    for k, KID in enumerate(KIDs):

#         p_init = p_init[k]
        print k, KID

        # Load real quarter 3 data
        x, y, yerr = load("/Users/angusr/angusr/data2/Q3_public/kplr0%s-2009350155506_llc.fits" %int(KID))

        r = .4 # range of periods to try
        s = 30. # number of periods to try
        b = .2 # prior boundaries

        # compute acf
        p_init = autocorrelation(x, y)

        # compute lomb scargle periodogram
        pgram(y, r, p_init, highres = True)

        # normalise so range is 2 - no idea if this is the right thing to do...
        yerr = 2*yerr/(max(y)-min(y))
        y = 2*y/(max(y)-min(y))
        y = y-np.median(y)