diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-07-04 10:18:49 -0400 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-07-04 10:18:49 -0400 |
commit | b95a75401fbcf35dd9bcc0d28772f1c38e0db09d (patch) | |
tree | 195dbf447b4f9c036670ed9304198afd13eca33f | |
parent | 1e4f308170ea65a20d8953356dfdc95252e70311 (diff) | |
download | sddm-b95a75401fbcf35dd9bcc0d28772f1c38e0db09d.tar.gz sddm-b95a75401fbcf35dd9bcc0d28772f1c38e0db09d.tar.bz2 sddm-b95a75401fbcf35dd9bcc0d28772f1c38e0db09d.zip |
initial commit of a script to calculate the index of refraction of water
-rw-r--r-- | index.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/index.py b/index.py new file mode 100644 index 0000000..7c1b6a1 --- /dev/null +++ b/index.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +""" +This is a script to calculate the index of refraction of water as a function of +wavelength, temperature, and pressure and fit it to a linear approximation in a +wavelength region where the PMTs are sensitive to. The data comes from [1]. + +[1] "Refractive index of Water and Steam as Function of Wavelength, Temperature, and Density". Schiebener et al. 1989. +""" +from __future__ import print_function, division +import numpy as np +import matplotlib.pyplot as plt + +A0 = 0.243905091 +A1 = 9.53518094e-3 +A2 = -3.64358110e-3 +A3 = 2.65666426e-4 +A4 = 1.59189325e-3 +A5 = 2.45733798e-3 +A6 = 0.897478251 +A7 = -1.63066183e-2 +UV = 0.2292020 +IR = 5.432937 + +def get_index(p, wavelength, T): + """ + Returns the index of pure water for a given density, wavelength, and + temperature. The density should be in units of kg/m^3, the wavelength in nm, + and the temperature in Celsius. + """ + # normalize the density, temperature, and pressure + p = p/1000.0 + wavelength = wavelength/589.0 + T = (T+273.15)/273.15 + + # first we compute the right hand side of Equation 7 + c = A0 + A1*p + A2*T + A3*wavelength**2*T + A4/wavelength**2 + A5/(wavelength**2-UV**2) + A6/(wavelength**2-IR**2) + A7*p**2 + c *= p + + return np.sqrt((2*c+1)/(1-c)) + +if __name__ == '__main__': + import matplotlib.pyplot as plt + + x = np.linspace(300,500,1000) + plt.plot(x,get_index(1000,x,10)) + plt.xlabel("Wavelength (nm)") + plt.ylabel("Index of Refraction") + plt.title("Index of Refraction of Water at 273.15 K") + plt.show() |