User:Just granpa/Scatchpad

import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import time import winsound

Density=np.zeros(7, dtype=np.float64) Volume=np.zeros(7, dtype=np.float64) TotalVolume=np.zeros(7, dtype=np.float64) Delta=np.zeros(7, dtype=np.float64) Mass=np.zeros(7, dtype=np.float64) TotalMass=np.zeros(7, dtype=np.float64) Radius=np.zeros(7, dtype=np.float64) Pressure=np.zeros(7, dtype=np.float64) Degeneracy_Pressure=np.zeros(7, dtype=np.float64) Ratio=np.zeros(7, dtype=np.float64) Count=np.zeros(7, dtype=np.float64) Finished=np.zeros(7, dtype=np.float64)

Density[0]=0           # Just to make some calculations prettier Density[1]=0.422       # methane Density[2]=1           # Water Density[3]=10          # metallic methane Density[4]=30          # metallic water Density[5]=3.34        # rock/iron Density[6]=290 # Metallic rock and iron

MassMetals=5           # earth masses of rock/iron

Volume[0]=0            # Volume[1]=0            # earth volumes of methane Volume[2]=50           # earth volumes of water Volume[3]=0            # earth volumes of metallic methane Volume[4]=0            # earth volumes of metallic water Volume[5]=0.5*MassMetals*(5.5/Density[5]) # earth volumes of degenerate rock/iron Volume[6]=0.5*MassMetals*(5.5/Density[6])

Delta[0]=0             # Delta[1]=10            # amount of methane Delta[2]=10            # amount of water Delta[3]=0             # amount of degenerate methane Delta[4]=0             # amount of degenerate water to add each time Delta[5]=0*(Delta[1]+Delta[2])*0.000225 # amount of degenerate rock/iron to add each time Delta[6]=0

Multiplier=0.5         # so you dont have to change all 5 each time.

Degeneracy_Pressure[1]=20000000                 # pressure at which methane becomes metallic Degeneracy_Pressure[2]=20000000                 # pressure at which water becomes metallic Degeneracy_Pressure[3]=0                        # pressure at which metallic methane becomes double degenerate Degeneracy_Pressure[4]=50*Degeneracy_Pressure[2] # pressure at which metallic water becomes double degenerate Degeneracy_Pressure[5]=11655000                 # Pressure at which rock becomes degenerate Degeneracy_Pressure[6]=0

def GI(InnerMass, OuterMass, InnerRadius, OuterRadius): return InnerMass/InnerRadius - InnerMass/OuterRadius - (0.5*OuterMass*InnerRadius*InnerRadius)/(OuterRadius**3) + 0.5*OuterMass/OuterRadius

Ratio[1]=Density[1]/Density[3] Ratio[2]=Density[2]/Density[4] Ratio[4]=Density[4]/Density[5] Ratio[5]=Density[5]/Density[6]

fig=plt.gcf fig.set_size_inches(14.4,                   9.6) plt.title('Exoplanet structure',         fontsize=16) plt.ylabel('Jupiter Radii',          color='#000000',           fontsize=16) plt.xlabel('Jupiter Masses',          color='#000000',           fontsize=16) plt.axis([0, 1, 0, 1]) plt.grid(which='major',        axis='both',         color='black',         linestyle='-') plt.minorticks_on plt.grid(which='minor',        axis='both',         color='#AAAAAA',         linestyle='dotted')

ax=plt.gca
 * 1) ax.set_xscale('log')
 * 2) ax.set_yscale('log')

plt.plot(0,        0,         marker='.',         color='#FF0000',         markerfacecolor='#FF0000',         markersize=1,         fillstyle='full')


 * 1) plt.gcf.set_facecolor('green')


 * 1) ax.set_facecolor('k')



StartTime=time.time Time=0

while Time < 230: Finished[1]=0 Finished[2]=0 Finished[3]=0 Finished[4]=0 Finished[5]=0 while Finished[1]==0 or Finished[2]==0 or Finished[4]==0 or Finished[5]==0: TotalVolume[1]=Volume[6]+Volume[5]+Volume[4]+Volume[3]+Volume[2]+Volume[1] TotalVolume[2]=Volume[6]+Volume[5]+Volume[4]+Volume[3]+Volume[2] TotalVolume[3]=Volume[6]+Volume[5]+Volume[4]+Volume[3] TotalVolume[4]=Volume[6]+Volume[5]+Volume[4] TotalVolume[5]=Volume[6]+Volume[5] TotalVolume[6]=Volume[6] Radius[1]=(TotalVolume[1])**0.333333   # earth radii Radius[2]=(TotalVolume[2])**0.333333 Radius[3]=(TotalVolume[3])**0.333333 Radius[4]=(TotalVolume[4])**0.333333 Radius[5]=(TotalVolume[5])**0.333333 Radius[6]=(TotalVolume[6])**0.333333 Mass[1]=0.181323*(Density[1]-Density[0])*(TotalVolume[1]) # earth masses Mass[2]=0.181323*(Density[2]-Density[1])*(TotalVolume[2]) Mass[3]=0.181323*(Density[3]-Density[2])*(TotalVolume[3]) Mass[4]=0.181323*(Density[4]-Density[3])*(TotalVolume[4]) Mass[5]=0.181323*(Density[5]-Density[4])*(TotalVolume[5]) Mass[6]=0.181323*(Density[6]-Density[5])*(TotalVolume[6]) TotalMass[1]=Mass[6]+Mass[5]+Mass[4]+Mass[3]+Mass[2]+Mass[1] TotalMass[2]=Mass[6]+Mass[5]+Mass[4]+Mass[3]+Mass[2] TotalMass[3]=Mass[6]+Mass[5]+Mass[4]+Mass[3] TotalMass[4]=Mass[6]+Mass[5]+Mass[4] TotalMass[5]=Mass[6]+Mass[5] TotalMass[6]=Mass[6] if Volume[1]>0: Pressure[1]=625478*Density[1]*GI(TotalMass[1],0.181323*Volume[1]*Density[1],Radius[2],Radius[1]) else: Pressure[1]=0 if Volume[2]>0: Pressure[2]=625478*Density[2]*GI(TotalMass[2],0.181323*Volume[2]*Density[2],Radius[3],Radius[2]) else: Pressure[2]=0 if Volume[3]>0: Pressure[3]=625478*Density[3]*GI(TotalMass[3],0.181323*Volume[3]*Density[3],Radius[4],Radius[3]) else: Pressure[3]=0 if Volume[4]>0: Pressure[4]=625478*Density[4]*GI(TotalMass[4],0.181323*Volume[4]*Density[4],Radius[5],Radius[4]) else: Pressure[4]=0 if Volume[5]>0: Pressure[5]=625478*Density[5]*GI(TotalMass[5],0.181323*Volume[5]*Density[5],Radius[6],Radius[5]) else: Pressure[5]=0 if Volume[1]>0 and Pressure[1]>Degeneracy_Pressure[1]: #Methane becomes metallic Count[1]+=1 Volume[1]=Volume[1]-(0.1*Multiplier*Delta[1]) Volume[3]=Volume[3]+(0.1*Multiplier*Delta[1]*Ratio[1]) Finished[1]=0 #Finished[3]=0 else: Finished[1]=1 if Volume[2]>0 and Pressure[1]+Pressure[2] > Degeneracy_Pressure[2]: #Water becomes metallic Count[2]+=1 Volume[2]=Volume[2]-(0.1*Multiplier*Delta[2]) Volume[4]=Volume[4]+(0.1*Multiplier*Delta[2]*Ratio[2]) Finished[2]=0 Finished[4]=0 else: Finished[2]=1 if Volume[4]>0 and Pressure[1]+Pressure[2]+Pressure[3]+Pressure[4] > Degeneracy_Pressure[4]: # metallic water degenerates Count[4]+=1 Volume[4]=Volume[4]-(0.01*Multiplier*Delta[2]*Ratio[2]) Volume[5]=Volume[5]+(0.01*Multiplier*Delta[2]*Ratio[2]*Ratio[4]) Finished[4]=0 Finished[5]=0 else: Finished[4]=1 if Volume[5]>0 and Pressure[1]+Pressure[2]+Pressure[3]+Pressure[4]+Pressure[5] > Degeneracy_Pressure[5]: # rock becomes metallic Count[5]+=1 Volume[5]=Volume[5]-(0.001*Multiplier*Delta[2]*Ratio[2]*Ratio[4]) Volume[6]=Volume[6]+(0.001*Multiplier*Delta[2]*Ratio[2]*Ratio[4]*Ratio[5]) Finished[5]=0 #Finished[6]=0 else: Finished[5]=1 TotalMass=(Mass[1]+Mass[2]+Mass[3]+Mass[4]+Mass[5])/317 plt.plot(TotalMass,                Radius[1]/11.2,                 marker='.',                 color='#FF00FF',                 markerfacecolor='#FF00FF',                 markersize=8,                 fillstyle='full') plt.plot(TotalMass,                Radius[2]/11.2,                 marker='.',                 color='#0000FF',                 markerfacecolor='#0000FF',                 markersize=8,                 fillstyle='full') plt.plot(TotalMass,                Radius[3]/11.2,                 marker='.',                 color='#FF00FF',                 markerfacecolor='#FF00FF',                 markersize=8,                 fillstyle='full') plt.plot(TotalMass,                Radius[4]/11.2,                 marker='.',                 color='#0000FF',                 markerfacecolor='#0000FF',                 markersize=8,                 fillstyle='full') plt.plot(TotalMass,                Radius[5]/11.2,                 marker='.',                 color='#00FF00',                 markerfacecolor='#00FF00',                 markersize=8,                 fillstyle='full') Time+=+1 Volume[1]=Volume[1]+Delta[1]*Multiplier Volume[2]=Volume[2]+Delta[2]*Multiplier Volume[3]=Volume[3]+Delta[3]*Multiplier Volume[4]=Volume[4]+Delta[4]*Multiplier Volume[5]=Volume[5]+Delta[5]*Multiplier

import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import winsound

np.set_printoptions(threshold=np.nan) pd.options.display.max_seq_items = 320

str1=['A', 'AUPPER', 'ALOWER', 'UA', 'AREF', 'AURL', 'AR', 'ARUPPER', 'ARLOWER', 'UAR', 'ARREF', 'ARURL', 'ASTROMETRY', 'B', 'BUPPER', 'BLOWER', 'UB', 'BREF', 'BURL', 'BIGOM', 'BIGOMUPPER', 'BIGOMLOWER', 'UBIGOM', 'BIGOMREF', 'BIGOMURL', 'BINARY', 'BINARYREF', 'BINARYURL', 'BMV', 'CHI2', 'COMP', 'DATE', 'DEC', 'DEC_STRING', 'DENSITY', 'DENSITYUPPER', 'DENSITYLOWER', 'UDENSITY', 'DENSITYREF', 'DENSITYURL', 'DEPTH', 'DEPTHUPPER', 'DEPTHLOWER', 'UDEPTH', 'DEPTHREF', 'DEPTHURL', 'DIST', 'DISTUPPER', 'DISTLOWER', 'UDIST', 'DISTREF', 'DISTURL', 'DR', 'DRUPPER', 'DRLOWER', 'UDR', 'DRREF', 'DRURL', 'DVDT', 'DVDTUPPER', 'DVDTLOWER', 'UDVDT', 'DVDTREF', 'DVDTURL', 'EANAME', 'EAURL', 'ECC', 'ECCUPPER', 'ECCLOWER', 'UECC', 'ECCREF', 'ECCURL', 'EOD', 'ETDNAME', 'ETDURL', 'FE', 'FEUPPER', 'FELOWER', 'UFE', 'FEREF', 'FEURL', 'FIRSTREF', 'FIRSTURL', 'FREEZE_ECC', 'GAMMA', 'GAMMAUPPER', 'GAMMALOWER', 'UGAMMA', 'GAMMAREF', 'GAMMAURL', 'GL', 'GRAVITY', 'GRAVITYUPPER', 'GRAVITYLOWER', 'UGRAVITY', 'GRAVITYREF', 'GRAVITYURL', 'H', 'HD', 'HIPP', 'HR', 'I', 'IUPPER', 'ILOWER', 'UI', 'IREF', 'IURL', 'IMAGING', 'J', 'JSNAME', 'EPEURL', 'K', 'KUPPER', 'KLOWER', 'UK', 'KREF', 'KURL', 'KOI', 'KS', 'KP', 'LAMBDA', 'LAMBDAUPPER', 'LAMBDALOWER', 'ULAMBDA', 'LAMBDAREF', 'LAMBDAURL', 'LOGG', 'LOGGUPPER', 'LOGGLOWER', 'ULOGG', 'LOGGREF', 'LOGGURL', 'MASS', 'MASSUPPER', 'MASSLOWER', 'UMASS', 'MASSREF', 'MASSURL', 'MICROLENSING', 'MSINI', 'MSINIUPPER', 'MSINILOWER', 'UMSINI', 'MSINIREF', 'MSINIURL', 'MSTAR', 'MSTARUPPER', 'MSTARLOWER', 'UMSTAR', 'MSTARREF', 'MSTARURL', 'MULT', 'NAME', 'NCOMP', 'NOBS', 'OM', 'OMUPPER', 'OMLOWER', 'UOM', 'OMREF', 'OMURL', 'ORBREF', 'ORBURL', 'OTHERNAME', 'PAR', 'PARUPPER', 'PARLOWER', 'UPAR', 'PER', 'PERUPPER', 'PERLOWER', 'UPER', 'PERREF', 'PERURL', 'PLANETDISCMETH', 'R', 'RUPPER', 'RLOWER', 'UR', 'RREF', 'RURL', 'RA', 'RA_STRING', 'RHK', 'RHOSTAR', 'RHOSTARUPPER', 'RHOSTARLOWER', 'URHOSTAR', 'RHOSTARREF', 'RHOSTARURL', 'RMS', 'RR', 'RRUPPER', 'RRLOWER', 'URR', 'RRREF', 'RRURL', 'RSTAR', 'RSTARUPPER', 'RSTARLOWER', 'URSTAR', 'RSTARREF', 'RSTARURL', 'SAO', 'SE', 'SEREF', 'SEURL', 'SEDEPTHJ', 'SEDEPTHJUPPER', 'SEDEPTHJLOWER', 'USEDEPTHJ', 'SEDEPTHJREF', 'SEDEPTHJURL', 'SEDEPTHH', 'SEDEPTHHUPPER', 'SEDEPTHHLOWER', 'USEDEPTHH', 'SEDEPTHHREF', 'SEDEPTHHURL', 'SEDEPTHKS', 'SEDEPTHKSUPPER', 'SEDEPTHKSLOWER', 'USEDEPTHKS', 'SEDEPTHKSREF', 'SEDEPTHKSURL', 'SEDEPTHKP', 'SEDEPTHKPUPPER', 'SEDEPTHKPLOWER', 'USEDEPTHKP', 'SEDEPTHKPREF', 'SEDEPTHKPURL', 'SEDEPTH36', 'SEDEPTH36UPPER', 'SEDEPTH36LOWER', 'USEDEPTH36', 'SEDEPTH36REF', 'SEDEPTH36URL', 'SEDEPTH45', 'SEDEPTH45UPPER', 'SEDEPTH45LOWER', 'USEDEPTH45', 'SEDEPTH45REF', 'SEDEPTH45URL', 'SEDEPTH58', 'SEDEPTH58UPPER', 'SEDEPTH58LOWER', 'USEDEPTH58', 'SEDEPTH58REF', 'SEDEPTH58URL', 'SEDEPTH80', 'SEDEPTH80UPPER', 'SEDEPTH80LOWER', 'USEDEPTH80', 'SEDEPTH80REF', 'SEDEPTH80URL', 'SEP', 'SEPUPPER', 'SEPLOWER', 'USEP', 'SEPREF', 'SEPURL', 'SET', 'SETUPPER', 'SETLOWER', 'USET', 'SETREF', 'SETURL', 'SHK', 'SIMBADNAME', 'SIMBADURL', 'SPECREF', 'SPECURL', 'STAR', 'STARDISCMETH', 'T0', 'T0UPPER', 'T0LOWER', 'UT0', 'T0REF', 'T0URL', 'T14', 'T14UPPER', 'T14LOWER', 'UT14', 'T14REF', 'T14URL', 'TEFF', 'TEFFUPPER', 'TEFFLOWER', 'UTEFF', 'TEFFREF', 'TEFFURL', 'TIMING', 'TRANSIT', 'TRANSITREF', 'TRANSITURL', 'TREND', 'TT', 'TTUPPER', 'TTLOWER', 'UTT', 'TTREF', 'TTURL', 'V', 'VREF', 'VURL', 'VSINI', 'VSINIUPPER', 'VSINILOWER', 'UVSINI', 'VSINIREF', 'VSINIURL', 'KEPID', 'KDE'] # Columns (4,5,10,11,17,18,23,24,26,27,30,33,38,39,44,45,50,51,56,57,62,63,70,71,73,74,79,80,81,82,88,89,95,96,105,106,109,110,115,116,124,125,130,131,137,143,144,149,150,159,160,161,162,172,173,174,179,180,182,188,189,195,196,201,202,205,206,211,212,217,218,223,224,229,230,235,236,241,242,247,248,253,254,259,260,265,266,268,269,270,271,273,278,279,284,285,290,291,294,295,301,302,304,305,310,311) have mixed types.

data=pd.read_csv('exoplanets.csv',                low_memory='False')

a=np.ones(500) # array of 5 floats radius_list=np.ndarray.tolist(a)

for count in range(500): radius_list[count]=count*(0.1) density_list = 100*np.ones(500)


 * 1) marker_edge_color = 'b'
 * 2) marker_style = dict(linestyle='.', color='b', markersize=2)

count=0 mark_color=['#000000','#000000','#000000','#000000','#000000','#000000','#000000','#000000'] for x in range(0,len(data),1): if data.loc[x,'TRANSIT']==1 and data.loc[x,'EOD']==1: mass=data.loc[x,'MASS'] radius=data.loc[x,'R'] if (mass>0) and (radius>0): type=0 count+=1 plt.plot(mass,                    radius,                     marker='.',                     color=mark_color[type],                     markerfacecolor='#000000',                     markersize=2,                     fillstyle='full') print ("Loop finished") print (count)

data = [ [0.0248,0.4125], # Ganymede [0.0225,0.4],   # Titan [0.0123,0.2724], # Moon [0.05527,0.38294], [0.815,0.94885], [1,1], [0.107447,0.532], [317.83,11.21], [95.1608,9.14], [14.5357,3.9808], [17.1478,3.8647]] # mass, radius

for x in range(0,len(data),1): mass = data[x][0] radius = data[x][1] if (mass>0) and (radius>0): plt.plot(mass/317.8,                radius/11.2,                 marker='.',                 color='#FF0000',                 markerfacecolor='#FF0000',                 markersize=8,                 fillstyle='full')

data = [      # mass, radius [1.23,1.715], # on hydrogen line [0.919,1.799], [1.39,1.9],   # on hydrogen line ]
 * 1) Puffy hot jupiters:
 * 1) [0.433,1.478],
 * 2) [0.529,1.319],
 * 1) [0.486,1.991] # least dense 0.08

for x in range(0,len(data),1): mass = data[x][0] radius = data[x][1] if (mass>0) and (radius>0): plt.plot(mass,                radius,                 marker='.',                 color='#FF0000',                 markerfacecolor='#FF0000',                 markersize=8,                 fillstyle='full')


 * 1) plt.text(15,0.085,"exoplanets.org", fontsize=12, )

print (Volume[2])

plt.savefig('Exoplanet.Structure.Methane.Water.png',           dpi=100) # must come before the show command. Width in pixels = dpi * 6.4

duration = 1000 # milliseconds freq = 440 # hz winsound.Beep(freq,duration)

plt.show