import numpy as np
import matplotlib.pyplot as plt
from rayopt import *
np.set_printoptions(precision=3)
%pylab inline
Populating the interactive namespace from numpy and matplotlib
s = system_from_yaml("""
description: Offner Relay, 1:1 f/10, 32mm, US3748015
object: {type: finite, radius: 16, pupil: {type: fno, fno: 10, telecentric: True}}
stop: 2
wavelengths: [588.0e-9]
fields: [0., 1., -0.4, -0.7, -1.]
elements:
- {material: vacuum}
- {material: mirror, offset: [0, -36, 400.]}
- {}
- {}
- {}
pickups:
- {set: [2, material], get: [1, material]}
- {set: [3, material], get: [1, material]}
- {set: [4, material], get: [0, material]}
- {set: [1, curvature], get_eval: "-1/self[1].offset[2]"}
- {set: [2, curvature], get_eval: "-2/(1/self[1].curvature + self[1].offset[1]**2/2*self[1].curvature)"}
- {set: [3, curvature], get: [1, curvature]}
- {set: [0, radius], get: [object, radius], offset: .1}
- {set: [1, radius], get: [1, offset, 1], factor: -2}
- {set: [2, radius], get_eval: "(self[1].offset[1] + self.object.radius)/-2"}
- {set: [3, radius], get: [1, radius]}
- {set: [4, radius], get: [0, radius]}
- {set: [image, radius], get: [object, radius]}
- {set: [2, offset], get_eval: "[0, 0, 1/self[1].curvature + 1/self[2].curvature]"}
- {set: [3, offset], get: [2, offset], factor: -1}
- {set: [4, offset], get: [1, offset], factor: [1, 1, -1]}
- {set: [1, angles], get_eval: "[-np.arcsin(self[1].offset[1]/self[1].distance), 0, 0]"}
- {set: [4, angles], get: [1, angles], factor: -1}
""")
s.update()
print(s)
print(system_to_yaml(s))
print(s.origins)
a = Analysis(s)
System: Offner Relay, 1:1 f/10, 32mm, US3748015 Scale: 1.0 mm Wavelengths: 588 nm Fields: 0, 1, -0.4, -0.7, -1 Object: Radius: 16 Pupil: Pupil Distance: 8.11814e+06 Telecentric: True F-Number: 10 Image: Radius: 16.1 Update Radius: True Pupil: Pupil Distance: -49584.3 Update Radius: True Radius: 2469.14 Stop: 2 Elements: # T Distance Rad Curv Diameter Material n nd Vd 0 S 0 inf 32.2 basic/vacuum 1.000 1.000 inf 1 S 401.62 -400 144 basic/mirror 1.000 1.000 inf 2 S 199.19 200.8 20 basic/mirror 1.000 1.000 inf 3 S 199.19 -400 144 basic/mirror 1.000 1.000 inf 4 S 401.62 inf 32.2 basic/vacuum 1.000 1.000 inf description: Offner Relay, 1:1 f/10, 32mm, US3748015 elements: - {material: basic/vacuum, radius: 16.1} - angles: [0.08975817418995052, 0.0, 0.0] curvature: -0.0025 direction: [0.0, -0.0896376994958906, 0.9959744388432288] distance: 401.61673271914356 material: basic/mirror radius: 72.0 - curvature: 0.004979831681689159 direction: [0.0, 0.0, -1.0] distance: 199.19 material: basic/mirror radius: 10.0 - {curvature: -0.0025, distance: 199.19, material: basic/mirror, radius: 72.0} - angles: [-0.08975817418995052, -0.0, -0.0] direction: [0.0, -0.0896376994958906, -0.9959744388432288] distance: 401.61673271914356 material: basic/vacuum radius: 16.1 image: pupil: {distance: -49584.3327821016, radius: 2469.1358024691226, update_radius: true} radius: 16.1 type: finite object: pupil: {distance: 8118140.521794385, fno: 10.0, telecentric: true, type: fno} radius: 16.0 type: finite pickups: - get: [1, material] set: [2, material] - get: [1, material] set: [3, material] - get: [0, material] set: [4, material] - get_eval: -1/self[1].offset[2] set: [1, curvature] - get_eval: -2/(1/self[1].curvature + self[1].offset[1]**2/2*self[1].curvature) set: [2, curvature] - get: [1, curvature] set: [3, curvature] - get: [object, radius] offset: 0.1 set: [0, radius] - factor: -2 get: [1, offset, 1] set: [1, radius] - get_eval: (self[1].offset[1] + self.object.radius)/-2 set: [2, radius] - get: [1, radius] set: [3, radius] - get: [0, radius] set: [4, radius] - get: [object, radius] set: [image, radius] - get_eval: '[0, 0, 1/self[1].curvature + 1/self[2].curvature]' set: [2, offset] - factor: -1 get: [2, offset] set: [3, offset] - factor: [1, 1, -1] get: [1, offset] set: [4, offset] - get_eval: '[-np.arcsin(self[1].offset[1]/self[1].distance), 0, 0]' set: [1, angles] - factor: -1 get: [1, angles] set: [4, angles] scale: 0.001 solves: [] stop: 2 validators: [] wavelengths: [5.88e-07] [[ 0. 0. 0. ] [ 0. -36. 400. ] [ 0. -36. 200.81] [ 0. -36. 400. ] [ 0. -72. 0. ]]
/home/rj/work/nist/pyrayopt/rayopt/elements.py:208: RuntimeWarning: invalid value encountered in less_equal good = np.square(y[:, :2]).sum(1) <= self.radius**2
System: Offner Relay, 1:1 f/10, 32mm, US3748015 Scale: 1.0 mm Wavelengths: 588 nm Fields: 0, 1, -0.4, -0.7, -1 Object: Radius: 16 Pupil: Pupil Distance: 8.11814e+06 Telecentric: True F-Number: 10 Image: Radius: 16.1 Update Radius: True Pupil: Pupil Distance: -49584.3 Update Radius: True Radius: 2469.14 Stop: 2 Elements: # T Distance Rad Curv Diameter Material n nd Vd 0 S 0 inf 32.2 basic/vacuum 1.000 1.000 inf 1 S 401.62 -400 144 basic/mirror 1.000 1.000 inf 2 S 199.19 200.8 20 basic/mirror 1.000 1.000 inf 3 S 199.19 -400 144 basic/mirror 1.000 1.000 inf 4 S 401.62 inf 32.2 basic/vacuum 1.000 1.000 inf lagrange: -0.801 track length: 0 object, image height: [ 16. 16.13] front, back focal length (from PP): [-48891.279 48891.279] entry, exit pupil height: [ 406415.363 2462.337] entry, exit pupil distance: [ 8117738.905 -49182.716] front, back focal distance: [ 48102.435 -48886.5 ] front, back principal distance: [ 96993.714 -97777.779] front, back nodal distance: [ 96993.714 -97777.779] front, back numerical aperture: [ 0.05 0.05] front, back f number: [ 0.06 9.928] front, back working f number: [ 10. 10.08] front, back airy radius: [ 0.007 0.007] transverse, angular magnification: [ -1.008 165.053] # T path n axial y axial nu chief y chief nu 0 S 0 1 0 0.05006 -16 1.971e-06 1 S 401.6 1 20.11 -0.05087 -16 0.08032 2 S 600.8 1 9.972 0.04845 0 0.08032 3 S 800 1 19.62 -0.04967 16 0.0003253 4 S 1202 1 -0.3238 -0.04967 16.13 0.0003253 # T SA3 CMA3 AST3 PTZ3 DIS3 TACHC TCHC 0 S 0 0 0 0 0 0 0 1 S -8.4e-07 0.000166 -0.03282 0.0323 0.05214 -0 0 2 S 1.466e-05-0.0009712 0.06434 -0.06434-1.399e-17 -0 0 3 S-7.182e-06 0.0004758 -0.03152 0.0323 -0.05171 -0 0 4 S -0 0 -0 0 0 0 -0 6.638e-06-0.0003294-4.804e-06 0.0002606 0.0004223 0 0