In [2]:
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.cm as cm
from astroML.correlation import two_point, bootstrap_two_point
from astropy.table import Table
import matplotlib
matplotlib.rcParams.update({'font.size':18})
matplotlib.rcParams.update({'font.family':'serif'})
In [3]:
# from exoplanetarchive.ipac.caltech.edu
Efile = 'planets_2019.04.22_15.27.57.csv'
df = pd.read_csv(Efile, comment='#')
df.columns
Out[3]:
In [4]:
Kok = np.where((df['ra'] > 200) & (df['dec'] > 20))[0]
plt.figure(figsize=(6,6))
plt.scatter(df['ra'][Kok], df['dec'][Kok], s=5, alpha=0.5)
Out[4]:
In [5]:
tbl = Table.read('kepler_dr2_1arcsec.fits', format='fits')
df2 = tbl.to_pandas()
df2.columns
Out[5]:
In [6]:
plt.figure(figsize=(6,6))
plt.scatter(df2['ra'].values, df2['dec'].values, s=1,alpha=0.1)
Out[6]:
In [ ]:
In [7]:
Xk = np.vstack((df['ra'].values[Kok], df['dec'].values[Kok])).T
Xf = np.vstack((df2['ra'].values, df2['dec'].values)).T
print(Xk.shape, Xf.shape)
In [8]:
Xf.shape
Out[8]:
In [9]:
Xf[np.random.randint(0, high=Xf.shape[0], size=10000),:].shape
Out[9]:
In [10]:
bins2pt = np.linspace(0.02, 5, 50)
# bins2pt = np.logspace(-1, 0.3, 50)
tptk = two_point(Xk, bins2pt)
# do a subset first to test...
tptf_sm = two_point(Xf[np.random.randint(0, high=Xf.shape[0], size=10000),:], bins2pt)
In [16]:
plt.plot(0.5*(bins2pt[1:]+bins2pt[0:-1]), tptf_sm, label='Kepler Field (10k)', c='k')
plt.plot(0.5*(bins2pt[1:]+bins2pt[0:-1]), tptk, label='Kep Exoplanets',c='r')
plt.plot([0,max(bins2pt)], [0,0], c='k', alpha=0.5)
plt.xlabel('Dist (deg)')
plt.ylabel('2pt Correlation')
plt.legend(fontsize=12)
# plt.xscale('log')
# plt.yscale('log')
Out[16]:
In [12]:
corrk, cerrk = bootstrap_two_point(Xk, bins2pt, Nbootstrap=500)
# do subsample again for field...
# corrf, cerrf = bootstrap_two_point(Xf[np.random.randint(0, high=Xf.shape[0], size=10000),:], bins2pt, Nbootstrap=5)
In [17]:
tptf = two_point(Xf, bins2pt) # the full sample... v. expensive to run apparently!
In [19]:
plt.plot(0.5*(bins2pt[1:]+bins2pt[0:-1]), tptf, label='Kepler Field', c='k')
plt.errorbar(0.5*(bins2pt[1:]+bins2pt[0:-1]), corrk, yerr=cerrk, label='Exoplanets', color='r')
plt.plot([0,max(bins2pt)], [0,0], c='k', alpha=0.5)
plt.xlabel('Dist (deg)')
plt.ylabel('2pt Correlation')
plt.legend(fontsize=12)
# plt.xscale('log')
# plt.yscale('log')
plt.savefig('../figures/2ptcf.pdf', dpi=150, bbox_inches='tight', pad_inches=0.25)
In [ ]: