diff --git a/hoa3/hoa3.py b/hoa3/hoa3.py index ab6747c..e57455f 100644 --- a/hoa3/hoa3.py +++ b/hoa3/hoa3.py @@ -1,5 +1,6 @@ # 10.008 Hands-on Activity 3 Verifier Script -# Check validity of relationship between intensity and height +# Check validity of inverse-square relationship between intensity and height +# Also check validity of black-body radiation relationship between spectral irradiance and wavelength # Created by James Raphael Tiovalen (2020) # Import scientific libraries @@ -8,6 +9,7 @@ from sklearn import metrics +# Define inverse-square law function def inverse_square(h, k): return k / (h ** 2) @@ -17,13 +19,13 @@ def inverse_square(h, k): red_intensities = np.array( [0.8319219036, 0.4896690263, 0.249988924, 0.1288602701] - ).astype(np.float64) + ).astype(np.float64) # λ = 633 nm green_intensities = np.array( [0.410783097, 0.2675019527, 0.1692426359, 0.0913581608] - ).astype(np.float64) + ).astype(np.float64) # λ = 524 nm blue_intensities = np.array( [1.002523336, 0.5135877745, 0.398544113, 0.1931090032] - ).astype(np.float64) + ).astype(np.float64) # λ = 460 nm for intensity in [red_intensities, green_intensities, blue_intensities]: popt, pcov = curve_fit(inverse_square, heights, intensity, method="lm")