#!/usr/bin/env python # coding: utf-8 # In[1]: get_ipython().run_line_magic('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) # In[19]: # 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 = "Doublegauss-Nikkor-Wakamiya-50mmf1.4-US4448497" columns = "type distance roc diameter material" text = """ O 20 0 100 AIR S 5.0 78.360 76.0 1.79668/45.5 S 9.8837 469.477 76.0 AIR S 0.1938 50.297 64.0 1.77279/49.4 S 9.1085 74.376 62.0 AIR S 2.9457 138.143 60.0 1.6727/32.2 S 2.3256 34.326 51.0 AIR A 16.0698 0 49.6 AIR S 13.0 -34.407 48.8 1.74/28.3 S 1.938 -2906.977 57.0 1.77279/49.4 S 12.403 -59.047 60.0 AIR S 0.3876 -150.890 66.8 1.78797/47.5 S 8.333 -57.890 67.8 AIR S 0.1938 284.630 66.0 1.78797/47.5 S 5.0388 -253.217 66.0 AIR I 74.1 0 86.53 AIR """ # In[20]: s = ro.system_from_text(text, columns.split(), description=description) s.object.angle = np.deg2rad(20) s.fields = 0, .7, 1. #s.wavelengths = [587.5618e-9] # In[21]: s.update() print(s) # In[22]: ro.Analysis(s) # In[ ]: