Berechnung der Beugung am Spalt mittels FFT

Jens Wagner 06/2015

Download this notebook

In [1]:
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline 

#Objektbild Spalt
spalt=np.zeros((512,512))  #schwarzes Bild
spalt[200:312,253:259]=1         #weisser Spalt in der Mitte

#Beugungsbild
#FFT=Fast Fourier Transformation
f = np.fft.fft2(spalt)      #Fouriertransformation
fshift = np.fft.fftshift(f) #Umsortieren (Butterfly algorithm)
#beugung = (np.abs(fshift))**2
beugung = (np.abs(fshift))**1.1 # !!!!!Potenz dient zum Anheben des Kontrasts. Physikalisch richtig ist die Potenz 2!

plt.figure(figsize=(12, 12))
plt.subplot(121)
plt.xticks([]), plt.yticks([])
plt.imshow(spalt, cmap = 'gray')
plt.title('Objektbild')

plt.subplot(122)
plt.xticks([]), plt.yticks([])
plt.imshow(beugung, cmap=plt.cm.gray)
plt.title('Beugungsbild')
plt.show()

beugung = (np.abs(fshift))**2
plt.plot(beugung[256])
plt.xlim([0,512]) #Intensit
Out[1]:
(0, 512)
In [ ]: