Skip to content

Instantly share code, notes, and snippets.

@brandondube
Created July 28, 2020 16:05
Show Gist options
  • Save brandondube/4f15bf9a5f236de17da3b433366a04fa to your computer and use it in GitHub Desktop.
Save brandondube/4f15bf9a5f236de17da3b433366a04fa to your computer and use it in GitHub Desktop.
deconv demo
from prysm import AiryDisk, SiemensStar
from matplotlib import pyplot as plt
oversamp=8
obj = SiemensStar(32, sinusoidal=False, sample_spacing=5/oversamp, samples=512*oversamp).msaa(oversamp)
psf = AiryDisk(fno=32, wavelength=.55, extent=obj.support/2, samples=obj.samples_x)
obj.plot2d(xlim=50, interpolation='bilinear')
blurred = obj.conv(psf)
deblurred = blurred.deconv(psf, balance=1)
deblurred.plot2d(xlim=200)
fig, axs = plt.subplots(figsize=(15,5), ncols=3)
for (o, ax, lab) in zip((obj, blurred, deblurred), axs, ('object', 'image', '"diffraction corrected"')):
o.plot2d(fig=fig, ax=ax, show_colorbar=False, show_axlabels=False, xlim=(-200,0))
ax.set_title(lab)
plt.savefig('comparison-of-diffraction-reversal.png', dpi=200, bbox_inches='tight')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment