Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # ATSC 5003 - Radiation HW 3
- import numpy as np
- import matplotlib.pyplot as plt
- from matplotlib import ticker
- plt.close('all')
- fig1 = plt.figure(figsize=(11, 8.5))
- ax1 = fig1.add_subplot(211)
- # Approximate surface temperatures of bodies [K]
- temp_earth = 288
- temp_sun = 5800
- # Define constants
- pi = np.pi
- c = 299792458.0 # speed of light [m/s]
- h = 6.62606896e-34 # Planck constant [J*s]
- k = 1.3806504e-23 # Boltzmann constant [J/K]
- eV = 1.602e-19 # 1 eV in [J]
- wavelength = np.linspace(7.4e-8, 1e-3, 40000) # [m]
- # Planck's function in wavelength domain (in spectral density form)
- def Plancks_wavelength(wavelength, temperature):
- return (8 * pi * h * c) / (wavelength**5 * (np.exp((h * c)/ (k * temperature * wavelength))-1))
- # Plotting as *irradiance* --hence the c/4 normalization, at the top of the atmosphere
- ax1.plot(wavelength*1e6, Plancks_wavelength(wavelength, temp_earth)*(6371e3/(6371e3+150e3))**2*c/4, 'k--', lw=2)
- ax1.plot(wavelength*1e6, Plancks_wavelength(wavelength, temp_sun)*(6.96e8/1.496e11)**2*c/4, 'k-.', lw=2)
- ax1.set_yscale('log')
- ax1.set_xscale('log')
- ax1.set_ylim(ymin=1e1, ymax=1e10)
- ax1.set_xlim(xmin=1e-7, xmax=1e10)
- xmin, xmax = ax1.xaxis.get_view_interval()
- #ax1.xaxis.set_ticks(10.**np.arange(np.log10(xmin),np.log10(xmax)+1,1))
- ax1.xaxis.set_minor_locator(ticker.LogLocator(subs=np.arange(2.0, 10.0)))
- ax1.yaxis.set_minor_locator(ticker.LogLocator(subs=np.arange(2.0, 10.0)))
- ax1.xaxis.set_label_text(u"Wavelength, μm", fontsize=16)
- ax1.yaxis.set_label_text(u"Irradiance, W / m²·m", fontsize=16)
- plt.tight_layout()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement