Diffraction simulation with large tilt#

import lentil
import numpy as np
import matplotlib.pyplot as plt

amp = lentil.circle((256,256), 120)
amp -= lentil.circle(shape=(256,256), radius=40)
for angle in (0, 90, 180, 270):
    amp *= lentil.spider((256,256), 2, angle)
opd = lentil.zernike(amp, 2)*15e-6

p = lentil.Pupil(amplitude=amp, opd=opd, focal_length=10, pixelscale=1/240)
w = lentil.Wavefront(500e-9)
w *= p
w = lentil.propagate_dft(w, pixelscale=5e-6, shape=(256, 256))

psf = w.intensity/np.max(w.intensity)

fig, ax = plt.subplots(figsize=(2.5, 2.5))
ax.imshow(psf**0.1, cmap='inferno', vmin=0.15)
ax.set_title('Large tilt exposes periodic wraparound')
../_images/tilt-1.png
p_geom_tilt = p.fit_tilt()

w = lentil.Wavefront(500e-9)
w *= p_geom_tilt
w = lentil.propagate_dft(w, pixelscale=5e-6, shape=(256, 256))

psf = w.intensity/np.max(w.intensity)

fig, ax = plt.subplots(figsize=(2.5, 2.5))
ax.imshow(psf**0.1, cmap='inferno', vmin=0.15)
ax.set_title('Geometric tilt handling eliminates wraparound')
../_images/tilt-2.png