How do I plot the dashed line in the image that represents the sun-earth distance correction trace? I can't seem to get the equation correct for the sun-earth distance correction. Thanks in advance for any advice.
Irradiance / Solar Constant vs Wavelength Plot
This is the code that I have for the original Irradiance / Solar Constant vs Wavelength Plot.
import matplotlib.pyplot as plt
import numpy as np
# Constants
wavelength_range = np.logspace(-1, 2, 1000) # Wavelength range from 0.1 nm to 100 nm
earth_sun_dis = 1.50e11
h = 6.626e-34
c = 2.9979e+8
k = 1.38e-23
def planck(wav, T):
a = 2.0*3.14*h*c**2
b = h*c/(wav*1e3*1e-9*k*T)
intensity = a/ ( ((wav*1e3*1e-9)**5) * (np.exp(b) - 1.0) )*1e-6
return intensity
Irradiance = 3.828e26 / 4*np.pi*(earth_sun_dis**2)
wavelengths = np.logspace(-2, 2, num=10000, endpoint=False)
intensity255 = planck(wavelengths, 255.)
intensity288 = planck(wavelengths, 288.)
intensity700 = planck(wavelengths, 700.)
intensity5800 = planck(wavelengths, 5800.)
# Calculate the corrected intensity for the Sun (5800 K) using the Sun-Earth distance
corrected_intensity5800 = intensity5800 / (4 * np.pi * earth_sun_dis**2)
plt.loglog(wavelengths, intensity255, 'k-', label='255 K')
plt.loglog(wavelengths, intensity288, 'r-', label='288 K')
plt.loglog(wavelengths, intensity700, 'y-', label='700 K')
plt.loglog(wavelengths, intensity5800, 'b-', label='5800 K')
# Set x-axis ticks and labels
plt.xscale('log') # Use a logarithmic scale for the x-axis
plt.xlim([0.1, 1e2]) # Set the x-axis range from 0.1 to 100
plt.xticks([0.1, 1.0, 10, 100], ['0.1', '1.0', '10', '100']) # Manually set tick locations and labels
plt.ylim([1,1e9])
# Set plot labels and title
plt.xlabel('Wavelength (nm)')
plt.ylabel('Black Body Irradiance (W/m^2 (nm))')
plt.title('Black Body Irradiance vs Wavelength')
plt.legend()
plt.show()