#-------------------------------------------------- # #Description: # This script plots processed exoplanet data tables produced # by ProcessExoplanets.py. The 2010 version of the data # is already located in the dataset directory, and this script # is set up to use that. (The figures in Chapter 1 of Principles # of Planetary Climate were done using 2006 data). # #A note on units in the data file: # -- Masses are given in Jupiter masses # -- Distances are given in AU from ClimateUtilities import * #Path to Workbook datasets datapath = '/Users/rtp1/Havsornen/PlanetaryClimateBook/WorkbookDatasets/' #Tack on the directory path #Edit this according to where you put the processed data produced #by ProcessExoplanets.py, if you're not using the ready-made #2010 version of the processed data exoplanetFile = datapath+'Chapter1Data/exoplanets/'+'exoplanets2010Processed.txt' #Note that this file does not contain the names of the planets or their stars. #To get that, you should look at the original files stars2010.txt and planets2010.txt #Read in the data c = readTable(exoplanetFile) #Take a look at what's there print c.listVariables() # #The usual parameters are: # mPlanet Mass of planet in Jupiter masses # rsm semi-major axis of the orbit, in AU # ecc Orbital eccentricity # PeriApRat Ratio of Periastron distance to Apastron distance # yearLength Length of year (in Earth days) # Luminosity Stellar luminosity (relative to the present Sun) # PeriSolarConstant Stellar constant at periastron (relative to Earth) # ApSolarConstant Stellar constant at apastron (relative to Earth) # SMSolarConstant Stellar constant at distance equal to semi-major axis # (approximately equal to annual mean), relative to Earth # TStar Photospheric temperature of the star (Kelvins) # #Make a scatter plot. Scatter plots like those #in the exoplanets section of Chapter 1 can be done #similarly #Here's an example of a scatter plot of the perihelion #stellar constant vs the planet mass (in Jupiter masses) #You'll note an outlier in there with a ridiculous stellar #constant (about 10**9 the Sun). That's an error in the exoplanets.org #table. I left it in because some of the other data for that star is OK. #Hopefully the error will be corrected in some future version of the table c1 = c.extract(['mPlanet','PeriSolarConstant']) c1.scatter['PeriSolarConstant'] = True #Don't draw lines c1.YlogAxis = True #Use a log axis c1.XlogAxis = True #Use a log axis c1.Ylabel = 'Peri Stellar Constant, W/m**2' c1.Xlabel = 'Mass (in Jupiter masses)' plot(c1) #This shows an example of using the data to do a calculation. Here #we compute the no-atmosphere isothermal blackbody temperature of the #planet. The physics needed to do this #is explained in Chapter 3. TbbEarth = 255. Tbb = c['SMSolarConstant']**.25 * TbbEarth c2 = Curve() c2.addCurve(c['TStar'],'TStar') c2.addCurve(Tbb,'BlackbodyTemp') c2.scatter['BlackbodyTemp'] = True c2.Xlabel = 'Stellar Temperature' c2.Ylabel = 'Blackbody Temperature of Planet' plot(c2) #You'll see that because of the bad solar constant in one entry #(it's one of the OGLE stars), the good data is all squished up near #the bottom. Let's do the plot again, putting in a zero for any #temperature that exceeds 10000K. That at least makes the plot readable c2['BlackbodyTemp'] = numpy.where(Tbb > 10000., 0.,Tbb) plot(c2)