.
<span xmlns:dct="http://purl.org/dc/terms/" property="dct:title"></span> The following notes written by <span xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName">Sergio Gutiérrez Rodrigo (sergut@unizar.es) </span>. Distributed under License Creative Commons Atribución-NoComercial-CompartirIgual 4.0 Internacional
Departamento de Física Aplicada
Universidad de Zaragoza
Instituto de Nanociencia y Materiales de Aragón (INMA)
C/ Pedro Cerbuna, 12, 50009, Zaragoza, España
import numpy as np
import matplotlib.pyplot as plt
# Constants
kB = 1.380649e-23 # Boltzmann constant in J/K
T_room = 298.15 # Room temperature in Kelvin
h = 6.62607015e-34 # Planck constant in J·s
# Function to calculate kB*T
def calculate_kBT(temperature):
return kB * temperature
# Function to calculate h*nu
def calculate_hnu(frequency):
return h * frequency
# Function to calculate N1/N2
def N1overN2(frequency,g1,g2,T):
beta=1.0/(kB*T)
return (g1/g2)*np.exp(beta*h*frequency)
# Frequency range from microwave to visible
microwave_freq = np.linspace(1e9, 1e13, 100) # 1 GHz to 1 THz
visible_freq = np.linspace(4e14, 7.5e14, 100) # 400 THz to 750 THz
# Calculate energies
microwave_energy = calculate_hnu(microwave_freq)
visible_energy = calculate_hnu(visible_freq)
# Create the plot Energy vs Frequency
plt.figure(figsize=(10, 6))
plt.semilogx(microwave_freq, microwave_energy, label='Microwave Range', color='blue')
plt.semilogx(visible_freq, visible_energy, label='Visible Range', color='red')
plt.axhline(calculate_kBT(T_room),color='green',label=r'$k_BT$ (T=room temperature)')
plt.axvline(2.4*1e9,label='2.4 GHz microwave oven/phone',linestyle='--',color='grey')
plt.xlabel('Frequency (Hz)')
plt.ylabel('Energy (Joules)')
#plt.title('Energy vs. Frequency')
plt.yscale('log') # Use a logarithmic scale for y-axis
plt.legend()
plt.grid(True)
#plt.xlim(1.0e9,1.0e12)
# Show the visible and microwave range labels
plt.annotate('Microwave Range', xy=(1.5e11, 1e-27), color='blue')
plt.annotate('Visible Range', xy=(5e14, 1e-27), color='red')
plt.show()
#Calculate N1/N2
N1oN2=N1overN2(visible_freq,1,1,T_room)
# Create the plot N1/N2
plt.figure(figsize=(10, 6))
plt.semilogx(visible_freq, N1oN2, label='N1/N2', color='red')
plt.xlabel('Frequency (Hz)')
plt.ylabel('N1/N2')
plt.title('N1/N2 as a function of the transition frequency '+ r'$\nu$ ($\Delta E=h\nu$)')
plt.yscale('log') # Use a logarithmic scale for y-axis
plt.legend()
plt.grid(True)
#plt.xlim(1.0e9,1.0e12)
# Show the visible and microwave range labels
plt.show()