%pylab inline
import warnings
import numpy as np
import matplotlib.pyplot as plt
import rayopt as ro
# ignore matplotlib and numpy warning each other
warnings.simplefilter("ignore", FutureWarning)
# ignore floating point exceptions
np.seterr(divide="ignore", invalid="ignore")
# by default only print 4 significant digits
np.set_printoptions(precision=4)
Populating the interactive namespace from numpy and matplotlib
# It appears that rayopt requires distance rather than
# thickness quoted in patent literature
# So we have to move the thickness value one row down
#
# The first surface represents the Object (O)
# The last surface represents the Image (I)
description = "Canon-RF-50mmf1.2-US20190265441A1"
columns = "type roc distance diameter material"
text = """
O 0 20.0 50.0 AIR
S 80.11 10.0 40.0 1.804/46.58
S -68.243 9.67 40.0 1.68893/31.07
S 52.862 1.64 40.0 AIR
S 42.184 0.2 37.0 2.001/29.13
S 2510.58 7.47 37.0 AIR
S 99.979 0.7 35.0 1.65412/39.68
S 24.508 1.6 35.0 AIR
S -101.919 7.45 33.0 1.66565/35.64
S 34.799 1.34 33.0 1.95375/32.32
S 516.053 5.56 33.0 AIR
A 0 2.44 32.0 AIR
S -1398.232 2.58 33.0 1.497/81.54
S -20.985 10.02 33.0 1.738/32.26
S 251.143 1.29 33.0 AIR
S 87.566 0.44 34.0 1.76385/48.51
S -43.447 7.29 34.0 1.66565/35.64
S 105.692 1.28 34.0 AIR
S 161.695 1.79 37.0 1.883/40.8
S -42.423 7.96 37.0 AIR
S 54.474 1.95 38.0 1.883/40.8
S -60.531 8.77 38.0 1.59551/39.24
S 40.56 1.54 38.0 AIR
S -58.170 7.14 36.5 1.673/38.15
S 105.985 1.21 36.5 1.804/46.58
S -216.191 5.08 36.5 AIR
I 0 14.6 43.2 AIR
"""
text = """
O 0 20.0 50.0 AIR
S 80.11 10.0 40.8 1.804/46.58
S -68.243 9.67 40.8 1.68893/31.07
S 52.862 1.64 38.4 AIR
S 42.184 0.2 38.4 2.001/29.13
S 2510.58 7.47 38.4 AIR
S 99.979 0.7 35.0 1.65412/39.68
S 24.508 1.6 31.5 AIR
S -101.919 7.45 31.5 1.66565/35.64
S 34.799 1.34 31.5 1.95375/32.32
S 516.053 5.56 31.5 AIR
A 0 2.44 30.8 AIR
S -1398.232 2.58 31.9 1.497/81.54
S -20.985 10.02 31.9 1.738/32.26
S 251.143 1.29 31.9 AIR
S 87.566 0.44 32.9 1.76385/48.51
S -43.447 7.29 32.0 1.66565/35.64
S 105.692 1.28 32.9 AIR
S 161.695 1.79 33.5 1.883/40.8
S -42.423 7.96 33.5 AIR
S 54.474 1.95 36.7 1.883/40.8
S -60.531 8.77 36.7 1.59551/39.24
S 40.56 1.54 36.1 AIR
S -58.170 7.14 36.1 1.673/38.15
S 105.985 1.21 36.1 1.804/46.58
S -216.191 5.08 36.1 AIR
I 0 14.6 43.2 AIR
"""
s = ro.system_from_text(text, columns.split(), description=description)
s.object.angle = np.deg2rad(22)
s.fields = 0, .7, 1.
s[1].conic = 0.00E+00
s[1].aspherics = [0, -1.44652e-6, -1.02693e-9, 1.91678e-12, -3.07794e-15, 2.00476e-18 ]
s[18].conic = 0.00E+00
s[18].aspherics = [0, -2.17027e-6, 4.00496e-9, -1.90948e-11, 4.86536e-14, -4.89586e-17 ]
s[25].conic = 0.00E+00
s[25].aspherics = [0, 3.50064e-6, -5.98670e-10, 1.34319e-11, -2.56798e-14, 2.59930e-17 ]
s.update()
#s.paraxial.resize()
print(s)
System: Canon-RF-50mmf1.2-US20190265441A1 Scale: 1.0 mm Wavelengths: 588, 656, 486 nm Fields: 0, 0.7, 1 Object: Semi-Angle: 22 deg Pupil: Pupil Distance: 46.3747 Refractive Index: 1.00028 Update Radius: True Radius: 20.669 Image: Radius: 21.6 Update Radius: True Pupil: Pupil Distance: -64.6214 Refractive Index: 1.00028 Update Radius: True Radius: 26.1322 Stop: 11 Elements: # T Distance Rad Curv Diameter Material n nd Vd 0 S 20 inf 50 basic/air 1.000 1.000 89.30 1 S 10 80.11 40.8 - 1.804 1.804 46.58 2 S 9.67 -68.24 40.8 - 1.689 1.689 31.07 3 S 1.64 52.86 38.4 basic/air 1.000 1.000 89.30 4 S 0.2 42.18 38.4 - 2.001 2.001 29.13 5 S 7.47 2511 38.4 basic/air 1.000 1.000 89.30 6 S 0.7 99.98 35 - 1.654 1.654 39.68 7 S 1.6 24.51 31.5 basic/air 1.000 1.000 89.30 8 S 7.45 -101.9 31.5 - 1.666 1.666 35.64 9 S 1.34 34.8 31.5 - 1.954 1.954 32.32 10 S 5.56 516.1 31.5 basic/air 1.000 1.000 89.30 11 S 2.44 inf 30.8 basic/air 1.000 1.000 89.30 12 S 2.58 -1398 31.9 - 1.497 1.497 81.54 13 S 10.02 -20.98 31.9 - 1.738 1.738 32.26 14 S 1.29 251.1 31.9 basic/air 1.000 1.000 89.30 15 S 0.44 87.57 32.9 - 1.764 1.764 48.51 16 S 7.29 -43.45 32 - 1.666 1.666 35.64 17 S 1.28 105.7 32.9 basic/air 1.000 1.000 89.30 18 S 1.79 161.7 33.5 - 1.883 1.883 40.80 19 S 7.96 -42.42 33.5 basic/air 1.000 1.000 89.30 20 S 1.95 54.47 36.7 - 1.883 1.883 40.80 21 S 8.77 -60.53 36.7 - 1.596 1.596 39.24 22 S 1.54 40.56 36.1 basic/air 1.000 1.000 89.30 23 S 7.14 -58.17 36.1 - 1.673 1.673 38.15 24 S 1.21 106 36.1 - 1.804 1.804 46.58 25 S 5.08 -216.2 36.1 basic/air 1.000 1.000 89.30 26 S 14.6 inf 43.2 basic/air 1.000 1.000 89.30
ro.Analysis(s)
System: Canon-RF-50mmf1.2-US20190265441A1 Scale: 1.0 mm Wavelengths: 588, 656, 486 nm Fields: 0, 0.7, 1 Object: Semi-Angle: 22 deg Pupil: Pupil Distance: 46.3747 Refractive Index: 1.00028 Update Radius: True Radius: 20.669 Image: Radius: 21.6 Update Radius: True Pupil: Pupil Distance: -64.6214 Refractive Index: 1.00028 Update Radius: True Radius: 26.1322 Stop: 11 Elements: # T Distance Rad Curv Diameter Material n nd Vd 0 S 20 inf 50 basic/air 1.000 1.000 89.30 1 S 10 80.11 40.8 - 1.804 1.804 46.58 2 S 9.67 -68.24 40.8 - 1.689 1.689 31.07 3 S 1.64 52.86 38.4 basic/air 1.000 1.000 89.30 4 S 0.2 42.18 38.4 - 2.001 2.001 29.13 5 S 7.47 2511 38.4 basic/air 1.000 1.000 89.30 6 S 0.7 99.98 35 - 1.654 1.654 39.68 7 S 1.6 24.51 31.5 basic/air 1.000 1.000 89.30 8 S 7.45 -101.9 31.5 - 1.666 1.666 35.64 9 S 1.34 34.8 31.5 - 1.954 1.954 32.32 10 S 5.56 516.1 31.5 basic/air 1.000 1.000 89.30 11 S 2.44 inf 30.8 basic/air 1.000 1.000 89.30 12 S 2.58 -1398 31.9 - 1.497 1.497 81.54 13 S 10.02 -20.98 31.9 - 1.738 1.738 32.26 14 S 1.29 251.1 31.9 basic/air 1.000 1.000 89.30 15 S 0.44 87.57 32.9 - 1.764 1.764 48.51 16 S 7.29 -43.45 32 - 1.666 1.666 35.64 17 S 1.28 105.7 32.9 basic/air 1.000 1.000 89.30 18 S 1.79 161.7 33.5 - 1.883 1.883 40.80 19 S 7.96 -42.42 33.5 basic/air 1.000 1.000 89.30 20 S 1.95 54.47 36.7 - 1.883 1.883 40.80 21 S 8.77 -60.53 36.7 - 1.596 1.596 39.24 22 S 1.54 40.56 36.1 basic/air 1.000 1.000 89.30 23 S 7.14 -58.17 36.1 - 1.673 1.673 38.15 24 S 1.21 106 36.1 - 1.804 1.804 46.58 25 S 5.08 -216.2 36.1 basic/air 1.000 1.000 89.30 26 S 14.613 inf 43.2 basic/air 1.000 1.000 89.30 lagrange: -8.5976 track length: 96.41 object, image height: [19.2849 21.2547] front, back focal length (from PP): [-51.1189 51.1189] entry, exit pupil height: [20.669 26.1322] entry, exit pupil distance: [ 36.3747 -50.0214] front, back focal distance: [-4.056 14.6052] front, back principal distance: [ 47.0628 -36.5136] front, back nodal distance: [ 47.0628 -36.5136] front, back numerical aperture: [0. 0.375] front, back f number: [1.2366 0.9781] front, back working f number: [ inf 1.3339] front, back airy radius: [ inf 0.001] transverse, angular magnification: [-0. 0.7909] # T path n axial y axial nu chief y chief nu 0 S 20 1 20.67 0 -19.28 0.416 1 S 30 1.804 20.67 -0.2074 -15.13 0.5677 2 S 39.67 1.689 19.56 -0.2403 -12.08 0.5881 3 S 41.31 1 19.32 0.0114 -11.51 0.4381 4 S 41.51 2.001 19.33 -0.4471 -11.42 0.7091 5 S 48.98 1 17.66 -0.44 -8.777 0.7056 6 S 49.68 1.654 17.35 -0.5535 -8.283 0.7598 7 S 51.28 1 16.81 -0.1049 -7.548 0.5584 8 S 58.73 1.666 16.03-0.0002564 -3.389 0.5363 9 S 60.07 1.954 16.03 -0.133 -2.958 0.5608 10 S 65.63 1 15.65 -0.1041 -1.362 0.5583 11 S 68.07 1 15.4 -0.1041-2.861e-15 0.5583 12 S 70.65 1.497 15.13 -0.09869 1.44 0.5588 13 S 80.67 1.738 14.47 0.0675 5.18 0.6183 14 S 81.96 1 14.52 0.1102 5.639 0.6349 15 S 82.4 1.764 14.57 -0.01689 5.918 0.5832 16 S 89.69 1.666 14.5 -0.04966 8.329 0.5644 17 S 90.97 1 14.46 0.04138 8.763 0.6196 18 S 92.76 1.883 14.54 -0.03797 9.871 0.5657 19 S 100.7 1 14.38 -0.3371 12.26 0.3105 20 S 102.7 1.883 13.72 -0.5594 12.87 0.102 21 S 111.4 1.596 11.11 -0.6122 13.34 0.03864 22 S 113 1 10.52 -0.4577 13.38 0.235 23 S 120.1 1.673 7.254 -0.3739 15.06 0.4091 24 S 121.3 1.804 6.984 -0.3825 15.35 0.3902 25 S 126.4 1 5.907 -0.4044 16.45 0.329 26 S 141 1 0.003756 -0.4044 21.25 0.329 # T SA3 CMA3 AST3 PTZ3 DIS3 TACHC TCHC 0 S 0 0 0 0 0 0 0 1 S 1.99 -1.631 1.04 -0.508 -1.343 -0.1262 -0.111 2 S -0.2605 0.3191 -0.3908 -0.05057 0.5405 0.1247 -0.1527 3 S 0.3248 0.1898 0.1109 0.7046 0.4764 0.2364 0.1381 4 S -0.6484 -0.2309 -0.0822 -1.083 -0.4148 -0.3853 -0.1372 5 S -1.343 2.177 -3.531 0.0182 5.696 -0.3245 0.5263 6 S 0.3616 -0.8452 1.975 -0.3611 -3.773 0.1139 -0.2661 7 S 0.6843 0.2947 0.1269 1.473 0.6891 0.2407 0.1037 8 S 0.1428 -0.3222 0.727 0.358 -2.448 0.1165 -0.2629 9 S -0.4052 -0.2085 -0.1073 -0.2324 -0.1748 -0.1183 -0.06088 10 S -0.007274 0.05482 -0.4132 0.08638 2.463 -0.04308 0.3247 11 S 0 0 0 0 0 -0 0 12 S 0.01481 -0.07181 0.3483 0.02168 -1.795 0.01749 -0.08481 13 S 1.519 -0.2542 0.04253 0.4033 -0.0746 0.3678 -0.06155 14 S 0.04445 0.1739 0.6805 0.1544 3.267 0.07936 0.3105 15 S -0.1592 -0.4042 -1.027 -0.4516 -3.754 -0.0889 -0.2258 16 S -0.08197 0.03318 -0.01343 -0.07029 0.03389 0.04962 -0.02008 17 S 0.03365 0.1326 0.5228 0.3452 3.421 0.07144 0.2815 18 S 0.8296 0.4907 -0.04336 -0.2648 -3.355 -0.05421 -0.281 19 S -2.649 0.08383 -0.002653 -1.009 0.03203 -0.2761 0.008736 20 S 0.02204 -0.1415 0.9083 -0.7861 -0.7844 0.0332 -0.2131 21 S -0.9307 -0.3219 -0.1114 -0.1444 -0.08848 -0.04927 -0.01704 22 S -0.1109 0.3162 -0.901 0.8402 0.1733 -0.04904 0.1397 23 S 0.9855 0.04049 0.001663 0.6314 0.02601 0.1101 0.004524 24 S 0.009623 -0.02378 0.05878 -0.03742 -0.0528 -0.004444 0.01098 25 S -0.3564 0.3229 0.1289 -0.1882 0.9206 -0.06031 0.03532 26 S 0 -0 0 0 0 -0 0 0.009712 0.1745 0.0489 -0.1507 -0.3182 -0.0183 -0.01007
<rayopt.analysis.Analysis at 0x1e880be7f28>