forked from DCC-Lab/RayTracing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestTracing.py
48 lines (37 loc) · 1014 Bytes
/
testTracing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from raytracing import *
import numpy
import matplotlib.pyplot as plt
from matplotlib import pyplot as plt
import signal
import os
def sig(a, b):
print("got sigint, exitting!")
os._exit(0)
def timercb(e):
print("timer")
signal.signal(signal.SIGINT, sig)
f = 50
f_obj = 5
f_tube = 100
f_galvo = 100
f_poly2 = 75
f_poly1 = 45
x = numpy.linspace(-20,20,21)
y = []
for d in x:
nRays = 1000 # You can change this
inputRays = RandomUniformRays(yMax=0.25e-3, maxCount=nRays) # at center
outputRays = Rays() # output histogram
path = OpticalPath()
path.append(Space(d=d*1e-3))
path.append(System2f(f=f_obj))
path.append(System4f(f1=f_tube,f2=f_galvo))
path.append(System4f(f1=f_poly2,f2=f_poly1))
path.append(Space(d=300))
path.append(System2f(f=40))
path.append(Aperture(diameter=40e-3))
outputRays = path.traceManyThrough(inputRays,progress=False)
y.append(outputRays.count/inputRays.count)
print('.')
plt.plot(x,y)
plt.show(block=True)