Created
October 22, 2017 18:26
-
-
Save santiago-salas-v/c64115ca6ff5f7f5a378858a355b0c97 to your computer and use it in GitHub Desktop.
Spektrales Emissionsvermögen des schwarzen Körpers. Abb. 1.4-7 Wedler, Physikalische Chemie
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
# rho = 8 pi hc/(lambda^5 *(exp(hc/(lambda k T)))-1) | |
# x = lambda k T /(h c) | |
# T = x *(h c)/(lambda k) | |
# rho = 8 pi hc/((h c)^5/(k T)^5 * x^5 *(exp(x)-1) | |
# rho = (8 pi (k T)^5/(h c)^4)/ (x^5 *(exp(x)-1)) | |
title_text = 'Black Body Radiation' | |
n_temps = 10 | |
pi = np.pi | |
temperatures = np.linspace(800, 0.1, n_temps) | |
rho = np.vectorize( | |
lambda w_length, t: 8 * pi * (6.626 * 10**-34) * (3 * 10**8) / ( | |
w_length**5 * ( | |
np.exp( | |
(6.626 * 10**-34) * (3 * 10**8) / (w_length * 1.381 * 10**-23 * t) | |
) - 1 | |
) | |
) | |
) | |
fig, ax = plt.subplots() | |
line1 = ax.plot() | |
x_max_min = [1e-16, 3 * 10**-5] | |
y_max_min = [0, 2 * 10**-3] | |
x_range = np.linspace(x_max_min[0], x_max_min[1], 200) | |
max_line_x = [] | |
max_line_y = [] | |
for temp in temperatures: | |
line1, = ax.plot( | |
x_range, rho(x_range, temp) | |
) | |
line1_y = line1.get_ydata() | |
line1_x = line1.get_xdata() | |
x_coord = line1_x[np.argmax(line1_y)] | |
y_coord = max(line1_y) | |
max_line_x.append(x_coord) | |
max_line_y.append(y_coord) | |
ax.annotate( | |
str(temp), | |
xy=(x_coord, y_coord), | |
xytext=(x_coord, y_coord) | |
) | |
ax.plot(max_line_x, max_line_y, '-.', color='black') | |
ax.set_title('') | |
ax.set_xlabel(r'$\lambda, m$') | |
ax.set_ylabel(r'$\rho, J m^{-4}$') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment