opticspy has a set of Zernike Polynomials Method

1. It can generate arbitrary combination Z1 to Z37 Zernike Polynomials surface

2. It can generate arbitrary combination Z1 to Z37 Zernike Polynomials 2D map(heatmap)

3. It can generate arbitrary combination Z1 to Z37 Zernike Polynomials 1D cutoff through x and y axis of a 3D Zernike Polynomials surface

4. The zernike coefficient can use to generate Twyman Green interferogram based on zernike polynomials

5. Point spread function(PSF), Modulate transfer function(MTF), Phase transfer function(PTF)

6. Covert Zernike polynomials coefficients to Seidel coefficients

7. Other helpful methods to use Zernike Polynomials and specific help manual

In [1]:
%matplotlib inline
import opticspy

Generate arbitrary combination Z1 to Z37 Zernike Polynomials surface

In [2]:
Z = opticspy.zernike.Coefficient(Z11=1) 
Z.zernikesurface()
Z11 =  1 Z40 Primary Spherical
In [3]:
Z = opticspy.zernike.Coefficient(Z8=1) 
Z.zernikesurface()
Z8 =  1 Z31 Primary x Coma
In [4]:
Z = opticspy.zernike.Coefficient(Z2=0.1,Z11=0.2,Z15=0.3,Z32=0.1) 
Z.zernikesurface()
Z2 =  0.1 Z11 x Tilt
Z11 =  0.2 Z40 Primary Spherical
Z15 =  0.3 Z44 y Tetrafoil
Z32 =  0.1 Z73 Tertiary x Trefoil

Generate Z1 to Z37 Zernike Polynomials surface 2D map(heatmap)

In [5]:
Z = opticspy.zernike.Coefficient(Z11=1) 
Z.zernikemap()
Z11 =  1 Z40 Primary Spherical
In [6]:
Z = opticspy.zernike.Coefficient(Z8=1) 
Z.zernikemap()
Z8 =  1 Z31 Primary x Coma
In [7]:
Z = opticspy.zernike.Coefficient(Z2=0.1,Z11=0.2,Z15=0.3,Z32=0.1) 
Z.zernikemap()
Z2 =  0.1 Z11 x Tilt
Z11 =  0.2 Z40 Primary Spherical
Z15 =  0.3 Z44 y Tetrafoil
Z32 =  0.1 Z73 Tertiary x Trefoil

Generate arbitrary combination Z1 to Z37 Zernike Polynomials 1D cutoff through x and y axis of a 3D Zernike Polynomials surface figure

In [8]:
Z = opticspy.zernike.Coefficient(Z11=1) 
Z.zernikeline()

Generate Twyman Green interferogram based on zernike polynomials

In [9]:
Z = opticspy.zernike.Coefficient(Z2 = 1, Z3 = 1, Z4 = 0.2, Z5=0.5)
Z.twyman_green()

Point spread function(PSF), Modulate transfer function(MTF), Phase transfer function(PTF)

In [10]:
Z = opticspy.zernike.Coefficient(Z6 = 1, Z8 = 0.2, Z10 = 0.5)
Z.psf(r=2)
Z.mtf()
Z.ptf()
2 6.32e-07 0.1
<matplotlib.figure.Figure at 0x1133b5d50>
<matplotlib.figure.Figure at 0x1133b58d0>
Out[10]:
0

Covert Zernike polynomials coefficients to Seidel coefficients

After getting Seidel coefficients(It is a class), user could also use these coefficients to

generate interferogram or 3D suface,etc

In [11]:
Z = opticspy.zernike.Coefficient(Z6 = 1, Z8 = 0.2, Z10 = 0.5)
S = Z.zernike2seidel()
                 Magnitude  Angle (Degrees)
-------------------------------------------
|        Piston |       0.0  |      0.0   |
|          Tilt |     1.131  |    180.0   |
|       Defocus |    -9.798  |      0.0   |
|   Astigmatism |     4.899  |      0.0   |
|          Coma |     1.697  |      0.0   |
|     Spherical |       0.0  |      0.0   |
-------------------------------------------
In [12]:
S.seidelsurface()
In [13]:
S.twyman_green()

Helpful methods to use Zernike Polynomials and specific help manual

In [14]:
Z = opticspy.zernike.Coefficient(Z2=0.1,Z8=0.2,Z15=0.3,Z32=0.1)
Z.listcoefficient()
Z2 =  0.1 Z11 x Tilt
Z8 =  0.2 Z31 Primary x Coma
Z15 =  0.3 Z44 y Tetrafoil
Z32 =  0.1 Z73 Tertiary x Trefoil
Out[14]:
['Z2 = 0.1\nZ8 = 0.2\nZ15 = 0.3\nZ32 = 0.1\n',
 'Z2 = 0.1  Z8 = 0.2  Z15 = 0.3  Z32 = 0.1  ']
In [15]:
Z.zernikelist()
Z1:Z00 Piston or Bias
Z2:Z11 x Tilt
Z3:Z11 y Tilt
Z4:Z20 Defocus
Z5:Z22 Primary Astigmatism at 45
Z6:Z22 Primary Astigmatism at 0
Z7:Z31 Primary y Coma
Z8:Z31 Primary x Coma
Z9:Z33 y Trefoil
Z10:Z33 x Trefoil
Z11:Z40 Primary Spherical
Z12:Z42 Secondary Astigmatism at 0
Z13:Z42 Secondary Astigmatism at 45
Z14:Z44 x Tetrafoil
Z15:Z44 y Tetrafoil
Z16:Z51 Secondary x Coma
Z17:Z51 Secondary y Coma
Z18:Z53 Secondary x Trefoil
Z19:Z53 Secondary y Trefoil
Z20:Z55 x Pentafoil
Z21:Z55 y Pentafoil
Z22:Z60 Secondary Spherical
Z23:Z62 Tertiary Astigmatism at 45
Z24:Z62 Tertiary Astigmatism at 0
Z25:Z64 Secondary x Trefoil
Z26:Z64 Secondary y Trefoil
Z27:Z66 Hexafoil Y
Z28:Z66 Hexafoil X
Z29:Z71 Tertiary y Coma
Z30:Z71 Tertiary x Coma
Z31:Z73 Tertiary y Trefoil
Z32:Z73 Tertiary x Trefoil
Z33:Z75 Secondary Pentafoil Y
Z34:Z75 Secondary Pentafoil X
Z35:Z77 Heptafoil Y
Z36:Z77 Heptafoil X
Z37:Z80 Tertiary Spherical
In [16]:
help(opticspy.zernike.Coefficient)
Help on class Coefficient in module opticspy.zernike:

class Coefficient(__builtin__.object)
 |  Return a set of Zernike Polynomials Coefficient
 |  
 |  Methods defined here:
 |  
 |  __init__(self, Z1=0, Z2=0, Z3=0, Z4=0, Z5=0, Z6=0, Z7=0, Z8=0, Z9=0, Z10=0, Z11=0, Z12=0, Z13=0, Z14=0, Z15=0, Z16=0, Z17=0, Z18=0, Z19=0, Z20=0, Z21=0, Z22=0, Z23=0, Z24=0, Z25=0, Z26=0, Z27=0, Z28=0, Z29=0, Z30=0, Z31=0, Z32=0, Z33=0, Z34=0, Z35=0, Z36=0, Z37=0)
 |  
 |  __psfcaculator__(self, r=1, lambda_1=6.32e-07, z=0.1)
 |      pupil: Exit pupil diameter
 |      z: Distance from exit pupil to image plane
 |      r: pupil radius, in unit of lambda
 |  
 |  listcoefficient(self)
 |      ------------------------------------------------
 |      listcoefficient():
 |      
 |      List the coefficient in Coefficient
 |      
 |      ------------------------------------------------
 |  
 |  mtf(self, r=1, lambda_1=6.32e-07, z=0.1, matrix=False)
 |      Modulate Transfer function
 |  
 |  otf(self, r=1, lambda_1=6.32e-07, z=0.1)
 |  
 |  outputcoefficient(self)
 |  
 |  psf(self, r=1, lambda_1=6.32e-07, z=0.1)
 |      ------------------------------------------------
 |      psf()
 |      
 |      Return the point spread function of a wavefront described by
 |      Zernike Polynomials
 |      ------------------------------------------------
 |      Input: 
 |      
 |      r: exit pupil radius(mm)
 |      
 |      lambda_1: wavelength(m)
 |      
 |      z: exit pupil to image plane distance(m)
 |  
 |  ptf(self)
 |      Phase transfer function
 |  
 |  removecoma(self)
 |      Remove coma, most of coma is caused by misalinement
 |      ??? Is high order coma also caused by misalinement ???
 |  
 |  removepiston(self)
 |      Remove piston, it is just same value for whole aberration map
 |  
 |  removetilt(self)
 |      Remove tilt, it is mainly caused by system tilt, not aberration 
 |      on surface
 |  
 |  twyman_green(self, lambda_1=632, PR=1)
 |  
 |  zernike2seidel(self)
 |      Ap is the piston aberration,coefficients Ai represent the 
 |      peak value of the corresponding Seidel aberration term,
 |  
 |  zernikeline(self)
 |      ------------------------------------------------
 |      zernikeline()
 |      
 |      Return a 1D cutoff through x and y axis of a 3D 
 |      Zernike Polynomials surface figure
 |      ------------------------------------------------
 |  
 |  zernikelist(self)
 |      ------------------------------------------------
 |      zernikelist():
 |      
 |      List all Zernike Polynomials
 |      
 |      ------------------------------------------------
 |  
 |  zernikemap(self, label=True)
 |      ------------------------------------------------
 |      zernikemap(self, label_1 = True):
 |      
 |      Return a 2D Zernike Polynomials map figure
 |      
 |      label: default show label
 |      
 |      ------------------------------------------------
 |  
 |  zernikematrix(self, l=100)
 |  
 |  zernikesurface(self, label=True, zlim=[], matrix=False)
 |      ------------------------------------------------
 |      zernikesurface(self, label_1 = True):
 |      
 |      Return a 3D Zernike Polynomials surface figure
 |      
 |      label_1: default show label
 |      
 |      ------------------------------------------------
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  __coefficients__ = []
 |  
 |  __zernikelist__ = ['Z00 Piston or Bias', 'Z11 x Tilt', 'Z11 y Tilt', '...

In [17]:
help(Z.zernikesurface)
Help on method zernikesurface in module opticspy.zernike:

zernikesurface(self, label=True, zlim=[], matrix=False) method of opticspy.zernike.Coefficient instance
    ------------------------------------------------
    zernikesurface(self, label_1 = True):
    
    Return a 3D Zernike Polynomials surface figure
    
    label_1: default show label
    
    ------------------------------------------------