pip install --pre astroquery
conda install -c astropy astroquery
from astroquery.nasa_exoplanet_archive import NasaExoplanetArchive
# มอดูลเหล่านี้จากนี้ไปจะใช้ด้วย ขอนำเข้ามาเตรียมไว้ก่อนเลย
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
table = NasaExoplanetArchive.get_confirmed_planets_table()
print(table)
pl_hostname pl_letter pl_name ... NAME_LOWERCASE sky_coord
... deg,deg
------------ --------- -------------- ... -------------- ---------------------
Kepler-92 b Kepler-92 b ... kepler-92b 289.086058,41.562941
Kepler-92 c Kepler-92 c ... kepler-92c 289.086058,41.562941
Kepler-93 b Kepler-93 b ... kepler-93b 291.418281,38.672354
Kepler-93 c Kepler-93 c ... kepler-93c 291.418281,38.672354
Kepler-94 b Kepler-94 b ... kepler-94b 281.194747,47.497148
Kepler-94 c Kepler-94 c ... kepler-94c 281.194747,47.497148
... ... ... ... ... ...
K2-256 b K2-256 b ... k2-256b 186.227158,-2.065931
K2-257 b K2-257 b ... k2-257b 188.278488,-1.953159
K2-258 b K2-258 b ... k2-258b 187.631332,-1.16092
K2-259 b K2-259 b ... k2-259b 186.802689,1.566849
IC 4651 9122 b IC 4651 9122 b ... ic46519122b 261.208618,-49.948917
HD 26965 b HD 26965 b ... hd26965b 63.818001,-7.652871
Wolf 503 b Wolf 503 b ... wolf503b 206.847687,-6.136875
Length = 3946 rows
table = NasaExoplanetArchive.get_confirmed_planets_table(cache=0)
df = pd.DataFrame({c: table[c] for c in table.columns})
df.set_index('pl_name',inplace=True)
print(df.columns.values)
print(df.shape)
['pl_hostname' 'pl_letter' 'pl_discmethod' 'pl_controvflag' 'pl_pnum'
'pl_orbper' 'pl_orbpererr1' 'pl_orbpererr2' 'pl_orbperlim' 'pl_orbpern'
'pl_orbsmax' 'pl_orbsmaxerr1' 'pl_orbsmaxerr2' 'pl_orbsmaxlim'
'pl_orbsmaxn' 'pl_orbeccen' 'pl_orbeccenerr1' 'pl_orbeccenerr2'
'pl_orbeccenlim' 'pl_orbeccenn' 'pl_orbincl' 'pl_orbinclerr1'
'pl_orbinclerr2' 'pl_orbincllim' 'pl_orbincln' 'pl_bmassj'
'pl_bmassjerr1' 'pl_bmassjerr2' 'pl_bmassjlim' 'pl_bmassn' 'pl_bmassprov'
'pl_radj' 'pl_radjerr1' 'pl_radjerr2' 'pl_radjlim' 'pl_radn' 'pl_dens'
'pl_denserr1' 'pl_denserr2' 'pl_denslim' 'pl_densn' 'pl_ttvflag'
'pl_kepflag' 'pl_k2flag' 'ra_str' 'dec_str' 'ra' 'st_raerr' 'dec'
'st_decerr' 'st_posn' 'st_dist' 'st_disterr1' 'st_disterr2' 'st_distlim'
'st_distn' 'st_optmag' 'st_optmagerr' 'st_optmaglim' 'st_optband'
'gaia_gmag' 'gaia_gmagerr' 'gaia_gmaglim' 'st_teff' 'st_tefferr1'
'st_tefferr2' 'st_tefflim' 'st_teffn' 'st_mass' 'st_masserr1'
'st_masserr2' 'st_masslim' 'st_massn' 'st_rad' 'st_raderr1' 'st_raderr2'
'st_radlim' 'st_radn' 'pl_nnotes' 'rowupdate' 'pl_facility'
'NAME_LOWERCASE' 'sky_coord']
(3946, 83)
n_discmet = df.groupby('pl_discmethod').apply(len).sort_values(ascending=False)
lis_discmet = n_discmet.index
for i,(dm,n) in enumerate(n_discmet.iteritems()):
plt.text(n*0.9,i,'%d'%n,fontsize=12,ha='right',va='center',color='w')
n_met = len(n_discmet)
plt.barh(range(n_met),n_discmet,color='#665599')
plt.yticks(range(n_met),lis_discmet,fontsize=12)
plt.semilogx()
plt.tick_params(left=0)
plt.axes().invert_yaxis()
plt.tight_layout(0)
plt.show()
n_fac_dis = df.groupby('pl_facility').apply(len).sort_values(ascending=False)
print(n_fac_dis)
pl_facility
Kepler 2342
K2 360
La Silla Observatory 232
W. M. Keck Observatory 171
Multiple Observatories 116
SuperWASP 110
HATNet 57
HATSouth 57
OGLE 50
Haute-Provence Observatory 45
Anglo-Australian Telescope 35
SuperWASP-South 32
Lick Observatory 32
CoRoT 31
McDonald Observatory 28
MOA 23
Okayama Astrophysical Observatory 23
Paranal Observatory 17
Roque de los Muchachos Observatory 17
Bohyunsan Optical Astronomical Observatory 16
Las Campanas Observatory 14
Transiting Exoplanet Survey Satellite (TESS) 11
KELT 10
Gemini Observatory 9
Subaru Telescope 8
Thueringer Landessternwarte Tautenburg 8
Qatar 7
KMTNet 7
Multiple Facilities 7
Hubble Space Telescope 6
Fred Lawrence Whipple Observatory 6
XO 6
Calar Alto Observatory 5
TrES 5
KELT-North 5
KELT-South 4
Spitzer Space Telescope 3
Arecibo Observatory 3
United Kingdom Infrared Telescope 2
SuperWASP-North 2
Palomar Observatory 2
Parkes Observatory 2
Large Binocular Telescope Observatory 2
Cerro Tololo Inter-American Observatory 2
Xinglong Station 2
MEarth Project 2
Apache Point Observatory 1
European Southern Observatory 1
Yunnan Astronomical Observatory 1
Infrared Survey Facility 1
Kitt Peak National Observatory 1
Leoncito Astronomical Complex 1
Mauna Kea Observatory 1
Oak Ridge Observatory 1
Teide Observatory 1
WASP-South 1
Acton Sky Portal Observatory 1
dtype: int64
print(df[df.pl_facility=='Okayama Astrophysical Observatory'].index.values)
['HD 14067 b' '6 Lyn b' '14 And b' '18 Del b' '75 Cet b' '81 Cet b'
'HD 81688 b' 'eps Tau b' 'nu Oph b' 'nu Oph c' 'ome Ser b' 'omi CrB b'
'omi UMa b' 'xi Aql b' 'HD 104985 b' 'HD 120084 b' 'HD 2952 b'
'HD 5608 b' 'gam Lib b' 'gam Lib c' '24 Boo b' 'HD 47366 b' 'HD 47366 c']
print(df[df.pl_facility=='Subaru Telescope'].pl_discmethod)
pl_name
HD 17156 b Radial Velocity
HD 38801 b Radial Velocity
kap And b Imaging
DH Tau b Imaging
GJ 504 b Imaging
HD 145457 b Radial Velocity
HD 149026 b Radial Velocity
HD 180314 b Radial Velocity
Name: pl_discmethod, dtype: object
df1 = df[df.pl_radj>0]
print(df1.pl_radj.describe())
count 3080.000000
mean 0.370629
std 0.422444
min 0.030000
25% 0.140000
50% 0.208000
75% 0.315000
max 6.900000
Name: pl_radj, dtype: float64
print(df1.groupby('pl_discmethod').apply(len).sort_values(ascending=False))
pl_discmethod
Transit 3042
Imaging 15
Radial Velocity 13
Transit Timing Variations 7
Orbital Brightness Modulation 3
dtype: int64
print(df1.loc[[df1.pl_radj.idxmin(),df1.pl_radj.idxmax()]].pl_radj)
pl_name
Kepler-37 b 0.03
HD 100546 b 6.90
Name: pl_radj, dtype: float64
print((df1.pl_radj>1).sum()) # ดาวที่ใหญ่กว่าดาวพฤหัส
print((df1.pl_radj<0.08921).sum()) # ดาวที่เล็กกว่าโลก
387
157
plt.hist(np.log10(df1.pl_radj),100,ec='k')
plt.xlabel('ขนาดดาวเคราะห์ ($R_J$)',fontname='Tahoma')
xtick = np.arange(-2,2.)
plt.xticks(xtick,10**xtick)
plt.show()
st_rad = df[df.st_rad>0].drop_duplicates('pl_hostname').st_rad
print(st_rad.describe())
count 2720.000000
mean 1.689048
std 4.083175
min 0.040000
25% 0.810000
50% 0.990000
75% 1.280000
max 71.230000
Name: st_rad, dtype: float64
plt.hist(np.log10(st_rad),100,ec='k')
plt.xlabel('ขนาดดาวหลัก ($R_S$)',fontname='Tahoma')
xtick = np.arange(-1,3.)
plt.xticks(xtick,10**xtick)
plt.show()
df1 = df[(df.pl_radj>0)&(df.st_rad>0)]
pl_rad = df1.pl_radj*0.10049
st_rad = df1.st_rad
rp_rs = pl_rad / st_rad
print(rp_rs.describe())
count 3070.000000
mean 0.036103
std 0.041042
min 0.003816
25% 0.015219
50% 0.023031
75% 0.035952
max 1.042863
dtype: float64
df2 = pd.DataFrame({'rp': pl_rad, 'rs': st_rad, 'rp_rs': rp_rs})
print(df2.loc[[rp_rs.idxmin(),rp_rs.idxmax()]])
rp rs rp_rs
pl_name
Kepler-37 b 0.003015 0.79 0.003816
WISEP J121756.91+162640.2 A b 0.093858 0.09 1.042863
plt.axes(xlim=[pl_rad.min(),pl_rad.max()],ylim=[st_rad.min(),st_rad.max()],aspect=1)
x = np.array([0,pl_rad.max()])
for r in np.logspace(-3,0,4):
plt.plot(x,x/r,'k--')
plt.scatter(pl_rad,st_rad,c=rp_rs,norm=mpl.colors.LogNorm(),marker='.',cmap='jet')
plt.xlabel('ขนาดดาวเคราะห์ ($R_S$)',fontname='Tahoma')
plt.ylabel('ขนาดดาวฤกษ์ ($R_S$)',fontname='Tahoma')
cb = plt.colorbar(pad=0.01)
cb.set_label(label='อัตราส่วนขนาดดาว',family='Tahoma')
plt.scatter([0.0091577],[1],70,c='r',marker='x')
plt.scatter([0.10049],[1],140,c='m',marker='+')
plt.loglog()
plt.show()
pl_orbper = df[(df.pl_orbper>0)].pl_orbper
print(pl_orbper.describe())
count 3.842000e+03
mean 2.357470e+03
std 1.181497e+05
min 9.070629e-02
25% 4.567262e+00
50% 1.198999e+01
75% 4.237136e+01
max 7.300000e+06
Name: pl_orbper, dtype: float64
plt.hist(np.log10(pl_orbper),80,ec='k')
plt.xlabel('คาบการโคจร (วัน)',fontname='Tahoma')
xtick = np.arange(-1,7.)
plt.xticks(xtick,['$10^{%d}$'%x for x in xtick])
plt.show()
df1 = df[(df.pl_radj>0)&(df.pl_orbper>0)]
print(len(df1))
df2 = df1[df1.pl_discmethod=='Transit']
plt.scatter(df2.pl_radj,df2.pl_orbper,marker='.',alpha=0.4)
df2 = df1[df1.pl_discmethod=='Radial Velocity']
plt.scatter(df2.pl_radj,df2.pl_orbper,marker='.')
df2 = df1[df1.pl_discmethod=='Imaging']
plt.scatter(df2.pl_radj,df2.pl_orbper,marker='.')
df2 = df1[(df1.pl_discmethod!='Transit')&(df1.pl_discmethod!='Radial Velocity')&(df1.pl_discmethod!='Imaging')]
plt.scatter(df2.pl_radj,df2.pl_orbper,marker='.')
plt.xlabel('ขนาดดาวเคราะห์ ($R_J$)',fontname='Tahoma')
plt.ylabel('คาบการโคจร (วัน)',fontname='Tahoma')
plt.legend(['การเคลื่อนผ่าน','ความเร็วแนวเล็ง','ถ่ายภาพโดยตรง','อื่นๆ'],prop={'family':'Tahoma'})
plt.loglog()
plt.show()
pl_orbincl = df[(df.pl_orbincl>0)].pl_orbincl
print(pl_orbincl.describe())
plt.hist(pl_orbincl,50,ec='k')
plt.xlabel('มุมเอียงวงโคจร',fontname='Tahoma')
plt.show()
count 771.000000
mean 86.100313
std 7.956823
min 7.700000
25% 86.010000
50% 88.010000
75% 89.210000
max 90.760000
Name: pl_orbincl, dtype: float64
df1 = df[(df.pl_bmassj>0)]
print(df1.pl_bmassj.describe())
print(df.groupby('pl_bmassprov').apply(len))
count 1530.000000
mean 2.535104
std 4.431595
min 0.000060
25% 0.110840
50% 0.915500
75% 2.580000
max 55.590000
Name: pl_bmassj, dtype: float64
pl_bmassprov
Mass 824
Msin(i)/sin(i) 5
Msini 701
dtype: int64
df1 = df[(df.pl_bmassj>0)&(df.pl_bmassprov!='Msini')]
print(df1.pl_bmassj.describe())
plt.hist(np.log10(df1.pl_bmassj),50,ec='k')
plt.xlabel('มวลดาวเคราะห์ ($M_J$)',fontname='Tahoma')
xtick = np.arange(-4,2.)
plt.xticks(xtick,10**xtick)
plt.show()
count 829.000000
mean 2.072610
std 4.088909
min 0.000060
25% 0.069220
50% 0.650000
75% 1.855000
max 30.000000
Name: pl_bmassj, dtype: float64
st_mass = df[df.st_mass>0].drop_duplicates('pl_hostname').st_mass
print(st_mass.describe())
plt.hist(np.log10(st_mass),80,ec='k')
plt.xlabel('มวลดาวหลัก ($M_S$)',fontname='Tahoma')
xtick = np.arange(-2,2.)
plt.xticks(xtick,10**xtick)
plt.show()
count 2633.000000
mean 1.027626
std 0.678201
min 0.010000
25% 0.830000
50% 0.980000
75% 1.140000
max 23.560000
Name: st_mass, dtype: float64
df1 = df[df.pl_dens>0]
print(df1.pl_dens.describe())
print(df1.loc[[df1.pl_dens.idxmin(),df1.pl_dens.idxmax()]][['pl_dens','pl_denserr1','pl_denserr2']])
plt.hist(np.log10(df1.pl_dens),40,ec='k')
plt.xlabel('ความหนาแน่น ($g/cm^3$)',fontname='Tahoma')
xtick = np.arange(-2,2.)
plt.xticks(xtick,10**xtick)
plt.show()
count 435.000000
mean 2.509603
std 5.200267
min 0.030000
25% 0.410000
50% 0.964000
75% 2.500000
max 77.700000
Name: pl_dens, dtype: float64
pl_dens pl_denserr1 pl_denserr2
pl_name
Kepler-51 b 0.03 0.02 -0.01
Kepler-131 c 77.70 55.00 -55.00
marker = ['o','v','^','x','s','*','+','D','p','d']
plt.axes(xlim=[0,360],ylim=[-90,90])
for d,m in zip(lis_discmet,marker):
plt.scatter(df.ra[df.pl_discmethod==d],df.dec[df.pl_discmethod==d],s=10,marker=m)
plt.legend(lis_discmet,loc=(0.02,1.01),ncol=2)
plt.grid(ls=':')
plt.tight_layout()
plt.show()
df_k = df[df.pl_kepflag==1]
plt.scatter(df_k.ra,df_k.dec,edgecolor='k',alpha=0.2)
df_k2 = df[df.pl_k2flag==1]
plt.scatter(df_k2.ra,df_k2.dec,edgecolor='k',alpha=0.2)
plt.legend(['Kepler','K2'])
plt.show()
df1 = df[df.pl_kepflag+df.pl_k2flag+(df.pl_discmethod=='Microlensing')==0]
plt.scatter(df1.ra,df1.dec,edgecolor='k',alpha=0.2)
plt.show()
x = np.cos(np.radians(df.dec))*np.cos(np.radians(df.ra))
y = np.cos(np.radians(df.dec))*np.sin(np.radians(df.ra))
z = np.sin(np.radians(df.dec))
plt.figure(figsize=[6,6])
ax = plt.axes([0,0,1,1],projection='3d',xlim=[-1,1],ylim=[-1,1],zlim=[-1,1])
c = (df.pl_discmethod=='Microlensing')*3+df.pl_kepflag+df.pl_k2flag*2
ax.scatter(x,y,z,c=c,edgecolor='k',cmap='rainbow')
plt.show()
df1 = df[df.st_dist>0].drop_duplicates('pl_hostname')
print(df1.st_dist.describe())
plt.hist(np.log10(df1.st_dist),80,ec='k')
plt.xlabel('ระยะห่าง (pc)',fontname='Tahoma')
xtick = np.arange(4.)
plt.xticks(xtick,10**xtick)
plt.show()
count 2930.000000
mean 658.883689
std 875.723167
min 1.290000
25% 171.000000
50% 499.000000
75% 872.000000
max 8500.000000
Name: st_dist, dtype: float64
x = np.cos(np.radians(df1.dec))*np.cos(np.radians(df1.ra))*df1.st_dist
y = np.cos(np.radians(df1.dec))*np.sin(np.radians(df1.ra))*df1.st_dist
z = np.sin(np.radians(df1.dec))*df1.st_dist
a,b,c = np.array([x.max()+x.min(),y.max()+y.min(),z.max()+z.min()])/2
m = max([x.max()-x.min(),y.max()-y.min(),z.max()-z.min()])/2
plt.figure(figsize=[6,6])
ax = plt.axes([0,0,1,1],projection='3d',xlim=[a-m,a+m],ylim=[b-m,b+m],zlim=[c-m,c+m])
c = df1.pl_discmethod=='Transit'
ax.scatter(x[c],y[c],z[c],c='b',edgecolor='k',cmap='rainbow',marker='o',alpha=0.5)
c = df1.pl_discmethod=='Radial Velocity'
ax.scatter(x[c],y[c],z[c],c='g',edgecolor='k',cmap='rainbow',marker='v',)
c = df1.pl_discmethod=='Microlensing'
ax.scatter(x[c],y[c],z[c],c='r',edgecolor='k',cmap='rainbow',marker='^')
c = (df1.pl_discmethod!='Transit')&\
(df1.pl_discmethod!='Radial Velocity')&\
(df1.pl_discmethod!='Microlensing')
ax.scatter(x[c],y[c],z[c],c='y',edgecolor='k',cmap='rainbow',marker='s')
plt.legend(['การเคลื่อนผ่าน','ความเร็วแนวเล็ง','ถ่ายภาพโดยตรง','อื่นๆ'],prop={'family':'Tahoma'})
plt.show()
df1 = df[df.st_optmag>0].drop_duplicates('pl_hostname')
print(df1.st_optmag.describe())
plt.hist(df1.st_optmag,80,ec='k')
plt.xlabel('โชติมาตรปรากฏ',fontname='Tahoma')
plt.show()
count 2789.000000
mean 12.694392
std 2.965030
min 0.850000
25% 11.472000
50% 13.659000
75% 14.935000
max 20.150000
Name: st_optmag, dtype: float64
st_optmag = df[df.st_optmag!=0].drop_duplicates('pl_hostname').set_index('pl_hostname').sort_values('st_optmag').st_optmag
print(st_optmag[st_optmag<3])
pl_hostname
alf Tau 0.85
HD 62509 1.14
Fomalhaut 1.16
gam 1 Leo 1.98
alf Ari 2.00
bet UMi 2.08
Name: st_optmag, dtype: float64
df1 = df[(df.st_dist>0)&(df.st_rad>0)&(df.st_optmag>0)].drop_duplicates('pl_hostname')
plt.scatter(df1.st_dist,df1.st_rad,c=df1.st_optmag,marker='.',cmap='hot_r',edgecolor='k',lw=0.5)
plt.xlabel('ระยะห่าง (pc)',fontname='Tahoma')
plt.ylabel('ขนาดดาวฤกษ์ ($R_S$)',fontname='Tahoma')
cb = plt.colorbar(pad=0.01)
cb.set_label(label='โชติมาตรปรากฏ',family='Tahoma')
plt.loglog()
plt.show()
df1 = df[(df.st_optmag>0)&(df.st_dist>0)].drop_duplicates('pl_hostname')
st_mag = df1.st_optmag+5-5*np.log10(df1.st_dist)
print(st_mag.describe())
plt.hist(st_mag,80,ec='k')
plt.xlabel('โชติมาตรสัมบูรณ์',fontname='Tahoma')
plt.show()
df1 = df[df.st_teff>0].drop_duplicates('pl_hostname').sort_values('st_teff',ascending=False)
print(df1.st_teff.describe())
count 2807.000000
mean 5504.664400
std 1442.050143
min 575.000000
25% 5073.000000
50% 5617.000000
75% 5943.000000
max 57000.000000
Name: st_teff, dtype: float64
df1 = df[df.st_teff>0].drop_duplicates('pl_hostname').sort_values('st_teff',ascending=False)
print(df1.st_teff.describe())
print(df1.set_index('pl_hostname')[:6][['st_teff','st_optmag','st_rad','st_mass']].replace(0,'-'))
plt.hist(df1.st_teff,100,ec='k')
plt.xlabel('อุณหภูมิยังผล (K)',fontname='Tahoma')
plt.semilogy()
plt.show()
print(df1.set_index('pl_hostname')[:6][['st_teff','st_optmag','st_rad','st_mass']].replace(0,'-'))
st_teff st_optmag st_rad st_mass
pl_hostname
NN Ser 57000.0 - - 0.54
V0391 Peg 29300.0 14.57 0.23 0.5
KOI-55 27730.0 14.87 0.2 0.5
KIC 10001893 27500.0 15.846 - -
kap And 10900.0 4.14 - 2.6
HIP 78530 10500.0 7.192 - 2.5
df1 = df[(df.st_teff>0)&(df.st_optmag>0)&(df.st_dist>0)].drop_duplicates('pl_hostname')
st_mag = df1.st_optmag+5-5*np.log10(df1.st_dist)
plt.scatter(df1.st_teff,st_mag,(20-st_mag)*5,c=df1.st_teff**0.25,marker='.',cmap='Spectral',edgecolor='k',lw=0.5)
plt.xlabel('อุณหภูมิยังผล (K)',fontname='Tahoma')
plt.ylabel('โชติมาตรสัมบูรณ์',fontname='Tahoma')
plt.xlim(df1.st_teff.max(),df1.st_teff.min())
plt.axes().invert_yaxis()
plt.show()
n_pl = np.bincount(df.drop_duplicates('pl_hostname').pl_pnum)[1:]
plt.bar(range(1,len(n_pl)+1),n_pl,color='#669955',ec='k')
for i,n in enumerate(n_pl,1):
plt.text(i,n,'%d'%n,ha='center',va='bottom')
plt.semilogy()
plt.tick_params(bottom=0)
plt.show()
print(df[df.pl_pnum>=7][['pl_facility','pl_radj','pl_orbper']].sort_index())
pl_facility pl_radj pl_orbper
pl_name
KOI-351 b Kepler 0.117 7.008151
KOI-351 c Kepler 0.106 8.719375
KOI-351 d Kepler 0.256 59.736670
KOI-351 e Kepler 0.237 91.939130
KOI-351 f Kepler 0.257 124.914400
KOI-351 g Kepler 0.723 210.606970
KOI-351 h Kepler 1.008 331.600590
KOI-351 i Kepler 0.118 14.449120
TRAPPIST-1 b La Silla Observatory 0.097 1.510871
TRAPPIST-1 c La Silla Observatory 0.094 2.421823
TRAPPIST-1 d La Silla Observatory 0.069 4.049610
TRAPPIST-1 e Multiple Observatories 0.082 6.099615
TRAPPIST-1 f Multiple Observatories 0.093 9.206690
TRAPPIST-1 g Multiple Observatories 0.101 12.352940
TRAPPIST-1 h Multiple Observatories 0.067 18.767000
df1 = df[df.pl_pnum>=5].drop_duplicates('pl_hostname').sort_values('pl_pnum',ascending=False)
df1['st_mag'] = df1.st_optmag+5-5*np.log10(df1.st_dist)
col = ['pl_pnum','st_teff','st_mag','st_rad','st_mass']
print(df1.set_index('pl_hostname')[col].replace(0,'-'))
pl_pnum st_teff st_mag st_rad st_mass
pl_hostname
KOI-351 8 6080.0 4.343527 1.2 1.2
TRAPPIST-1 7 2559.0 18.386073 0.12 0.08
HD 34445 6 5879.0 4.007141 1.38 1.14
Kepler-20 6 5495.0 5.198010 0.96 0.95
HD 219134 6 4699.0 6.488794 0.78 0.81
Kepler-11 6 5663.0 5.262698 1.06 0.96
HD 10180 6 5911.0 4.364564 1.11 1.06
Kepler-80 6 4540.0 7.040659 0.68 0.73
Kepler-102 5 4909.0 6.285037 0.76 0.81
Kepler-84 5 6031.0 4.625214 1.17 -
Kepler-238 5 5751.0 4.401983 1.43 -
Kepler-444 5 5046.0 6.116659 0.75 0.76
Kepler-296 5 3740.0 9.150458 0.48 0.5
Kepler-292 5 5299.0 5.847986 0.83 -
HIP 41378 5 6199.0 3.791010 1.4 1.15
Kepler-122 5 6050.0 4.367544 1.22 -
Kepler-55 5 4503.0 7.019258 0.62 -
Kepler-62 5 4925.0 5.895761 0.64 0.69
GJ 667 C 5 3350.0 11.057455 - 0.33
Kepler-186 5 3755.0 8.447358 0.52 0.54
Kepler-33 5 5904.0 3.755524 1.82 1.29
Kepler-32 5 3900.0 9.044787 0.53 0.58
Kepler-169 5 4997.0 6.006551 0.76 -
55 Cnc 5 5196.0 5.459871 0.94 0.91
Kepler-154 5 5690.0 4.874169 1 -
Kepler-150 5 5560.0 5.149601 0.94 -
HD 40307 5 4956.0 6.610329 - 0.77
K2-138 5 5378.0 5.897745 0.86 0.93
df1 = df[(df.st_teff>0)&(df.st_optmag>0)&(df.st_dist>0)].drop_duplicates('pl_hostname').sort_values('pl_pnum')
st_mag = df1.st_optmag+5-5*np.log10(df1.st_dist)
plt.scatter(df1.st_teff,st_mag,df1.pl_pnum*15,c=df1.pl_pnum,marker='.',cmap='jet',edgecolor='k',lw=0.5)
plt.xlabel('อุณหภูมิยังผล (K)',fontname='Tahoma')
plt.ylabel('โชติมาตร',fontname='Tahoma')
cb = plt.colorbar(pad=0.01)
cb.set_label(label='จำนวนดาวเคราะห์',family='Tahoma')
plt.show()
df1 = df[(df.st_rad>0)&(df.st_mass>0)].drop_duplicates('pl_hostname').sort_values('pl_pnum')
plt.scatter(df1.st_rad,df1.st_mass,df1.pl_pnum*15,c=df1.pl_pnum,marker='.',cmap='jet',edgecolor='k',lw=0.5)
plt.xlabel('ขนาดดาวหลัก ($R_S$)',fontname='Tahoma')
plt.ylabel('มวลดาวหลัก ($M_S$)',fontname='Tahoma')
cb = plt.colorbar(pad=0.01)
cb.set_label(label='จำนวนดาวเคราะห์',family='Tahoma')
plt.loglog()
plt.show()
f = lambda x: pd.Series({"ต่ำสุด":x[x>0].min(),
"เฉลี่ย":x[x>0].mean(),
"มัธยฐาน":x[x>0].median(),
"สูงสุด":x.max()})
col = ['pl_radj','pl_bmassj','pl_dens','pl_orbincl','pl_orbper','st_dist']
pl = df[col].apply(f).transpose()
pl.index = ['รัศมีดาวเคราะห์','มวลดาวเคราะห์*','ความหนาแน่นดาวเคราะห์','มุมเอียงวงโคจร','คาบวงโคจร','ระยะห่างดาวเคราะห์']
pl['หน่วย'] = ['R_J','M_J','g/cm^3','องศา','วัน','pc']
col = ['st_rad','st_mass','st_optmag','st_teff','st_dist']
st = df.drop_duplicates('pl_hostname')[col].apply(f).transpose()
st.index = ['รัศมีดาวหลัก','มวลดาวหลัก','โชติมาตรดาวหลัก','อุณหภูมิยังผลดาวหลัก','ระยะห่างดาวหลัก']
st['หน่วย'] = ['R_S','M_S','mag','K','pc']
print(pd.concat([pl,st]))
ต่ำสุด เฉลี่ย มัธยฐาน สูงสุด หน่วย
รัศมีดาวเคราะห์ 0.030000 0.370629 0.208000 6.90 R_J
มวลดาวเคราะห์* 0.000060 2.535104 0.915000 55.59 M_J
ความหนาแน่นดาวเคราะห์ 0.030000 2.509603 0.964000 77.70 g/cm^3
มุมเอียงวงโคจร 7.700000 86.100313 88.010000 90.76 องศา
คาบวงโคจร 0.090706 2357.470431 11.989985 7300000.00 วัน
ระยะห่างดาวเคราะห์ 1.290000 627.859352 492.000000 8500.00 pc
รัศมีดาวหลัก 0.040000 1.689048 0.990000 71.23 R_S
มวลดาวหลัก 0.010000 1.027626 0.980000 23.56 M_S
โชติมาตรดาวหลัก 0.850000 12.694392 13.659000 20.15 mag
อุณหภูมิยังผลดาวหลัก 575.000000 5504.664400 5617.000000 57000.00 K
ระยะห่างดาวหลัก 1.290000 658.883689 499.000000 8500.00 pc
ติดตามอัปเดตของบล็อกได้ที่แฟนเพจ