Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestiotio authored Apr 23, 2020
1 parent 61d2c1a commit fdee63e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions hoa3/hoa3.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -8,6 +9,7 @@
from sklearn import metrics


# Define inverse-square law function
def inverse_square(h, k):
return k / (h ** 2)

Expand All @@ -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")
Expand Down

0 comments on commit fdee63e

Please sign in to comment.