Created
June 18, 2015 07:45
-
-
Save hakatashi/612e7cd167d2fd48a65a to your computer and use it in GitHub Desktop.
This file contains 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
# Simulate the solar irradiance from the earth | |
import numpy as np | |
from scipy.constants import * | |
# Prompt Solar Temperature (ideally around 5800K) | |
T = int(input('Temperature? ')) | |
# Constants | |
Rsun = 6.96e8 # Solar radius (m) | |
with open('solar.dat', 'w') as out: | |
# Loop wave length from 200nm to 2000nm for 1000 times | |
for wavelength in np.linspace(2e2, 2e3, num=1000): | |
# Normalize wave length(nm) to lambda(m) | |
lamb = wavelength * 1e-9 | |
# Radiance of the sun | |
radiance = (2 * pi * h * c ** 2) / (lamb ** 5) / (np.exp((h * c) / (k * T * lamb)) - 1) * 1e-9 | |
# Illuminance of the sun from the earth | |
illuminance = radiance * (Rsun / au) ** 2 | |
# Write out | |
out.write('%E %E\n' % (wavelength, illuminance)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment