opticspy has Zernike Polynomials fitting method

This method could fit nth(1-37) Zernike Polynomial to a surface or an aberration. The example below is first generating a test surface, which in practice is got from an interferometer or a detector. Then we could input the detected matrix to the fitting program.

In [1]:
%matplotlib inline
import opticspy
In [2]:
Z = opticspy.test.test_surface.spherical_surf(200)

Here is where fitting start. The program could generate:

1. The fitted 1-nth Zernike Polynomial Coefficients

2. The bar graph of these Coefficients

3. The remaining aberrations 3D surface

4. The remaining aberrations 2D surface heat map

5. The interferogram in 632nm, if you want interferogram in other wavelength,

....you can use opticspy.interferometer_zenike method

6. The surface generate by fitted Zernike Coefficients.

In [3]:
#Begin Fitting
fitlist,C1 = opticspy.zernike.fitting(Z,12,remain2D=1,remain3D=1,barchart=1,interferogram=1)
C1.zernikesurface(zlim=[-1,2])
                            Zernike Polynomials List                              
----------------------------------------------------------------------------------
|   Z1  |   Z2  |   Z3  |   Z4  |   Z5  |   Z6  |   Z7  |   Z8  |   Z9  |  Z10  |
----------------------------------------------------------------------------------
| 0.000 | 0.000 |-0.000 |-0.213 | 0.000 | 0.000 |-0.000 |-0.000 |-0.000 |-0.000 |
----------------------------------------------------------------------------------
|  Z11  |  Z12  |  Z13  |  Z14  |  Z15  |  Z16  |  Z17  |  Z18  |  Z19  |  Z20  |
----------------------------------------------------------------------------------
|-0.033 |-0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 |
----------------------------------------------------------------------------------
|  Z21  |  Z22  |  Z23  |  Z24  |  Z25  |  Z26  |  Z27  |  Z28  |  Z29  |  Z30  |
----------------------------------------------------------------------------------
| 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 |
----------------------------------------------------------------------------------
|  Z31  |  Z32  |  Z33  |  Z34  |  Z35  |  Z36  |  Z37  |                       |
----------------------------------------------------------------------------------
| 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 |                       |
----------------------------------------------------------------------------------
Z4 =  -0.213 Z20 Defocus
Z11 =  -0.033 Z40 Primary Spherical
In [ ]: