예제 #1
0
g = data[8] > subgiant

p1 = data[6][g]
p_err1 = data[7][g]
t1 = data[1][g]
t_err1 = data[2][g]
a1 = data[3][g]
a_errp1 = data[4][g]
a_errm1 = data[5][g]
a_err1 = .5 * (a_errp1 + a_errm1)
logg1 = data[8][g]
logg_err1 = .5*(data[9][g]+data[10][g])
feh1 = data[11][g]
feh_err1 = data[12][g]
flag1 = data[13][g]
bv1, bv_err1 = teff2bv_err(t1, logg1, feh1, t_err1, logg_err1, feh_err1)

# add clusters
data = np.genfromtxt("/Users/angusr/Python/Gyro/data/clusters.txt").T
l = (data[4] != 1.1) * (data[4] != .588)
bv2 = data[0][l]; bv_err2 = data[1][l]
p2 = data[2][l]; p_err2 = data[3][l]
a2 = data[4][l]; a_err2 = data[5][l]; a_errp2 = data[5][l]; a_errm2 = data[5][l]
logg2 = data[6][l]; logg_err2 = data[7][l]
flag2 = data[8][l]

# combine astero and cluster
bv = np.concatenate((bv1, bv2))
bv_err = np.concatenate((bv_err1, bv_err2))
p = np.concatenate((p1, p2))
p_err = np.concatenate((p_err1, p_err2))
예제 #2
0
파일: all_plotting.py 프로젝트: dfm/Gyro
def load_dat(fname, tn, cv):

#     KID[0], t[1], t_err[2], a[3], a_errp[4], a_errm[5], p[6], p_err[7]
#     logg[8], logg_errp[9], logg_errm[10], feh[11], feh_err[12], flag[13]
#     data = np.genfromtxt('/Users/angusr/Python/Gyro/data/garcia_all_astero.txt')
    data = np.genfromtxt('/Users/angusr/Python/Gyro/data/garcia_irfm.txt')
    KID = data[0]
    t = data[1]
    p = data[6]
    g = data[8]

    # remove periods <= 0 and teff == 0 FIXME: why is this necessary?
    l = (p > 0.)*(t > 100.)*(g > 0.)  # *(t<5800)

    KID = data[0][l]
    p = p[l]
    p_err = data[7][l]
    t = t[l]
    t_err = data[2][l]
    g = g[l]
    g_errp = data[9][l]
    g_errm = data[10][l]
    a = data[3][l]
    a_errp = data[4][l]
    a_errm = data[5][l]
    feh = data[11][l]
    feh_err = data[12][l]
    flag = data[13][l]

#     pl.clf()
#     l = feh!=-0.2
#     print feh[l]
#     print feh_err[l]
#     pl.hist(feh[l]+0.2, 20)
#     pl.show()
#     raw_input('enter')

    # convert temps to bvs
    bv_obs, bv_err = teff2bv_err(t, g, feh, t_err, .5*(g_errp+g_errm), feh_err)

    # add clusters FIXME: reddening
    data = np.genfromtxt("/Users/angusr/Python/noisy-plane/clusters.txt", skip_header=1).T
    bv_obs = np.concatenate((bv_obs, data[0]))
    bv_err = np.concatenate((bv_err, data[1]))
    p = np.concatenate((p, data[2]))
    p_err = np.concatenate((p_err, data[3]))
    a = np.concatenate((a, data[4]))
    a_errp = np.concatenate((a_errp, data[5]))
    a_errm = np.concatenate((a_errm, data[5]))
    g = np.concatenate((g, data[6]))
    g_errp = np.concatenate((g_errp, data[7]))
    g_errm = np.concatenate((g_errm, data[7]))
    flag = np.concatenate((flag, data[8]))

    # obviously comment these lines out if you want to use temps
    t = bv_obs
    t_err = bv_err

    # select star group
    flag[flag==2] = 9
    flag -= 3
    flag[flag<0] = 0
    fnames = ['A', 'H', 'P', 'N', 'C', 'F', 'V']
    flist = []
    for i in range(len(fnames)):
        if fname.find(fnames[i]) >= 0:
            print fnames[i], i
            flist.append(i)
    l = (np.sum([flag == i for i in flist], axis=0)) == 1
    t = t[l]; t_err = t_err[l]
    p = p[l]; p_err = p_err[l]
    a = a[l]; a_errp = a_errp[l]; a_errm = a_errm[l]
    g = g[l]; g_errp = g_errp[l]; g_errm = g_errm[l]
    flag = flag[l]

    # reduce errorbars if they go below zero
    # (only necessary if you don't use asym)
    g_err = .5*(g_errp+g_errm)
    a_err = .5*(a_errp + a_errm)
    diff = a - a_err
    l = diff < 0
    a_err[l] = a_err[l] + diff[l] - np.finfo(float).eps

    # LOO
    if cv:
        print 'cv', cv
        tn = np.ones_like(a)
        select = cv
        print select
        tn[select] = 0
        tn = tn==1
        print len(p), len(p[tn])

    if cv:
        return a[tn], a_err[tn], a_errp[tn], a_errm[tn], p[tn], p_err[tn], \
                t[tn], t_err[tn], g[tn], g_err[tn], g_errp[tn], g_errm[tn], flag[tn]
    print len(p)

    return a, a_err, a_errp, a_errm, p, p_err, t, t_err, g, g_err, g_errp, g_errm, flag
예제 #3
0
# KID = data[0]
# teff = data[1]
# age = data[3]
# age_errp = data[4]
# age_errm = data[5]
# teff_err = data[2]
# period = data[6]
# period_err = data[7]
# age_err = .5*(age_errp+age_errm)
# logg = data[8]
# logg_errp = data[9]
# logg_errm = data[10]
# logg_err = .5*(logg_errp+logg_errm)
# feh = data[11]
# feh_err = data[12]
bv, bv_err = teff2bv_err(teff, logg, feh, teff_err, logg_err, feh_err)

# cool dwarfs
pl.clf()
# bv -= kb
pl.errorbar(bv, period, yerr=period_err, xerr=bv_err, color=ocols[1], mec=ocols[1], \
    ecolor='.7', capsize=0, fmt='.', markersize=ms)
xp, yp = iso(1000.)
# xp -= .4
pl.plot(xp, yp, linestyle='--', color='.75', label=lab)
xp, yp = iso(2000.)
# xp -= .4
pl.plot(xp, yp, linestyle='--', color='.75')
xp, yp = iso(5000.)
# xp -= .4
pl.plot(xp, yp, linestyle='--', color='.75')
예제 #4
0
파일: paper_figs.py 프로젝트: dfm/Gyro
KID = data[0][l]
t1 = data[1][l]
t1_err = data[2][l]
a1 = data[3][l]
a1_errp = data[4][l]
a1_errm = data[5][l]
a1_err = .5*(a1_errp+a1_errm)
p1 = data[6][l]
p1_err = data[7][l]
logg1 = data[8][l]
logg1_errp = data[9][l]
logg1_errm = data[10][l]
logg1_err = .5*(logg1_errp+logg1_errm)
feh1 = data[11][l]
feh1_err = data[12][l]
bv1, bv1_err = teff2bv_err(t1, logg1, feh1, t1_err, logg1_err, feh1_err)

# load travis and victor data
data = np.genfromtxt("/Users/angusr/Python/Gyro/data/vandt.txt", skip_header=1).T
vtKID = data[0]
vtt = data[1]
vtt_err = data[2]
vta = data[3]
vta_errp = data[4]
vta_errm = data[5]
vta_err = .5*(vta_errp+vta_errm)
vtp = data[6]
vtp_err = data[7]
vtlogg = data[8]
vtlogg_errp = data[9]
vtlogg_errm = data[10]
예제 #5
0
data = np.genfromtxt('/Users/angusr/Python/Gyro/data/garcia_all_astero.txt')
t = data[1]
t_err = data[2]
a = data[3]
a_errp = data[4]
a_errm = data[5]
a_err = .5*(a_errp+a_errm)
p = data[6]
p_err = data[7]
logg = data[8]
logg_errp = data[9]
logg_errm = data[10]
logg_err = .5*(logg_errp+logg_errm)
feh = data[11]
feh_err = data[12]
bv, bv_err = teff2bv_err(t, logg, feh, t_err, logg_err, feh_err)

# periods1 = np.zeros_like(p)
# period_errs1 = np.zeros_like(p)
# periods2 = np.zeros_like(p)
# period_errs2 = np.zeros_like(p)
# for i, ps in enumerate(p):
#     periods1[i], period_errs1[i] = MC_errors(pars, errp, errm, a[i], a_err[i], bv[i], bv_err[i], c, nsamp, period_model, model)
#     periods2[i], period_errs2[i] = MC_errors_simple(pars, errp, errm, a[i], bv[i], c, nsamp, period_model, model)

# l1 = (period_errs1>0) * (periods1>0)
# l2 = (period_errs2>0) * (periods2>0)
# print 'Typical uncertainty on rotation period, given typical observational uncertainties:'
# print np.median(period_errs1[l1]/periods1[l1])*100, '%'
#
# print 'Typical intrinsic uncertainty on rotation period:'
예제 #6
0
data = np.genfromtxt('/Users/angusr/Python/Gyro/data/all_astero_plusgarcia.txt')
teff = data[1]
teff_err = data[2]
age = data[3]
age_errp = data[4]
age_errm = data[5]
age_err = .5*(age_errp+age_errm)
period = data[6]
period_err = data[7]
logg = data[8]
logg_errp = data[9]
logg_errm = data[10]
logg_err = .5*(logg_errp+logg_errm)
feh = data[11]
feh_err = data[11]
bv, bv_err = teff2bv_err(teff, logg, feh, teff_err, logg_err, feh_err)
a_errp = age_errp
a_errm = age_errm
p_err = period_err
print period

pl.clf()
pl.errorbar(age, period, xerr = (a_errp, a_errm), yerr = p_err, \
            color = ocols[1], fmt = 'o', mec = ocols[1], capsize = 0, \
    markersize = ms, ecolor = '0.8')
pl.ylabel("$P_{rot}~\mathrm{(days)}$")
pl.xlabel("$\mathrm{Age~(Gyr)}$")
pl.xlim(0.1, 15)
pl.ylim(0, 70)
pl.savefig('cool_stars5')