Upload your edited notebook to connect before 10am Wednesday

Recall the Planck function from the Stefan-Boltzman notebook:

$E_\lambda* =\pi \frac{2 hc^2}{\lambda^5}\frac{1}{ e^{\frac{hc}{\lambda kT}}-1}$

where

$h$=Planck's constant ($6.63 \times 10^{-34}$ Joule seconds})

$c$= Speed of light in a vacuum ($3.00 \times 10^{8}\ \mathrm{meters/second}$)

$k_b$ =Boltzman's constant ($1.38 \times 10^{-23}\ \mathrm{Joules/Kelvin}$)

With this Python function that returns $E_\lambda^*$ given $\lambda$ and temperature:


In [0]:
import numpy as np
c=2.99792458e+08  #m/s -- speed of light in vacumn
h=6.62606876e-34  #J s  -- Planck's constant
kb=1.3806503e-23  # J/K  -- Boltzman's constant
c1=2.*h*c**2.
c2=h*c/kb

def planckwavelen(wavel,Temp):
    """input wavelength in microns and Temp in K, output
    bbr in W/m^2/micron
    """
    wavel=wavel*1.e-6  #convert to meters
    Elambda=1.e-6*np.pi*c1/(wavel**5.*(np.exp(c2/(wavel*Temp)) - 1))
    return Elambda

In the cell below, write a new function, called planckInvert, that takes (wavel,Elambda) and returns a temperature. That is, use algebra to turn planckwavelen inside out so it returns the temperature that a blackbody must have to emit flux Elambda


In [0]:
def planckInvert(wavel,Elambda):
    """input wavelength in microns and Elambda in W/m^2/micron, output
    output brightness temperature in K
    """
    Elambda=Elambda*1.e6  #convert to W/m^2/m
    wavel=wavel*1.e-6  #convert wavelength to m
    Tbright=c2/(wavel*np.log(np.pi*c1/(wavel**5.*Elambda) + 1.))
    return Tbright

show that planckInvert is correct by doing a "round trip" test. That is, in the cell below, find Elambda=planckInvert(wavel,Temp) for Temp=300 K and wavel=10 microns. Then print planckInvert(wavel,Elambda) and show that it gives 300 K.


In [0]:
the_flux=planckwavelen(10.,300.)
Tbright=planckInvert(10.,the_flux)
print Tbright