Exemplo n.º 1
0
plt.show()

np.savetxt('plot_t.txt', t)
np.savetxt('plot_RV_HARPS.txt', XX[idx])
np.savetxt('plot_y.txt', y)
np.savetxt('plot_yerr.txt', yerr)
np.savetxt('plot_x.txt', x)
np.savetxt('plot_mu.txt', mu)
np.savetxt('plot_std.txt', std)

#==============================================================================
# Smoothing
#==============================================================================
sl = 0.5  # smoothing length
# xx 	 	= gaussian_smoothing(t, XX, t, sl)
xy = gaussian_smoothing(t, y, t, sl, 1 / yerr**2)
# zx      = gaussian_smoothing(t, ZX, t, sl)
np.savetxt('../../data/' + star + '/xy.txt', xy)

plt.figure()
# plt.errorbar(t, xx, yerr=yerr, fmt=".k", capsize=0, label='$RV_{HARPS}$')
plt.errorbar(t,
             xy,
             yerr=yerr,
             fmt=".r",
             capsize=0,
             label='$RV_{HARPS} - RV_{FT,L}$')
plt.ylabel("RV [m/s]")
plt.xlabel("JD - 2,400,000")
plt.legend()
plt.savefig('s1-RV1.png')
Exemplo n.º 2
0
# #==============================================================================
# # GP smoothing
# #==============================================================================
# import pymc3 as pm
# from theano import shared
# from pymc3.distributions.timeseries import GaussianRandomWalk
# from scipy import optimize
# import scipy.stats as stats

#==============================================================================
# Test smoothing
#==============================================================================
if 0:
    sl = 3  # smoothing length
    YYs = gaussian_smoothing(t, YY, t, sl)
    ZZs = gaussian_smoothing(t, ZZ, t, sl)
    plt.plot(t, YYs, 'bo', label=r'$RV_{FT,L}$')
    plt.plot(t, ZZs, 'rs', label=r'$RV_{FT,H}$')
    plt.plot(t, GG, '-')
    plt.show()
    # plt.plot(RV_jitter, GG-YY, 's')
    plt.plot(RV_jitter, GG - YY, 'o')
    plt.plot(RV_jitter, GG - YYs, '*')
    # # plt.plot(RV_jitter, ZZ-GG, 's')
    # plt.plot(RV_jitter, ZZs-GG, 'o')
    plt.show()

#==============================================================================
# Periodogram
#==============================================================================
Exemplo n.º 3
0
plt.ylabel("$RV_{FT,H} - RV_{HARPS}$ [m/s]")
plt.savefig('2-correlation_ZX.png')
# plt.show()

plt.figure()
plt.errorbar(XY, ZX, yerr=yerr, fmt=".r")
plt.xlabel("$RV_{HARPS} - RV_{FT,L}$ [m/s]")
plt.ylabel("$RV_{FT,H} - RV_{HARPS}$ [m/s]")
plt.savefig('2-correlation_XYZ.png')
# plt.show()

#==============================================================================
# Smoothing
#==============================================================================
sl      = 1         # smoothing length
xx 	 	= gaussian_smoothing(t, XX, t, sl)
xy      = gaussian_smoothing(t, XY, t, sl)
zx      = gaussian_smoothing(t, ZX, t, sl)

plt.figure()
plt.errorbar(t, xx, yerr=yerr, fmt=".k", capsize=0, label='$RV_{HARPS}$')
plt.errorbar(t, xy, yerr=yerr, fmt=".r", capsize=0, label='$RV_{HARPS} - RV_{FT,L}$')
plt.ylabel("RV [m/s]")
plt.xlabel("JD - 2,400,000")
plt.legend()
plt.savefig('s1-RV1.png')
# plt.show()

plt.figure()
plt.errorbar(t, xx, yerr=yerr, fmt=".k", capsize=0, label='$RV_{HARPS}$')
plt.errorbar(t, zx, yerr=yerr, fmt=".r", capsize=0, label='$RV_{FT,H} - RV_{HARPS}$')
Exemplo n.º 4
0
#==============================================================================
# Read data
#==============================================================================

BJD = np.loadtxt('MJD_2012.txt')
Jitter = np.loadtxt('Jitter_model_2012.txt')
RV_noise = np.loadtxt('RV_noise_2012.txt')
weight = 1 / RV_noise**2

RV_additional = np.loadtxt('RV_additional')
RV_conv = np.loadtxt('RV_conv')

from functions import gaussian_smoothing

t_resample = np.linspace(min(BJD), max(BJD), 200)
Jitter2 = gaussian_smoothing(BJD, Jitter, t_resample, 1., weight)
jitter_smooth = gaussian_smoothing(BJD, Jitter, BJD, 1., weight)
np.savetxt(out_dir + 'jitter_smooth_2012.txt', jitter_smooth)

plt.errorbar(BJD,
             Jitter,
             yerr=RV_noise,
             fmt=".k",
             capsize=0,
             label='noisy jitter')
plt.plot(t_resample, Jitter2, '--', label='filtered_jitter')
plt.show()

# bin the data of the same night - use a moving average #

n_bin = int(max(BJD) - min(BJD) + 1)
Exemplo n.º 5
0
x = np.loadtxt(directory + 'GG.txt')
y = np.loadtxt(directory + 'YY.txt')
z = np.loadtxt(directory + 'ZZ.txt')
bi = np.loadtxt(directory + 'BI.txt')
# xy 			= 0 - y
# zx   		= z
xy = x - y
zx = z - x

DIR = '/Volumes/DataSSD/OneDrive - UNSW/Hermite_Decomposition/ESO_HARPS/' + star
RV_noise = np.loadtxt(DIR + '/RV_noise.dat')
MJD = np.loadtxt(DIR + '/MJD.dat')

from functions import gaussian_smoothing
plt.errorbar(MJD, xy, yerr=RV_noise * 3**0.5, fmt="r.", capsize=0, alpha=0.2)
jitter_s = gaussian_smoothing(MJD, xy, MJD, 0.5, 1 / RV_noise**2)
plt.errorbar(MJD,
             jitter_s,
             yerr=RV_noise * 3**0.5,
             fmt="b.",
             capsize=0,
             alpha=0.3)
plt.show()

plt.errorbar(MJD, x, yerr=RV_noise, fmt="k.", capsize=0, alpha=0.5)
# plt.errorbar(MJD, xy, yerr=RV_noise*3**0.5, fmt="r.", capsize=0, alpha=0.2)
plt.errorbar(MJD, zx, yerr=RV_noise * 3**0.5, fmt="r.", capsize=0, alpha=0.2)
plt.show()

# smoothing
# x = gaussian_smoothing(MJD, x, MJD, 1, 1/RV_noise**2)
Exemplo n.º 6
0
#==============================================================================
# Align the data using a moving average
#==============================================================================

sl = 0.1
if YEAR == 2009:
    idx = idx1
    iddx = iddx1
if YEAR == 2010:
    idx = idx2
    iddx = iddx2
if YEAR == 2011:
    idx = idx3
    iddx = iddx3

fe4376_s = gaussian_smoothing(JD_wise[idx], fe4376[idx], t, sl,
                              np.ones(sum(idx)))
fe5250_s = gaussian_smoothing(JD_wise[idx], fe5250[idx], t, sl,
                              np.ones(sum(idx)))
log_RHK_s = gaussian_smoothing(BJD[iddx], log_RHK[iddx], t, sl,
                               np.ones(sum(iddx)))
BIS_s = gaussian_smoothing(BJD[iddx], BIS[iddx], t, sl, np.ones(sum(iddx)))
FWHM_s = gaussian_smoothing(BJD[iddx], FWHM[iddx], t, sl, np.ones(sum(iddx)))
FTL_s = gaussian_smoothing(t, y, t, sl, yerr)

#==============================================================================
# Correlogram
#==============================================================================

left = 0.1  # the left side of the subplots of the figure
right = 0.97  # the right side of the subplots of the figure
bottom = 0.07  # the bottom of the subplots of the figure
Exemplo n.º 7
0
rv2 = np.loadtxt('HD85390_HARPSbinjit2.vels')
all_rvs = np.vstack((rv1, rv2))
# all_rvs     = np.loadtxt('HD85390_quad.vels')
# RV_HARPS    = np.loadtxt('RV_HARPS.dat')

t = all_rvs[:, 0]
x = all_rvs[:, 0]
y = all_rvs[:, 1]
yerr = all_rvs[:, 2]

jitter_raw = np.loadtxt('./data/jitter_raw.txt')
fwhm = np.loadtxt('./data/hd85390_fwhm.dat')
from functions import gaussian_smoothing

t_resample = np.linspace(min(t), max(t), 1000)
jitter_smooth = gaussian_smoothing(t[:96], jitter_raw, t[:96], 200.,
                                   np.ones(96))
fwhm_smooth = gaussian_smoothing(fwhm[:, 0], fwhm[:, 1], t[:96], 200.,
                                 np.ones(114))

plt.figure()
# plt.plot(jitter_smooth, fwhm[:,1])
plt.plot(fwhm[:, 0], fwhm[:, 1], '.', label='FWHM')
plt.plot(t[:96], fwhm_smooth, label='smoothed FWHM')
plt.xlabel("BJD - 2400000")
plt.ylabel('FWHM [km/s]')
plt.legend()
# plt.savefig('FWHM.png')
plt.show()

plt.figure()
plt.plot(fwhm_smooth[0:96], jitter_smooth, '.')
Exemplo n.º 8
0
    new_dir = str(n) + '/'
    os.makedirs(new_dir)

    ################
    # Present data #
    ################

    # re-sample
    x = gran_gen(n_group, n_obs)
    print('Observation samples:')
    x = np.sort(random.sample(range(200), 40))
    print(x)
    RV_IN = np.array([RV_IN0[i] for i in x])
    RV_FT = np.array([RV_FT0[i] for i in x])
    RV_diff = RV_IN - RV_FT
    RV_diff = gaussian_smoothing(x, RV_diff, x, 2)
    # Gaussian smoothing
    # RV_diff2 = gaussian_smoothing(x, RV_diff, x, 6)
    # plt.plot(t, Jitter_in, x, RV_diff*5, '.', x, RV_diff2*5, '*'); plt.show()

    if 1:  # sub-sampling
        fig = plt.figure()
        plt.plot(t, RV_IN0, 'o', label='full samples')
        plt.plot(x, RV_IN, 'r.', label='sub-sampling')
        plt.title('Sampling = %i' % n_obs)
        plt.xlabel(r"$t$")
        plt.ylabel('Measured RV [m/s]')
        plt.legend()
        plt.savefig(new_dir + '0-RV_sampling.png')

    if 1:  # Time series
Exemplo n.º 9
0
import numpy as np
from functions import gaussian_smoothing

BJD = np.loadtxt('MJD.dat')
BJD = BJD - min(BJD)
# BJD         = BJD[:-1]
RV_HARPS = np.loadtxt('RV_HARPS.dat')
RV_HARPS = (RV_HARPS - np.mean(RV_HARPS)) * 1000
# RV_HARPS    = RV_HARPS[:-1]
Jitter = np.loadtxt('RV_jitter.txt')
# Jitter      = Jitter[:-1]
RV_noise = np.loadtxt('RV_noise.dat')
# RV_noise    = RV_noise[:-1]
weight = 1 / RV_noise**2
t_resample = np.linspace(min(BJD), max(BJD), 10000)
Jitter2 = gaussian_smoothing(BJD, Jitter, BJD, 1.5, weight)

# plt.errorbar(BJD, RV_HARPS, yerr=RV_noise, fmt=".", capsize=0)
plt.plot(BJD, Jitter, '.')
plt.plot(BJD, Jitter2, '.')
plt.show()

#==============================================================================
# Periodogram
#==============================================================================
from astropy.stats import LombScargle

min_f = 0.001
max_f = 5
spp = 10
Exemplo n.º 10
0
plt.errorbar(x, y - YY, yerr=yerr, fmt=".r", capsize=0)
plt.ylabel("RV [m/s]")
plt.xlabel("JD - 2,400,000")
# plt.savefig('HD10700-1-RV.png')
plt.show()

# 54099

# 54422: 4 day period?

# XX  = np.loadtxt('XX.txt')
YY = np.loadtxt('YY.txt')
ZZ = np.loadtxt('ZZ.txt')

sl = 0.5  # smoothing length
XY = gaussian_smoothing(x, y - YY, x, sl)
XX = gaussian_smoothing(x, y, x, sl)
plt.figure()
# plt.errorbar(x, XX, yerr=yerr, fmt=".k", capsize=0)
# plt.errorbar(x, XY, yerr=yerr, fmt=".r", capsize=0)
plt.plot(x, XX, '.k')
plt.plot(x, XY, '.r')
plt.ylabel("RV [m/s]")
plt.xlabel("JD - 2,400,000")
# plt.savefig('HD10700-1-RV.png')
plt.show()

# idx = (x > 53500) & (x < 53800)
idx = (x > 54250) & (x < 54500)

x = x[idx]
Exemplo n.º 11
0
# #==============================================================================
# # GP smoothing
# #==============================================================================
# import pymc3 as pm
# from theano import shared
# from pymc3.distributions.timeseries import GaussianRandomWalk
# from scipy import optimize
# import scipy.stats as stats

#==============================================================================
# Test smoothing
#==============================================================================
if 0:
    sl = 8  # smoothing length
    YYs = gaussian_smoothing(t, YY, t, sl)
    ZZs = gaussian_smoothing(t, ZZ, t, sl)
    plt.plot(t, YYs, 'bo', label=r'$RV_{FT,L}$')
    plt.plot(t, ZZs, 'rs', label=r'$RV_{FT,H}$')
    plt.plot(t, GG, '-')
    # plt.show()
    # plt.plot(RV_jitter, GG-YY, 's')
    # plt.plot(RV_jitter, GG-YYs, 'o')
    # # plt.plot(RV_jitter, ZZ-GG, 's')
    # plt.plot(RV_jitter, ZZs-GG, 'o')
    plt.show()

#==============================================================================
# Periodogram
#==============================================================================
from astropy.stats import LombScargle
Exemplo n.º 12
0
import numpy as np
from functions import gaussian_smoothing

BJD         = np.loadtxt('MJD.dat')
BJD         = BJD - min(BJD)
BJD         = BJD[:-1]
RV_HARPS    = np.loadtxt('RV_HARPS.dat')
RV_HARPS    = (RV_HARPS - np.mean(RV_HARPS))*1000
RV_HARPS    = RV_HARPS[:-1]
Jitter      = np.loadtxt('RV_jitter.txt')
Jitter      = Jitter[:-1]
RV_noise    = np.loadtxt('RV_noise.dat')
RV_noise    = RV_noise[:-1]
weight      = 1 / RV_noise**2
t_resample = np.linspace(min(BJD), max(BJD), 10000)
Jitter2     = gaussian_smoothing(BJD, Jitter, t_resample, 1.5, weight)


plt.errorbar(BJD, RV_HARPS, yerr=RV_noise, fmt=".", capsize=0)
# plt.plot(BJD, Jitter, '.')
# plt.plot(t_resample, Jitter2, '-')
plt.show()



#==============================================================================
# Periodogram
#==============================================================================
from astropy.stats import LombScargle

min_f   = 0.01