from scipy import ndimage
import scipy
def _airy_func(rr, amplitude=1.0, width=1.0):
"""
For a simple radially symmetric airy function, returns the value at a given
(normalized) radius
"""
return amplitude * (2.0 * scipy.special.j1(rr/width) / (rr/width))**2
che=ndimage.imread('../figures/CheHigh.jpg',flatten=True)
imshow(che,cmap='gray')
X=arange(-50,50)*1.0+1.e-5
x,y=array(meshgrid(X,X))
rr=hypot(x,y)
psf=_airy_func(rr,width=2.0)
figure(figsize=(10,5))
subplot(121), imshow(psf,cmap='gray')
subplot(122), plot(psf[50,:])
che_bis=fftconvolve(che,psf)
figure(figsize=(10,5))
subplot(121), imshow(che,cmap='gray')
subplot(122), imshow(che_bis,cmap='gray')
figure(figsize=(10,5))
subplot(121), plot(che[2000,:])
subplot(122), plot(che_bis[2000,:])
psf=_airy_func(rr,width=10.0)
figure(figsize=(10,5))
subplot(121)
imshow(psf)
subplot(122)
plot(psf[50,:])
che_bis=fftconvolve(che,psf)
figure(figsize=(10,5))
subplot(121), imshow(che,cmap='gray')
subplot(122), imshow(che_bis,cmap='gray')
figure(figsize=(10,5))
subplot(121), plot(che[2000,:])
subplot(122), plot(che_bis[2000,:])