import numpy as np
import matplotlib.pyplot as plt
import requests
import copy as cp
from rayopt import *
from rayopt import zemax
np.set_printoptions(precision=3)
%pylab inline
Populating the interactive namespace from numpy and matplotlib
d = requests.get("http://www.lens-designs.com/MicroscopeObjectives/US07502177-1.zmx")
d.encoding = "utf-16"
s = zemax.zmx_to_system(d.text)
s.object = InfiniteConjugate(angle=np.deg2rad(3.5/2), pupil={"radius": 7})
s.wavelengths = 193e-9, 194e-9, 192e-9
s.fields = 0, .7, 1.
s.stop = 1
del s[0]
s[0].radius = s[1].radius
s[1].distance = 20.
fsm = cp.copy(s[2].material)
fsm.mirror = True
for e in s[10:13]:
e.curvature *= -1
for e in s:
if getattr(e.material, "mirror", None):
e.material = fsm
s.update()
a = Analysis(s)
/home/rj/work/nist/pyrayopt/rayopt/elements.py:134: RuntimeWarning: invalid value encountered in multiply self._offset = d*u
OBSC not handled 0 3.0 0 OBSC not handled 0 3.0 0 RAID not handled 32 1 0 7.0E-1 0 0 0 0 0 0
/home/rj/work/nist/pyrayopt/rayopt/paraxial_trace.py:186: RuntimeWarning: divide by zero encountered in true_divide return self.n[(0, -2), ]/(2*na) /home/rj/work/nist/pyrayopt/rayopt/paraxial_trace.py:191: RuntimeWarning: divide by zero encountered in true_divide return 1.22*self.wavelength/(2*na)/self.system.scale
System: Scale: 1.0 mm Wavelengths: 193, 194, 192 nm Fields: 0, 0.7, 1 Object: Semi-Angle: 1.75 deg Pupil: Pupil Distance: 20 Refractive Index: 1.00033 Radius: 7 Image: Radius: 0.569 Update Radius: True Pupil: Pupil Distance: 3.56062 Refractive Index: 1.00033 Update Radius: True Radius: -13.2074 Stop: 1 Elements: # T Distance Rad Curv Diameter Material n nd Vd 0 S 0 inf 14.204 basic/air 1.000 1.000 89.30 1 S 20 inf 14.204 basic/air 1.000 1.000 89.30 2 S 15.189 -81.63 18 HERAEUS/SUPRASIL 1.561 1.458 67.88 3 S 3.5 -18.04 18 basic/air 1.000 1.000 89.30 4 S 22.449 18.74 8 HERAEUS/SUPRASIL 1.561 1.458 67.88 5 S 2 795.1 8 basic/air 1.000 1.000 89.30 6 S 1.9981 85 6 HERAEUS/SUPRASIL 1.561 1.458 67.88 7 S 5 40.3 6 basic/air 1.000 1.000 89.30 8 S 97.532 -78.57 58 HERAEUS/SUPRASIL 1.561 1.458 67.88 9 S 5 -132.1 62 HERAEUS/SUPRASIL -1.561 -1.458 363.98 10 S 5 78.57 58 basic/air 1.000 1.000 89.30 11 S 97.532 -40.3 58 HERAEUS/SUPRASIL 1.561 1.458 67.88 12 S 5 -85 62 HERAEUS/SUPRASIL -1.561 -1.458 363.98 13 S 5 40.3 58 basic/air 1.000 1.000 89.30 14 S 97.532 -78.57 6 HERAEUS/SUPRASIL 1.561 1.458 67.88 15 S 5 -132.1 6 basic/air 1.000 1.000 89.30 16 S 14.181 41.91 14 HERAEUS/SUPRASIL 1.561 1.458 67.88 17 S 2.9999 -19.65 14 basic/air 1.000 1.000 89.30 18 S 0.49995 10.21 14 HERAEUS/SUPRASIL 1.561 1.458 67.88 19 S 6.6431 6.314 10 basic/air 1.000 1.000 89.30 20 S 5.3852 -6.572 10 HERAEUS/SUPRASIL 1.561 1.458 67.88 21 S 8.4427 -11.61 18 basic/air 1.000 1.000 89.30 22 S 19.086 29.38 30 HERAEUS/SUPRASIL 1.561 1.458 67.88 23 S 2.9999 25.29 30 basic/air 1.000 1.000 89.30 24 S 4.1869 55.55 32 HERAEUS/SUPRASIL 1.561 1.458 67.88 25 S 6.8408 -51.74 32 basic/air 1.000 1.000 89.30 26 S 0.5 53.43 32 HERAEUS/SUPRASIL 1.561 1.458 67.88 27 S 5.1416 -275.8 32 basic/air 1.000 1.000 89.30 28 S 0.5 27.21 30 HERAEUS/SUPRASIL 1.561 1.458 67.88 29 S 5.296 85.4 30 basic/air 1.000 1.000 89.30 30 S 0.5 13.76 24 HERAEUS/SUPRASIL 1.561 1.458 67.88 31 S 6.7827 69.46 20 basic/air 1.000 1.000 89.30 32 S 8.2366 inf 1.1377 basic/air 1.000 1.000 89.30 lagrange: -0.21397 track length: 242.65 object, image height: [ 0.611 0.059] front, back focal length (from PP): [-8.023 8.023] entry, exit pupil height: [ 7. 13.018] entry, exit pupil distance: [ -0. 11.797] front, back focal distance: [ 4.313 -3.121] front, back principal distance: [ 12.335 -11.144] front, back nodal distance: [ 12.335 -11.144] front, back numerical aperture: [ 0. 0.658] front, back f number: [ 0.573 0.308] front, back working f number: [ inf 0.761] front, back airy radius: [ inf 0.] transverse, angular magnification: [-0. -0.538] # T path n axial y axial nu chief y chief nu 0 S 0 1 7 0 -0.6112 0.03057 1 S 20 1 7 0 0 0.03057 2 S 35.19 1.561 7 0.04806 0.4641 0.03375 3 S 38.69 1 7.108 -0.1727 0.5398 0.01698 4 S 61.14 1.561 3.231 -0.2693 0.921 -0.01055 5 S 63.14 1 2.886 -0.2673 0.9075 -0.009912 6 S 65.14 1.561 2.352 -0.2828 0.8877 -0.01576 7 S 70.14 1 1.446 -0.2627 0.8372 -0.004123 8 S 167.7 1.561 -24.17 -0.4351 0.4351 -0.00102 9 S 172.7 -1.561 -25.56 -0.04812 0.4319 -0.007558 10 S 177.7 1 25.41 -0.1331 -0.4561 0.01081 11 S 275.2 1.561 12.43 0.03972 0.598 0.01913 12 S 280.2 -1.561 12.56 -0.2557 0.6593 0.003614 13 S 285.2 1 -13.38 0.4417 -0.6477 0.005393 14 S 382.7 1.561 29.69 0.6536 -0.1219 0.004523 15 S 387.7 1 31.79 0.5187 -0.1074 0.004979 16 S 401.9 1.561 39.14 -0.004747 -0.03681 0.005471 17 S 404.9 1 39.13 -1.121 -0.0263 0.006221 18 S 405.4 1.561 38.57 -3.239 -0.02319 0.007495 19 S 412.1 1 24.79 -1.039 0.008712 0.008268 20 S 417.4 1.561 19.19 0.5974 0.05322 0.01281 21 S 425.9 1 22.42 -0.4851 0.1225 0.006893 22 S 445 1.561 13.17 -0.7362 0.254 0.002048 23 S 448 1 11.75 -0.4758 0.2579 0.007764 24 S 452.2 1.561 9.762 -0.5743 0.2904 0.004834 25 S 459 1 7.245 -0.6527 0.3116 0.001458 26 S 459.5 1.561 6.918 -0.7253 0.3124 -0.001818 27 S 464.6 1 4.529 -0.7345 0.3064 -0.002441 28 S 465.1 1.561 4.162 -0.8202 0.3051 -0.008726 29 S 470.4 1 1.379 -0.8112 0.2755 -0.006917 30 S 470.9 1.561 0.9732 -0.8508 0.2721 -0.018 31 S 477.7 1 -2.724 -0.8728 0.1938 -0.01644 32 S 486 1 -9.911 -0.8728 0.05851 -0.01644 # T SA3 CMA3 AST3 PTZ3 DIS3 TACHC TCHC 0 S 0 0 0 0 0 0 0 1 S -0 -0 -0 0 0 -0 -1.01e-07 2 S 0.0001389 -4.03e-05 1.169e-05 2.753e-05-1.137e-05 0.0003337-9.679e-05 3 S -0.06006 -0.001372-3.134e-05-0.0001245-3.561e-06 -0.002239-5.115e-05 4 S 2.603e-09-5.586e-07 0.0001199-0.0001199-7.042e-06 5.533e-07-0.0001188 5 S -0.004295-0.0001429-4.752e-06 2.826e-06-6.405e-08-0.0004229-1.407e-05 6 S 0.002789-6.228e-06 1.391e-08-2.643e-05 5.9e-08 0.0003132-6.995e-07 7 S -0.001489 0.0001094-8.031e-06 5.575e-05-3.504e-06-0.0001823 1.339e-05 8 S-0.0005616 0.0001206 -2.59e-05 2.86e-05-5.804e-07 0.0006045-0.0001298 9 S 0 -0 0 -0 6.734e-07 0.003786 0.0001741 10 S 0.3852 -0.001047 2.844e-06 0.0001307 3.567e-06 -0.007807 2.122e-05 11 S 0.04949 0.0004518 4.124e-06 5.575e-05 5.466e-07 0.003051 2.785e-05 12 S 0 0 0 -0-4.236e-06 -0.002666 9.807e-05 13 S -0.05644 -0.006176-0.0006757 0.0002548 1.49e-05 -0.00195-0.0002133 14 S -0.00285-0.0003108 -3.39e-05 2.86e-05-5.784e-07 -0.001051-0.0001146 15 S 0.084 0.00175 3.646e-05-1.701e-05 4.053e-07 0.004912 0.0001023 16 S -5.878 -0.01659-4.681e-05-5.362e-05-2.834e-07 -0.03161-8.919e-05 17 S -58.01 0.1408 -0.000342-0.0001144 1.108e-06 -0.06772 0.0001644 18 S -7.806 -0.01159-1.721e-05-0.0002201-3.525e-07 -0.05701-8.465e-05 19 S 8.226 0.02749 9.185e-05 0.0003558 1.496e-06 0.03977 0.0001329 20 S 52.83 -0.002223 9.351e-08 0.0003419-1.439e-08 0.04224-1.777e-06 21 S -13.08 -0.01981-3.002e-05-0.0001936-3.388e-07 -0.03012-4.565e-05 22 S 0.0004432-0.0001875 7.935e-05-7.647e-05-1.219e-06 0.0002688-0.0001137 23 S-3.292e-05 5.438e-05-8.986e-05 8.885e-05 1.664e-06-7.103e-05 0.0001174 24 S 0.0288 -0.001247 5.402e-05-4.044e-05-5.878e-07 0.001628-7.049e-05 25 S -0.2593 -0.001494-8.606e-06-4.343e-05-2.997e-07 -0.003192-1.839e-05 26 S 0.0918 -0.001282 1.79e-05-4.206e-05 3.373e-07 0.002012 -2.81e-05 27 S -0.1523-0.0007205-3.408e-06-8.146e-06-5.465e-08 -0.00189 -8.94e-06 28 S 0.07645 -0.001154 1.742e-05-8.258e-05 9.835e-07 0.001345 -2.03e-05 29 S -0.05647-0.0002621-1.216e-06 2.631e-05 1.165e-07-0.0006092-2.827e-06 30 S 0.03366-0.0005848 1.016e-05-0.0001633 2.661e-06 0.0004005-6.959e-06 31 S 0.162 0.002424 3.627e-05 3.235e-05 1.027e-06 0.001381 2.066e-05 32 S -0 0 -0 0 0 0 0 -23.39 0.107-0.0008367 0.0001038-4.545e-06 -0.1065 -0.000358
print(system_to_yaml(s))
description: '' elements: - {material: basic/air, radius: 7.101937623607} - {distance: 20.0, material: basic/air, radius: 7.101937623607} - {curvature: -0.012250712097142069, distance: 15.188841, material: HERAEUS/SUPRASIL, radius: 9.0} - {curvature: -0.05543026775313687, distance: 3.5, material: basic/air, radius: 9.0} - {curvature: 0.05334878314093095, distance: 22.449116, material: HERAEUS/SUPRASIL, radius: 4.0} - {curvature: 0.0012576439726421588, distance: 2.0, material: basic/air, radius: 4.0} - {curvature: 0.011765167907417353, distance: 1.998104, material: HERAEUS/SUPRASIL, radius: 3.0} - {curvature: 0.024812404574593556, distance: 5.0, material: basic/air, radius: 3.0} - {curvature: -0.012727913010722148, distance: 97.532362, material: HERAEUS/SUPRASIL, radius: 29.0} - {curvature: -0.00756944706536549, distance: 5.0, material: HERAEUS/SUPRASIL, radius: 31.0} - curvature: 0.012727913010722148 direction: [-0.0, -0.0, -1.0] distance: 5.0 material: basic/air radius: 29.0 - curvature: -0.024812404574593556 direction: [-0.0, -0.0, -1.0] distance: 97.532362 material: HERAEUS/SUPRASIL radius: 29.0 - curvature: -0.011765167907417353 direction: [-0.0, -0.0, -1.0] distance: 5.0 material: HERAEUS/SUPRASIL radius: 31.0 - {curvature: 0.024812404574593556, distance: 5.0, material: basic/air, radius: 29.0} - {curvature: -0.012727913010722148, distance: 97.532362, material: HERAEUS/SUPRASIL, radius: 3.0} - {curvature: -0.00756944706536549, distance: 5.0, material: basic/air, radius: 3.0} - {curvature: 0.023862906836610655, distance: 14.180612, material: HERAEUS/SUPRASIL, radius: 7.0} - {curvature: -0.050902685315170844, distance: 2.999944, material: basic/air, radius: 7.0} - {curvature: 0.09797645312306803, distance: 0.499948, material: HERAEUS/SUPRASIL, radius: 7.0} - {curvature: 0.158371334535055, distance: 6.643053, material: basic/air, radius: 5.0} - {curvature: -0.15216584494574298, distance: 5.385248, material: HERAEUS/SUPRASIL, radius: 5.0} - {curvature: -0.08614246792657491, distance: 8.442713, material: basic/air, radius: 9.0} - {curvature: 0.03403588621313122, distance: 19.085531, material: HERAEUS/SUPRASIL, radius: 15.0} - {curvature: 0.039543358046482194, distance: 2.999908, material: basic/air, radius: 15.0} - {curvature: 0.01800044309890732, distance: 4.186877, material: HERAEUS/SUPRASIL, radius: 16.0} - {curvature: -0.019329029840813458, distance: 6.84081, material: basic/air, radius: 16.0} - {curvature: 0.018717800002627977, distance: 0.5, material: HERAEUS/SUPRASIL, radius: 16.0} - {curvature: -0.003625459362015735, distance: 5.141563, material: basic/air, radius: 16.0} - {curvature: 0.03675159015861508, distance: 0.5, material: HERAEUS/SUPRASIL, radius: 15.0} - {curvature: 0.01170959625183318, distance: 5.295973, material: basic/air, radius: 15.0} - {curvature: 0.07268750869524322, distance: 0.5, material: HERAEUS/SUPRASIL, radius: 12.0} - {curvature: 0.014395858438210882, distance: 6.782701, material: basic/air, radius: 10.0} - {distance: 8.236570833198144, material: basic/air, radius: 0.5688575779126} image: pupil: {distance: 3.5606226961079166, radius: -13.20738877769501, refractive_index: 1.0003293101092814, update_radius: true} radius: 0.5688575779126 type: finite object: angle: 0.030543261909900768 pupil: {distance: 20.0, radius: 7.0, refractive_index: 1.0003293101092814} pickups: [] scale: 0.001 solves: [] stop: 1 validators: [] wavelengths: [1.93e-07, 1.94e-07, 1.92e-07]