From fdee63edf3a4b975cab8b7f1067d49741df3ae59 Mon Sep 17 00:00:00 2001 From: James R T Date: Thu, 23 Apr 2020 14:04:43 +0000 Subject: [PATCH] Add comments --- hoa3/hoa3.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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")