... | ... | @@ -50,29 +50,34 @@ components = [ |
|
|
# 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.
|
|
|
|
|
|
(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
|
|
|
# and components. There is also a convenience function for rotationally
|
|
|
# symmetric systems `build_rotationally_symmetric_optical_system`.
|
|
|
|
|
|
tiltx_s2 = s.elements["stdelem"].surfaces["s2"].rootcoordinatesystem.tiltx
|
|
|
tiltx_s3 = s.elements["stdelem"].surfaces["s3"].rootcoordinatesystem.tiltx
|
|
|
tiltx_s2 = opticalsystem.elements["stdelem"].surfaces["s2"].\
|
|
|
rootcoordinatesystem.tiltx
|
|
|
tiltx_s3 = opticalsystem.elements["stdelem"].surfaces["s3"].\
|
|
|
rootcoordinatesystem.tiltx
|
|
|
tiltx_s3.to_pickup((FunctionObject("f = lambda x: -x", ["f"]), "f"),
|
|
|
(tiltx_s2,))
|
|
|
|
|
|
s.rootcoordinatesystem.update()
|
|
|
opticalsystem.rootcoordinatesystem.update()
|
|
|
# Setting tiltx of s3 as -tiltx of s2 via pickup and update coordinate systems
|
|
|
# afterwards.
|
|
|
|
|
|
osa = OpticalSystemAnalysis(s, rt, name="osa")
|
|
|
osa.aim(21, {"radius": 5})
|
|
|
osa = OpticalSystemAnalysis(opticalsystem, raytrace_order, name="osa")
|
|
|
osa.aim(21, {"radius": 5.})
|
|
|
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
|
|
|
# collects them all).
|
|
|
|
|
|
pyrateoptics.draw(s, rays)
|
|
|
pyrateoptics.draw(opticalsystem, rays)
|
|
|
# This function can get a list of raypath argument to draw rays.
|
|
|
```
|
|
|
|
... | ... | |