In [1]:
%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
In [2]:
# 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 = "Nikkor-Z-35mmf1.8-JP2019090947A"
columns = "type distance roc diameter material"
text = """
O 20      0        3.0     AIR
S 0.5     4.6232   1.664   1.51680/64.13
S 0.102   0.8784   1.346   AIR
S 0.354   4.0730   1.314   1.95375/32.33
S 0.258  -2.0290   1.28    1.60342/38.03
S 0.083   3.2358   1.138   AIR
S 0.2595 -1.2945   1.096   1.68893/31.16
S 0.172   1.7517   1.262   1.85150/40.78
S 0.329  -1.7517   1.29    AIR
S 0.018   1.1917   1.306   1.49700/81.61
S 0.368  -3.5528   1.262   AIR
S 0.009   4.1556   1.174   1.83441/37.28
S 0.057   1.9836   1.114   AIR
A 0.187   0        1.066   AIR
S 0.514  -0.9917   0.956   1.61293/36.94
S 0.062  -5.7790   0.99    AIR
S 0.012   2.1244   1.088   1.59282/68.62
S 0.282  -1.3918   1.124   AIR
S 0.209  -8.4171   1.198   1.69350/53.20
S 0.098  -2.8176   1.228   AIR
S 0.229  -1.8973   1.29    1.58313/59.46
S 0.083  -6.9348   1.408   AIR
S 0.751   0        2.4     1.51680/64.13
S 0.074   0        2.4     AIR
I 0.0425  0        2.0     AIR
"""
In [6]:
s = ro.system_from_text(text, columns.split(),
    description=description, scale=21.6e-3)
s.object.angle = np.deg2rad(32)
s.fields = 0, .7, 1.
#s.wavelengths = [587.5618e-9]

s[11].conic     = -4.9288
s[11].aspherics = [0, -9.582E-02, 5.043E-01, -4.618E-01]
s[12].conic     = -0.4693
s[12].aspherics = [0, -8.355E-02, 5.689E-01, -2.913E-01]
s[18].conic     = 15.3255
s[18].aspherics = [0, -2.063E-01, 6.890E-02]
s[19].conic     = -0.9347
s[19].aspherics = [0, -2.416E-03, 1.158E-01, 1.983E-01, -1.130E-01]
s[20].conic     = -0.1889
s[20].aspherics = [0, -1.143E-01, -1.549E-01]
s[21].conic     = 0
s[21].aspherics = [0, -9.359E-02, -1.873E-01, 1.909E-01, -1.298E-01]
In [7]:
s.update()
print(s)
System: Nikkor-Z-35mmf1.8-JP2019090947A
Scale: 21.6 mm
Wavelengths: 588, 656, 486 nm
Fields: 0, 0.7, 1
Object:
 Semi-Angle: 32 deg
 Pupil:
   Pupil Distance: 1.61672
   Refractive Index: 1.00028
   Update Radius: True
   Radius: 0.444815
Image:
 Radius: 1
 Update Radius: True
 Pupil:
   Pupil Distance: -2.22302
   Refractive Index: 1.00028
   Update Radius: True
   Radius: 0.628845
Stop: 13
Elements:
 # T   Distance   Rad Curv   Diameter          Material       n      nd      Vd
 0 S         20        inf          3         basic/air   1.000   1.000   89.30
 1 S        0.5      4.623      1.664                 -   1.517   1.517   64.13
 2 S      0.102     0.8784      1.346         basic/air   1.000   1.000   89.30
 3 S      0.354      4.073      1.314                 -   1.954   1.954   32.33
 4 S      0.258     -2.029       1.28                 -   1.603   1.603   38.03
 5 S      0.083      3.236      1.138         basic/air   1.000   1.000   89.30
 6 S     0.2595     -1.294      1.096                 -   1.689   1.689   31.16
 7 S      0.172      1.752      1.262                 -   1.851   1.851   40.78
 8 S      0.329     -1.752       1.29         basic/air   1.000   1.000   89.30
 9 S      0.018      1.192      1.306                 -   1.497   1.497   81.61
10 S      0.368     -3.553      1.262         basic/air   1.000   1.000   89.30
11 S      0.009      4.156      1.174                 -   1.834   1.834   37.28
12 S      0.057      1.984      1.114         basic/air   1.000   1.000   89.30
13 S      0.187        inf      1.066         basic/air   1.000   1.000   89.30
14 S      0.514    -0.9917      0.956                 -   1.613   1.613   36.94
15 S      0.062     -5.779       0.99         basic/air   1.000   1.000   89.30
16 S      0.012      2.124      1.088                 -   1.593   1.593   68.62
17 S      0.282     -1.392      1.124         basic/air   1.000   1.000   89.30
18 S      0.209     -8.417      1.198                 -   1.694   1.694   53.20
19 S      0.098     -2.818      1.228         basic/air   1.000   1.000   89.30
20 S      0.229     -1.897       1.29                 -   1.583   1.583   59.46
21 S      0.083     -6.935      1.408         basic/air   1.000   1.000   89.30
22 S      0.751        inf        2.4                 -   1.517   1.517   64.13
23 S      0.074        inf        2.4         basic/air   1.000   1.000   89.30
24 S     0.0425        inf          2         basic/air   1.000   1.000   89.30

In [8]:
ro.Analysis(s)
System: Nikkor-Z-35mmf1.8-JP2019090947A
Scale: 21.6 mm
Wavelengths: 588, 656, 486 nm
Fields: 0, 0.7, 1
Object:
 Semi-Angle: 32 deg
 Pupil:
   Pupil Distance: 1.61672
   Refractive Index: 1.00028
   Update Radius: True
   Radius: 0.444815
Image:
 Radius: 1
 Update Radius: True
 Pupil:
   Pupil Distance: -2.22302
   Refractive Index: 1.00028
   Update Radius: True
   Radius: 0.628845
Stop: 13
Elements:
 # T   Distance   Rad Curv   Diameter          Material       n      nd      Vd
 0 S         20        inf          3         basic/air   1.000   1.000   89.30
 1 S        0.5      4.623      1.664                 -   1.517   1.517   64.13
 2 S      0.102     0.8784      1.346         basic/air   1.000   1.000   89.30
 3 S      0.354      4.073      1.314                 -   1.954   1.954   32.33
 4 S      0.258     -2.029       1.28                 -   1.603   1.603   38.03
 5 S      0.083      3.236      1.138         basic/air   1.000   1.000   89.30
 6 S     0.2595     -1.294      1.096                 -   1.689   1.689   31.16
 7 S      0.172      1.752      1.262                 -   1.851   1.851   40.78
 8 S      0.329     -1.752       1.29         basic/air   1.000   1.000   89.30
 9 S      0.018      1.192      1.306                 -   1.497   1.497   81.61
10 S      0.368     -3.553      1.262         basic/air   1.000   1.000   89.30
11 S      0.009      4.156      1.174                 -   1.834   1.834   37.28
12 S      0.057      1.984      1.114         basic/air   1.000   1.000   89.30
13 S      0.187        inf      1.066         basic/air   1.000   1.000   89.30
14 S      0.514    -0.9917      0.956                 -   1.613   1.613   36.94
15 S      0.062     -5.779       0.99         basic/air   1.000   1.000   89.30
16 S      0.012      2.124      1.088                 -   1.593   1.593   68.62
17 S      0.282     -1.392      1.124         basic/air   1.000   1.000   89.30
18 S      0.209     -8.417      1.198                 -   1.694   1.694   53.20
19 S      0.098     -2.818      1.228         basic/air   1.000   1.000   89.30
20 S      0.229     -1.897       1.29                 -   1.583   1.583   59.46
21 S      0.083     -6.935      1.408         basic/air   1.000   1.000   89.30
22 S      0.751        inf        2.4                 -   1.517   1.517   64.13
23 S      0.074        inf        2.4         basic/air   1.000   1.000   89.30
24 S   0.046251        inf          2         basic/air   1.000   1.000   89.30

lagrange: -0.29958
track length: 4.5105
object, image height: [1.0885 1.0587]
front, back focal length (from PP): [-1.5744  1.5744]
entry, exit pupil height: [0.4448 0.6288]
entry, exit pupil distance: [ 1.1167 -2.1805]
front, back focal distance: [0.0031 0.0452]
front, back principal distance: [ 1.5775 -1.5292]
front, back nodal distance: [ 1.5775 -1.5292]
front, back numerical aperture: [0.    0.272]
front, back f number: [1.7697 1.2518]
front, back working f number: [  inf 1.839]
front, back airy radius: [       inf 6.1011e-05]
transverse, angular magnification: [-0.      0.7074]

 # T      path         n   axial y  axial nu   chief y  chief nu
 0 S        20         1    0.4448         0    -1.089    0.6735
 1 S      20.5     1.517    0.4448   -0.0497   -0.7519    0.7575
 2 S      20.6         1    0.4415    0.2099    -0.701    0.3453
 3 S     20.96     1.954    0.5158   0.08916   -0.5787    0.4808
 4 S     21.21     1.603    0.5275  -0.00192   -0.5153    0.5698
 5 S      21.3         1    0.5274   0.09639   -0.4858    0.4792
 6 S     21.56     1.689    0.5524    0.3903   -0.3614    0.2869
 7 S     21.73     1.851    0.5922    0.3353   -0.3322    0.3178
 8 S     22.06         1    0.6518    0.0186   -0.2758    0.4518
 9 S     22.08     1.497    0.6521   -0.2532   -0.2676    0.5633
10 S     22.44         1    0.5899   -0.3357   -0.1291    0.5814
11 S     22.45     1.834    0.5868   -0.4535   -0.1239    0.6062
12 S     22.51         1    0.5727   -0.2126   -0.1051    0.5621
13 S      22.7         1     0.533   -0.2126-2.872e-18    0.5621
14 S     23.21     1.613    0.4237   0.04916    0.2888    0.7405
15 S     23.27         1    0.4256  0.004034    0.3173    0.7069
16 S     23.28     1.593    0.4257   -0.1147    0.3258     0.616
17 S     23.57         1    0.4054   -0.2873    0.4348    0.4309
18 S     23.78     1.694    0.3453   -0.2588    0.5248    0.4741
19 S     23.87         1    0.3304   -0.3401    0.5523    0.3382
20 S      24.1     1.583    0.2525   -0.2626    0.6297    0.5317
21 S     24.19         1    0.2387   -0.2826    0.6576    0.4764
22 S     24.94     1.517   0.02655   -0.2826     1.015    0.4764
23 S     25.01         1   0.01276   -0.2826     1.039    0.4764
24 S     25.05         1 0.0007568   -0.2826     1.059    0.4764

 # T       SA3      CMA3      AST3      PTZ3      DIS3     TACHC      TCHC
 0 S         0         0         0         0         0         0         0
 1 S-0.0001573-0.0008347  -0.00443  -0.01168   -0.0855-0.0008038 -0.004266
 2 S   0.09167  -0.05826   0.03702   0.06146  -0.06259  0.005904 -0.003752
 3 S  -0.01925  -0.01162 -0.007014    -0.019   -0.0157 -0.009261 -0.005591
 4 S -0.003941  0.009194  -0.02145 -0.008741   0.07042 -0.004063  0.009478
 5 S   0.00609  0.007724  0.009797   0.01843    0.0358  0.004784  0.006068
 6 S  0.004316 -0.009906   0.02274   0.04994   -0.1668  0.008445  -0.01938
 7 S  -0.03771  0.001309-4.547e-05 -0.004707  0.000165  0.003648-0.0001267
 8 S  -0.01141   0.01966  -0.03387  -0.04161    0.1301 -0.009182   0.01582
 9 S  -0.04856  -0.01949 -0.007822  -0.04414  -0.02086 -0.005302 -0.002128
10 S  -0.05839   0.07188   -0.0885  -0.01481    0.1272 -0.004252  0.005235
11 S    0.1539  -0.05315   0.06983  -0.01735   -0.1318  0.004919  -0.01395
12 S    -0.116   0.01815  -0.02428   0.03634    0.1073  0.001881   0.01257
13 S         0         0         0         0         0        -0         0
14 S   0.07098  -0.03002    0.0127   0.06073  -0.03106  0.009857  -0.00417
15 S-5.421e-05 0.0005075 -0.004751  -0.01042     0.142 -0.001077   0.01009
16 S -0.001548 -0.006515  -0.02741  -0.02776   -0.2321 -0.001667 -0.007015
17 S  -0.05802   0.01187 -0.002428  -0.04238  0.009166 -0.004494 0.0009192
18 S   0.04216   0.02985   0.08377   0.00771   0.07555  0.003083 -0.003461
19 S  -0.03017   0.01003 -0.002029  -0.02303  0.009605 -0.004109  0.001277
20 S   0.02721   0.00895   0.02309   0.03077   0.05718  0.002615-3.439e-05
21 S  -0.01004  0.002169  -0.02992 -0.008417  -0.02909 -0.001656  0.001993
22 S 0.0005982 -0.001008    0.0017        -0 -0.002865 0.0001408-0.0002374
23 S-0.0002876 0.0004847-0.0008171         0  0.001377 -6.77e-05 0.0001141
24 S         0        -0         0         0         0        -0         0
      0.001349 0.0009603  0.005892 -0.008666  -0.01255-0.0006595-0.0005554

Out[8]:
<rayopt.analysis.Analysis at 0x2bf81b0f668>
In [ ]: