-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.py
174 lines (141 loc) · 5.21 KB
/
example.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
from entities.optical_table import OpticalTable
from entities.source import PointSource, BoxSource
from entities.geometry import Box
from entities.optical_elements import PlaneMirror,Dicroic
table = OpticalTable(dimension=(1.2,1.2),
gridspacing=0.1,
scale=10)
## SOURCES
source_ir0 = BoxSource(table,
position=(0.2,0.7),
dimension=(0.1,0.025),
orientation=-90,
wavelength=1064,divergence=0,
color="red",
max_collisions=6,
n_rays=1)
source_ir1 = BoxSource(table,
position=(1.0,0.7),
dimension=(0.1,0.025),
orientation=-90,
wavelength=1064,divergence=0,
color="red",max_collisions=6,n_rays=1)
source_verdi = BoxSource(table,
position=(0.1,0.1),
dimension=(0.2,0.05),
orientation=-0,
wavelength=450,divergence=0,
color="green",max_collisions=5,
n_rays=1)
point_source = PointSource(table,
position=(0.65,1.1),
divergence=0,
orientation=180,
color="green",wavelength=400,
max_collisions=4)
point_source = PointSource(table,
position=(0.6,1.1),
divergence=0,
orientation=0,
color="red",wavelength=400,
max_collisions=4,linestyle="dashed")
## GEOMETRY
spectrometer = Box(table,
position=(0.05,0.4),
dimension=(0.1,0.2),
orientation=0)
spectrometer2 = Box(table,
position=(1.1,0.2),
dimension=(0.15,0.2),
orientation=0)
camera = Box(table,
position=(1.15,0.075),
dimension=(0.05,0.05),
orientation=90)
dac = Box(table,
position=(0.6,1.1),
dimension=(0.03,0.03),
orientation=90)
### OPTICAL ELEMENTS
mirror0 = PlaneMirror(table,
position=(0.3,0.1),
orientation=60,
size=0.05)
mirror1 = Dicroic(table,
position=(0.24,0.2),
orientation=-120,
size=0.05,
wavelength_range=[450,500])
mirror2 = PlaneMirror(table,
position=(0.55,0.2),
orientation=45,
size=0.05)
mirror3 = PlaneMirror(table,
position=(0.55,1.1),
orientation=-135,
size=0.05)
mirror4 = PlaneMirror(table,
position=(0.65,1.1),
orientation=135,
size=0.05)
# SPRECTOMETER MIRROR
mirror5 = PlaneMirror(table,
position=(0.05,0.2),
orientation=-45,
size=0.05)
mirror6 = PlaneMirror(table,
position=(0.05,0.3),
orientation=0,
size=0.001)
mirror3 = PlaneMirror(table,
position=(0.65,0.2),
orientation=-45,
size=0.05)
mirror6 = PlaneMirror(table,
position=(1.1,0.2),
orientation=90,
size=0.001)
### INFRA-RED MIRRORS
mirror_ir0_0 = PlaneMirror(table,
position=(0.2,0.4),
orientation=-45,
size=0.05)
mirror_ir0_1 = PlaneMirror(table,
position=(0.3,0.4),
orientation=45,
size=0.05)
mirror_ir0_2 = PlaneMirror(table,
position=(0.3,0.7),
orientation=-135,
size=0.05)
mirror_ir0_3 = Dicroic(table,
position=(0.55,0.7),
orientation=45,
wavelength_range=[1000,1100],
size=0.05)
mirror_ir1_0 = PlaneMirror(table,
position=(1.0,0.4),
orientation=45,
size=0.05)
mirror_ir1_1 = PlaneMirror(table,
position=(0.9,0.4),
orientation=-45,
size=0.05)
mirror_ir1_2 = PlaneMirror(table,
position=(0.9,0.7),
orientation=135,
size=0.05)
mirror_ir1_3 = Dicroic(table,
position=(0.65,0.7),
orientation=-45,
wavelength_range=[1000,1100],
size=0.05)
from utils import stl_exporter
### RAY-TRACING
for source in table.sources:
rays = source.generate_rays()
for ray in rays:
ray.trace()
ray.draw()
stl_exporter.create(ray,n_vertices=11,radius=0.01)
table.draw()