Changes
Page history
some small improvements in example
authored
Mar 14, 2020
by
joha2
Show whitespace changes
Inline
Side-by-side
Home.md
View page @
47636655
...
@@ -50,29 +50,34 @@ components = [
...
@@ -50,29 +50,34 @@ components = [
# in s3, such that there is only the AST left. The AST is symmetric
# in s3, such that there is only the AST left. The AST is symmetric
# to the y axis such that there is a straight line drawn, later.
# to the y axis such that there is a straight line drawn, later.
(
s
,
rt
)
=
pyrateoptics
.
build_simple_optical_system
(
components
,
name
=
"
s
"
)
(
opticalsystem
,
raytrace_order
)
=
\
pyrateoptics
.
build_simple_optical_system
(
components
,
name
=
"
s
"
)
# Notice: It is always a good idea to provide names for systems, elements
# Notice: It is always a good idea to provide names for systems, elements
# and components. There is also a convenience function for rotationally
# and components. There is also a convenience function for rotationally
# symmetric systems `build_rotationally_symmetric_optical_system`.
# symmetric systems `build_rotationally_symmetric_optical_system`.
tiltx_s2
=
s
.
elements
[
"
stdelem
"
].
surfaces
[
"
s2
"
].
rootcoordinatesystem
.
tiltx
tiltx_s2
=
opticalsystem
.
elements
[
"
stdelem
"
].
surfaces
[
"
s2
"
].
\
tiltx_s3
=
s
.
elements
[
"
stdelem
"
].
surfaces
[
"
s3
"
].
rootcoordinatesystem
.
tiltx
rootcoordinatesystem
.
tiltx
tiltx_s3
=
opticalsystem
.
elements
[
"
stdelem
"
].
surfaces
[
"
s3
"
].
\
rootcoordinatesystem
.
tiltx
tiltx_s3
.
to_pickup
((
FunctionObject
(
"
f = lambda x: -x
"
,
[
"
f
"
]),
"
f
"
),
tiltx_s3
.
to_pickup
((
FunctionObject
(
"
f = lambda x: -x
"
,
[
"
f
"
]),
"
f
"
),
(
tiltx_s2
,))
(
tiltx_s2
,))
s
.
rootcoordinatesystem
.
update
()
opticalsystem
.
rootcoordinatesystem
.
update
()
# Setting tiltx of s3 as -tiltx of s2 via pickup and update coordinate systems
# Setting tiltx of s3 as -tiltx of s2 via pickup and update coordinate systems
# afterwards.
# afterwards.
osa
=
OpticalSystemAnalysis
(
s
,
rt
,
name
=
"
osa
"
)
osa
=
OpticalSystemAnalysis
(
opticalsystem
,
raytrace_order
,
name
=
"
osa
"
)
osa
.
aim
(
21
,
{
"
radius
"
:
5
})
osa
.
aim
(
21
,
{
"
radius
"
:
5
.
})
rays
=
osa
.
trace
()
rays
=
osa
.
trace
()
# traces 21 rays through system in a rectangular grid sampling a round pupil
# with radius 5 mm.
#
pyrateoptics.listOptimizableVariables(
s
, max_line_width=75)
pyrateoptics
.
listOptimizableVariables
(
opticalsystem
,
max_line_width
=
75
)
# Lists optimizable variables (the identifiers are keys to a dict which
# Lists optimizable variables (the identifiers are keys to a dict which
# collects them all).
# collects them all).
pyrateoptics
.
draw
(
s
,
rays
)
pyrateoptics
.
draw
(
opticalsystem
,
rays
)
# This function can get a list of raypath argument to draw rays.
# This function can get a list of raypath argument to draw rays.
```
```
...
...
...
...