Opticspy could do Hartmann test spotdiagram simulation based on Zernike Polynomials.

Hartmann test measures the wavefront slope. Hartmann patterns are the same as the spot diagrams obtained in lens design.

In [1]:
%matplotlib inline
import opticspy

First let's see some tilt, we could see that the spot position move away from (0,0)

In [2]:
Z = opticspy.zernike.Coefficient(Z3=0.02)
Z.hartmann()

Next example is spherical aberration

In [3]:
Z = opticspy.zernike.Coefficient(Z4=0.2,Z11=0.03)
Z.hartmann()

Now for astigmatism and desfocus

In [4]:
Z = opticspy.zernike.Coefficient(Z4=0.2,Z5=0.08)
Z.hartmann()

Following is coma

In [5]:
Z = opticspy.zernike.Coefficient(Z8=0.5)
Z.hartmann()

Now lets see some mix aberration Hartmann pattern

In [6]:
Z = opticspy.zernike.Coefficient(Z7=0.2,Z15=0.001,Z23=0.003,Z28=0.01)
Z.hartmann()