summaryrefslogtreecommitdiff
path: root/optics.py
diff options
context:
space:
mode:
authorAnthony LaTorre <tlatorre9@gmail.com>2011-07-10 03:15:17 -0400
committerAnthony LaTorre <tlatorre9@gmail.com>2011-07-10 03:15:17 -0400
commit842e3a9dfecdd6411b1f27084ab6dcbe92fa32b9 (patch)
treeeacf1304096bfb1d7c6597147bd1479ba84ba2e8 /optics.py
parentaa0f12c8b6c6d4e0858d46eba5499d9682ecbe9d (diff)
downloadchroma-842e3a9dfecdd6411b1f27084ab6dcbe92fa32b9.tar.gz
chroma-842e3a9dfecdd6411b1f27084ab6dcbe92fa32b9.tar.bz2
chroma-842e3a9dfecdd6411b1f27084ab6dcbe92fa32b9.zip
added a hybrid monte carlo ray tracing rendering algorithm
Diffstat (limited to 'optics.py')
-rw-r--r--optics.py148
1 files changed, 148 insertions, 0 deletions
diff --git a/optics.py b/optics.py
new file mode 100644
index 0000000..23a096f
--- /dev/null
+++ b/optics.py
@@ -0,0 +1,148 @@
+import numpy as np
+from geometry import Material, Surface
+
+vacuum = Material('vacuum')
+vacuum.set('refractive_index', 1.0)
+vacuum.set('absorption_length', np.inf)
+vacuum.set('scattering_length', np.inf)
+
+lambertian_surface = Surface('lambertian_surface')
+lambertian_surface.set('reflect_diffuse', 1)
+
+black_surface = Surface('black_surface')
+black_surface.set('absorb', 1)
+
+shiny_surface = Surface('shiny_surface')
+shiny_surface.set('reflect_specular', 1)
+
+glossy_surface = Surface('glossy_surface')
+glossy_surface.set('reflect_diffuse', 0.5)
+glossy_surface.set('reflect_specular', 0.5)
+
+# r7081hqe photocathode material surface
+# source: hamamatsu supplied datasheet for r7081hqe pmt serial number zd0062
+r7081hqe_photocathode = Surface('r7081hqe_photocathode')
+r7081hqe_photocathode.detect = \
+ np.array([(260.0, 0.00),
+ (270.0, 0.04), (280.0, 0.07), (290.0, 0.77), (300.0, 4.57),
+ (310.0, 11.80), (320.0, 17.70), (330.0, 23.50), (340.0, 27.54),
+ (350.0, 30.52), (360.0, 31.60), (370.0, 31.90), (380.0, 32.20),
+ (390.0, 32.00), (400.0, 31.80), (410.0, 30.80), (420.0, 30.16),
+ (430.0, 29.24), (440.0, 28.31), (450.0, 27.41), (460.0, 26.25),
+ (470.0, 24.90), (480.0, 23.05), (490.0, 21.58), (500.0, 19.94),
+ (510.0, 18.48), (520.0, 17.01), (530.0, 15.34), (540.0, 12.93),
+ (550.0, 10.17), (560.0, 7.86), (570.0, 6.23), (580.0, 5.07),
+ (590.0, 4.03), (600.0, 3.18), (610.0, 2.38), (620.0, 1.72),
+ (630.0, 0.95), (640.0, 0.71), (650.0, 0.44), (660.0, 0.25),
+ (670.0, 0.14), (680.0, 0.07), (690.0, 0.03), (700.0, 0.02),
+ (710.0, 0.00)])
+# convert percent -> fraction
+r7081hqe_photocathode.detect[:,1] /= 100.0
+# photons not detected are absorbed
+r7081hqe_photocathode.set('absorb', 1.0 - r7081hqe_photocathode.detect[:,1], wavelengths=r7081hqe_photocathode.detect[:,0])
+
+# water data comes from 'lightwater_sno' material in the SNO+ optics database
+water = Material('water')
+water.absorption_length = \
+ np.array([[ 200. , 57.51539993],
+ [ 220. , 64.22219849],
+ [ 240. , 72.6996994 ],
+ [ 260. , 83.75559998],
+ [ 280. , 98.77729797],
+ [ 300. , 120.36499786],
+ [ 320. , 154.0269928 ],
+ [ 340. , 213.82899475],
+ [ 360. , 349.5369873 ],
+ [ 380. , 105.87799835],
+ [ 400. , 50.35989761],
+ [ 420. , 32.56269836],
+ [ 440. , 26.70409966],
+ [ 460. , 22.63209915],
+ [ 480. , 19.63769913],
+ [ 500. , 17.34300041],
+ [ 520. , 11.84370041],
+ [ 540. , 8.99226952],
+ [ 560. , 7.24743032],
+ [ 580. , 6.06968021],
+ [ 600. , 5.22121 ],
+ [ 620. , 4.58085012],
+ [ 640. , 4.08041 ],
+ [ 660. , 3.67853999],
+ [ 680. , 3.3487401 ],
+ [ 700. , 3.07319999],
+ [ 720. , 2.83956003],
+ [ 740. , 2.63893986],
+ [ 760. , 2.46479011],
+ [ 780. , 2.31220984],
+ [ 800. , 2.1774199 ]], dtype=np.float32)
+water.scattering_length = \
+ np.array([[ 200. , 11.36030006],
+ [ 220. , 16.63280106],
+ [ 240. , 23.55719948],
+ [ 260. , 32.44709778],
+ [ 280. , 43.64310074],
+ [ 300. , 57.51350021],
+ [ 320. , 74.45359802],
+ [ 340. , 94.88600159],
+ [ 360. , 119.26100159],
+ [ 380. , 148.05499268],
+ [ 400. , 181.77200317],
+ [ 420. , 220.94500732],
+ [ 440. , 266.13299561],
+ [ 460. , 317.92098999],
+ [ 480. , 376.92300415],
+ [ 500. , 443.78100586],
+ [ 520. , 519.16101074],
+ [ 540. , 603.75897217],
+ [ 560. , 698.29797363],
+ [ 580. , 803.52697754],
+ [ 600. , 920.22399902],
+ [ 620. , 1049.18994141],
+ [ 640. , 1191.27001953],
+ [ 660. , 1347.30004883],
+ [ 680. , 1518.18005371],
+ [ 700. , 1704.82995605],
+ [ 720. , 1908.18005371],
+ [ 740. , 2129.19995117],
+ [ 760. , 2368.87988281],
+ [ 780. , 2628.25 ],
+ [ 800. , 2908.36010742]], dtype=np.float32)
+water.refractive_index = \
+ np.array([[ 200. , 1.41614997],
+ [ 220. , 1.39726996],
+ [ 240. , 1.38395 ],
+ [ 260. , 1.37414002],
+ [ 280. , 1.36667001],
+ [ 300. , 1.36082006],
+ [ 320. , 1.35615003],
+ [ 340. , 1.35232997],
+ [ 360. , 1.34915996],
+ [ 380. , 1.34650004],
+ [ 400. , 1.34423006],
+ [ 420. , 1.34227002],
+ [ 440. , 1.34057999],
+ [ 460. , 1.33908999],
+ [ 480. , 1.33778 ],
+ [ 500. , 1.33660996],
+ [ 520. , 1.33556998],
+ [ 540. , 1.33463001],
+ [ 560. , 1.33378005],
+ [ 580. , 1.33300996],
+ [ 600. , 1.33230996],
+ [ 620. , 1.33167005],
+ [ 640. , 1.33107996],
+ [ 660. , 1.33053994],
+ [ 680. , 1.33003998],
+ [ 700. , 1.32957006],
+ [ 720. , 1.32913995],
+ [ 740. , 1.32874 ],
+ [ 760. , 1.32835996],
+ [ 780. , 1.32800996],
+ [ 800. , 1.32767999]], dtype=np.float32)
+
+# glass data comes from 'glass_sno' material in SNO+ optics database
+glass = Material('glass')
+glass.set('refractive_index', 1.49)
+glass.absorption_length = \
+ np.array([(200, 0.1e-6), (300, 0.1e-6), (330, 1.0), (500, 2.0), (600, 1.0), (770, 0.5), (800, 0.1e-6)])
+glass.set('scattering_length', np.inf)