Пример #1
0
def create_testcase04():

    bjd0 = bjd_obs - Tref

    y_pla = instrument['RV_offset1'] + \
            kp.kepler_RV_T0P(bjd0,
                             planet_b['f'],
                             planet_b['P'],
                             planet_b['K'],
                             planet_b['e'],
                             planet_b['o']) + \
            kp.kepler_RV_T0P(bjd0,
                             planet_c['f'],
                             planet_c['P'],
                             planet_c['K'],
                             planet_c['e'],
                             planet_c['o'])

    mod_pl = np.random.normal(y_pla, instrument['RV_precision'])

    #Tcent_b = kp.kepler_Tcent_T0P(planet_b['P'], planet_b['f'], planet_b['e'], planet_b['o']) + Tref
    Tcent_b = np.random.normal(
        np.arange(0, 10) * planet_b['P'] + kp.kepler_Tcent_T0P(
            planet_b['P'], planet_b['f'], planet_b['e'], planet_b['o']) + Tref,
        instrument['T0_precision'])

    Tcent_c = np.random.normal(
        np.arange(0, 10) * planet_c['P'] + kp.kepler_Tcent_T0P(
            planet_c['P'], planet_c['f'], planet_c['e'], planet_c['o']) + Tref,
        instrument['T0_precision'])

    fileout = open('TestCase04_RV.dat', 'w')
    for b, r in zip(bjd_obs, mod_pl):
        fileout.write('{0:f}  {1:.2f}  {2:.2f}  {3:d}  {4:d}  {5:d}\n'.format(
            b, r, instrument['RV_precision'], 0, 0, -1))
    fileout.close()

    fileout = open('TestCase04_Tcent_b.dat', 'w')
    for i_Tc, v_Tc in enumerate(Tcent_b):
        fileout.write('{0:d}  {1:.4f}  {2:.4f}  {3:d}\n'.format(
            i_Tc, v_Tc, instrument['T0_precision'], 0))
    fileout.close()

    fileout = open('TestCase04_Tcent_c.dat', 'w')
    for i_Tc, v_Tc in enumerate(Tcent_c):
        fileout.write('{0:d}  {1:.4f}  {2:.4f}  {3:d}\n'.format(
            i_Tc, v_Tc, instrument['T0_precision'], 0))
    fileout.close()
def create_testcase08():

    bjd0 = bjd_obs - Tref

    y_pla = kp.kepler_RV_T0P(bjd0,
                             planet_b['f'],
                             planet_b['P'],
                             planet_b['K'],
                             planet_b['e'],
                             planet_b['o']) \
            + instrument['RV_offset1'] \
            + polynomial_trend['c1']*bjd0 + polynomial_trend['c2']*bjd0*bjd0

    mod_pl = np.random.normal(y_pla, instrument['RV_precision'])

    Tcent_b =  np.random.normal(
        np.arange(0, 5)*planet_b['P'] + kp.kepler_Tcent_T0P(planet_b['P'], planet_b['f'], planet_b['e'], planet_b['o']) + Tref,
        instrument['T0_precision'])

    fileout = open('TestCase08_RV.dat', 'w')
    for b, r in zip(bjd_obs, mod_pl):
        fileout.write('{0:f}  {1:.2f}  {2:.2f}  {3:d}  {4:d}  {5:d}\n'.format(b, r, instrument['RV_precision'], 0, 0, -1))
    fileout.close()

    fileout = open('TestCase08_Tcent_b.dat', 'w')
    for i_Tc, v_Tc in enumerate(Tcent_b):
        fileout.write('{0:d}  {1:.4f}  {2:.4f}  {3:d}\n'.format(i_Tc, v_Tc, instrument['T0_precision'], 0))
    fileout.close()
Пример #3
0
def create_test2():
    x = np.arange(6000, 6100, 1, dtype=np.double)
    x = np.random.normal(x, 0.4)
    Tref = np.mean(x, dtype=np.double)
    x0 = x - Tref

    print Tref
    P = 23.4237346
    K = 43.47672
    phase = 0.34658203
    e = 0.13
    omega = 0.673434
    offset = 45605

    y_pla = kp.kepler_RV_T0P(x0, phase, P, K, e, omega) + offset

    mod_pl = np.random.normal(y_pla, 2)

    trip = np.arange(10, 3, -1)
    Transit_Time = kp.kepler_Tcent_T0P(P, phase, e, omega) + Tref - trip * P
    Transit_Time = kp.kepler_Tcent_T0P(P, phase, e, omega) + Tref
    print 'Transit Time:', Transit_Time
    print 'transit Time - Tref', Transit_Time - Tref

    plt.scatter(x, mod_pl)
    plt.axvline(Transit_Time)
    plt.show()

    fileout = open('test2_RV.dat', 'w')
    for ii in xrange(0, np.size(x)):
        fileout.write('{0:14f} {1:14f} {2:14f} {3:5d} {4:5d} {5:5d} \n'.format(
            x[ii], mod_pl[ii], 2., 0, 0, -1))
    fileout.close()

    fileout = open('test2_Tcent_0.dat', 'w')
    for ii in xrange(0, np.size(Transit_Time)):
        fileout.write('{0:14f} {1:14f} \n'.format(Transit_Time, 0.01))
    fileout.close()
def phase_calc(p, t_obs, period, e, omega):
    t_mod = kp.kepler_Tcent_T0P(period, p, e, omega)
    return t_obs-t_mod
def create_testcase07():
    import george

    bjd0 = bjd_obs - Tref

    err = bjd0 * 0 + instrument['RV_precision']


    gp_pams = np.zeros(4)
    gp_pams[0] = np.log(activity['Hamp_RV1']) * 2
    gp_pams[1] = np.log(activity['Pdec'])*2
    gp_pams[2] = 1. / (2*activity['Oamp'] ** 2)
    gp_pams[3] = np.log(activity['Prot'])

    kernel = np.exp(gp_pams[0]) * \
             george.kernels.ExpSquaredKernel(metric=np.exp(gp_pams[1])) * \
             george.kernels.ExpSine2Kernel(gamma=gp_pams[1], log_period=gp_pams[2])

    gp = george.GP(kernel)

    gp.compute(bjd0, err)
    prediction1 = gp.sample(bjd0)

    gp_pams[0] = np.log(activity['Hamp_RV2']) * 2
    kernel = np.exp(gp_pams[0]) * \
             george.kernels.ExpSquaredKernel(metric=np.exp(gp_pams[1])) * \
             george.kernels.ExpSine2Kernel(gamma=gp_pams[1], log_period=gp_pams[2])

    gp = george.GP(kernel)

    gp.compute(bjd0, err)
    prediction2 = gp.sample(bjd0)

    y_pla = kp.kepler_RV_T0P(bjd0,
                             planet_b['f'],
                             planet_b['P'],
                             planet_b['K'],
                             planet_b['e'],
                             planet_b['o'])

    mod_pl1 = np.random.normal(y_pla + prediction1 + instrument['RV_offset1'], instrument['RV_precision'])
    mod_pl2 = np.random.normal(y_pla + prediction2 + instrument['RV_offset2'], instrument['RV_precision'])

    Tcent_b =  np.random.normal(
        np.arange(0,1)*planet_b['P'] + kp.kepler_Tcent_T0P(planet_b['P'], planet_b['f'], planet_b['e'], planet_b['o']) + Tref,
        instrument['T0_precision'])

    fileout = open('TestCase07_RV_dataset1.dat', 'w')
    for b, r in zip(bjd_obs, mod_pl1):
        fileout.write('{0:f}  {1:.2f}  {2:.2f}  {3:d}  {4:d}  {5:d}\n'.format(b, r, instrument['RV_precision'], 0, 0, -1))
    fileout.close()

    fileout = open('TestCase07_RV_dataset2.dat', 'w')
    for b, r in zip(bjd_obs, mod_pl2):
        fileout.write('{0:f}  {1:.2f}  {2:.2f}  {3:d}  {4:d}  {5:d}\n'.format(b, r, instrument['RV_precision'], 0, 0, -1))
    fileout.close()

    fileout = open('TestCase07_Tcent_b.dat', 'w')
    for i_Tc, v_Tc in enumerate(Tcent_b):
        fileout.write('{0:d}  {1:.4f}  {2:.4f}  {3:d}\n'.format(i_Tc, v_Tc, instrument['T0_precision'], 0))
    fileout.close()
def create_testcase06():
    import george

    bjd0 = photometry['phot_bjd'] - Tref
    err = bjd0 * 0 + photometry['phot_precision']

    """ Conversion of the physical parameter to the internally defined parameter
    to be passed to george 
    """
    gp_pams = np.zeros(4)
    gp_pams[0] = np.log(activity['Hamp_PH']) * 2
    gp_pams[1] = np.log(activity['Pdec']) * 2
    gp_pams[2] = 1. / (2 * activity['Oamp'] ** 2)
    gp_pams[3] = np.log(activity['Prot'])

    kernel = np.exp(gp_pams[0]) * \
             george.kernels.ExpSquaredKernel(metric=np.exp(gp_pams[1])) * \
             george.kernels.ExpSine2Kernel(gamma=gp_pams[1], log_period=gp_pams[2])

    gp = george.GP(kernel)

    gp.compute(bjd0, err)
    prediction = gp.sample(bjd0)
    obs_photometry = np.random.normal(prediction, instrument['RV_precision'])

    fileout = open('TestCase06_photometry.dat', 'w')
    for b, p in zip(photometry['phot_bjd'], obs_photometry):
        fileout.write('{0:14f} {1:14f} {2:14f} {3:5d} {4:5d} {5:5d} \n'.format(
            b, p, photometry['phot_precision'], 0, 0, -1))
    fileout.close()

    bjd0 = bjd_obs - Tref

    err = bjd0 * 0 + instrument['RV_precision']

    gp_pams[0] = np.log(activity['Hamp_RV1']) * 2
    kernel = np.exp(gp_pams[0]) * \
             george.kernels.ExpSquaredKernel(metric=np.exp(gp_pams[1])) * \
             george.kernels.ExpSine2Kernel(gamma=gp_pams[1], log_period=gp_pams[2])

    gp = george.GP(kernel)

    gp.compute(bjd0, err)
    prediction = gp.sample(bjd0)

    y_pla = kp.kepler_RV_T0P(bjd0,
                             planet_b['f'],
                             planet_b['P'],
                             planet_b['K'],
                             planet_b['e'],
                             planet_b['o']) + instrument['RV_offset1']

    mod_pl = np.random.normal(y_pla + prediction, instrument['RV_precision'])

    Tcent_b =  np.random.normal(
        np.arange(0,1)*planet_b['P'] + kp.kepler_Tcent_T0P(planet_b['P'], planet_b['f'], planet_b['e'], planet_b['o']) + Tref,
        instrument['T0_precision'])

    fileout = open('TestCase06_RV.dat', 'w')
    for b, r in zip(bjd_obs, mod_pl):
        fileout.write('{0:f}  {1:.2f}  {2:.2f}  {3:d}  {4:d}  {5:d}\n'.format(b, r, instrument['RV_precision'], 0, 0, -1))
    fileout.close()