Planck Curve and Wein's Law
#Planck Curve with maximum wavelengths marked.
import numpy as np
import matplotlib.pyplot as plt
from astropy.modeling.models import BlackBody
from astropy import units as u
from astropy.visualization import quantity_support
bb = BlackBody(temperature=300*u.K)
bb2= BlackBody(temperature=1000*u.K)
bb3= BlackBody(temperature=3000*u.K)
bb4= BlackBody(temperature=6000*u.K)
bb5= BlackBody(temperature=10000*u.K)
wav = np.arange(100, 1100000) * u.nm
flux = bb(wav)
flux2 = bb2(wav)
flux3 = bb3(wav)
flux4 = bb4(wav)
flux5 = bb5(wav)
with quantity_support():
plt.figure()
plt.semilogx(wav, flux)
plt.semilogx(wav, flux2)
plt.semilogx(wav, flux3)
plt.semilogx(wav, flux4)
plt.semilogx(wav, flux5)
plt.axvline(bb.nu_max.to(u.nm, equivalencies=u.spectral()).value, ls='--')
plt.axvline(bb2.nu_max.to(u.nm, equivalencies=u.spectral()).value, ls='--')
plt.axvline(bb3.nu_max.to(u.nm, equivalencies=u.spectral()).value, ls='--')
plt.axvline(bb4.nu_max.to(u.nm, equivalencies=u.spectral()).value, ls='--')
plt.axvline(bb5.nu_max.to(u.nm, equivalencies=u.spectral()).value, ls='--')
ax.set_xscale('log')
ax.set_yscale('log')
Comments
Post a Comment